A small clone of Tetris written in Python and using Pygame
Find a file
Gabriel Viso Carrera 2ab20a21b3 License update
2021-02-12 14:12:46 +11:00
images Translated the code to English to have a bit of consistency 2021-02-10 19:00:28 +11:00
.flake8 some code refactoring 2021-02-12 11:22:05 +11:00
.gitignore Jetbrains 2021-02-10 22:09:50 +11:00
.pre-commit-config.yaml Code Linting 2021-02-12 13:30:45 +11:00
cuatris.py Typos 2021-02-12 13:56:38 +11:00
LICENSE License update 2021-02-12 14:12:46 +11:00
Pipfile Code Linting 2021-02-12 13:30:45 +11:00
Pipfile.lock Restored file after some depedency drama 2021-02-12 13:44:40 +11:00
pyproject.toml some code refactoring 2021-02-12 11:22:05 +11:00
README.md Typos 2021-02-10 19:26:22 +11:00

Cuatris-Python

A small Tetris clone written in Python and using Pygame.

Cuatris-Python in action

Install Python 3 and pipenv

Install a stable release of Python 3 on your system, and then install pipenv.

It is preferable to install pipenv in the user space in order to avoid breaking system-wide packages or Python installations. This applies especially to macOS and GNU/Linux, including Raspberry Pi OS, because they are known to have a lot of system components written in Python.

In the command line, type:

$ pip install --user pipenv

Clone this Repository and Install Dependencies

After cloning the repository with git or downloading as a zip file and uncompressing it, navigate to its folder and type the following in the command line:

$ pipenv install

The right dependencies will install thanks to the files Pipfile and Pipfile.lock.

Run the Game

$ pipenv run python cuatris.py

Alternatively you can start an dedicated Python environment and run the game within it. This is useful in case you want to tinker with the code after the game.

$ pipenv shell
(cuatris-python) $ python cuatris.py

Troubleshooting

The Text Doesn't Render

Back in 2016, Pygame couldn't render fonts in macOS Sierra, and the Pygame window was freezing as a consequence of that. If you find that, still today, the Pygame window gets frozen under macOS, comment out all pygame.font usage.

Under GNU/Linux it runs OK, and it wasn't tested on macOS upper releases.

Note

This code was written in 2016 using IDLE solely for educational purposes. Tests, a more advanced / professional project structure and other Software-Engineering related improvements may, or may not, come in the future.