Giter Site home page Giter Site logo

tetris-ai's Introduction

banner.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

tetris-ai's People

Contributors

idleice avatar empicano avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.