Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/informatter/text-tetris-engine
https://github.com/informatter/text-tetris-engine
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/informatter/text-tetris-engine
- Owner: informatter
- Created: 2024-02-15T23:17:31.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-02-29T23:12:44.000Z (11 months ago)
- Last Synced: 2024-11-28T11:08:36.516Z (2 months ago)
- Language: Python
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A simple text based tetris engine
The program which takes as input through the CLI a string encoding polyminoe's and their location on the board.
The following supported pieces are Q, S, Z, I, L, J and T.
Letter
Q
Z
S
T
I
L
J
Polyminoe
##
##
##
##
##
##
###
#
####
#
#
##
#
#
##
The input is provided as a string like: 'Q0,Q1'
The integers correspond to the left most column the polyminoe should be placed at.The program outputs the final configuration height. For example if only a Q shape is left and its in the bottom of the board, the output would be 2
Built against python 3.11.7 ๐
## Running the engine
### Install dependencies
The solution uses the following dependencies:
- pytest
- numpy
- pyinstaller### Create virtual environment
`python -m venv env`
### Activate virtual environment
Windows ๐ช
`env/scripts/activate.ps1`
macOS ๐ / Linux ๐ง
`source env/bin/activate`
### Install dependencies
`pip install -r requirements.txt`
### Run solver
`python tetris.py 'Q0,Q2'`
Use `--help for more options`
# Run tests ๐งช
**Solver:**
`pytest tests/tetris_solver_tests.py`
**Polyminoe factory:**
`pytest tests/factory_test.py`