Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/empicano/tetris-ai
Tetris in your terminal; Let the AI play for you and never loose!
https://github.com/empicano/tetris-ai
artificial-intelligence curses genetic-algorithm terminal tetris
Last synced: 20 days ago
JSON representation
Tetris in your terminal; Let the AI play for you and never loose!
- Host: GitHub
- URL: https://github.com/empicano/tetris-ai
- Owner: empicano
- License: mit
- Created: 2017-12-08T19:44:11.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-28T22:19:49.000Z (over 3 years ago)
- Last Synced: 2024-12-20T21:53:59.339Z (21 days ago)
- Topics: artificial-intelligence, curses, genetic-algorithm, terminal, tetris
- Language: Python
- Homepage:
- Size: 524 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
https://user-images.githubusercontent.com/26978146/120046881-754fae80-c013-11eb-8846-9f18c598ac29.mp4
>Did you know that Alexey Pajitnov, the original Tetris designer, derived the games name from the Greek numerical tetra (four) and tennis, his favorite sport?
## This Version
The exciting thing about this version is the implemented AI, which can play the game better (primarily a lot faster) than any human. I let it run until it hit one million cleared lines, so i assume that it can play forever.
The AI chooses for a new Tetronimo the best of all the possible positions the latter can take in by evaluating each one of the resulting boards based on weighted values (e.g. added height of all comumns) and finally choosing the one that yields the best score. I calculated the weights using a genetic algorithm, which can also be found in the source code.
This program runs on Linux using the Curses module. Start the game by running `python3 tetris.py` in your terminal.
## Controls
Key | Function
----|---------
⇧ | turn clockwise
⇦ | move to the left
⇨ | move to the right
⇩ | move one block down
↵ | move all the way down
Q | quit game
A | switch AI on/off