Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/informatter/text-tetris-engine


https://github.com/informatter/text-tetris-engine

Last synced: 3 days ago
JSON representation

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`