Coder Social home page Coder Social logo

jdecorte-be / tetrisai Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 61 KB

Tetris AI: The Art of Perfect Play, Mastering the Classic Game with Advanced AI

Home Page: https://web.itu.edu.tr/~msilgu/tetris/tetris.html

Python 100.00%
ai pytorch pytorch-implementation tetris tetris-ai tetris-game tetris-machine-learning

tetrisai's Introduction

๐Ÿ“– Tetris AI

The (Near) Perfect Player

GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit

Dive into the world of Tetris AI, where advanced algorithms and strategic computations redefine how we play and master one of the most iconic video games. The essence of Tetris AI is to not just play Tetris, but to master it with precision, strategy, and computational intelligence.

Installation

Ensure you have Python 3 installed on your system.

Clone the Tetris AI repository:

git clone https://github.com/jdecorte-be/TetrisAI.git
cd TetrisAI

Learning and Testing

To train the AI model, run:

python3 learn.py

For testing the AI's performance, execute:

python3 test.py

The AI only work on https://web.itu.edu.tr/~msilgu/tetris/tetris.html at 200% zoom.

The Objective of Tetris AI

The primary goal of Tetris AI is not just to play Tetris but to excel at it. This involves mastering the game mechanics and employing strategies to maximize the score while minimizing the risk of losing.

How Does Tetris AI Work?

The AI employs various strategies and algorithms to optimize piece placement. It analyzes the board's current state, upcoming pieces, and potential future challenges, striving to avoid game-ending scenarios and maintain a clear board.

Aggregate Height

home Aggregate height is a crucial factor in Tetris AI. It measures the cumulative height of all the columns on the board. The AI aims to keep this value as low as possible to minimize the risk of topping out.

Complete Lines

login Complete lines are the essence of scoring in Tetris. The AI focuses on clearing multiple lines simultaneously, known as 'Tetrises', for maximum scoring efficiency. This involves strategically placing pieces to enable line clears while avoiding pile-ups.

Holes

chat Holes are empty spaces blocked from above by Tetriminos. The AI aims to minimize holes as they complicate future placements and hinder line completion. The strategy involves filling gaps and preventing new holes from forming.

Bumpiness

add Bumpiness refers to the roughness of the surface of the Tetris playfield. High bumpiness means more uneven surfaces and gaps. The AI seeks to keep the playfield as even as possible, reducing bumpiness to make piece placement easier and more predictable.

Challenges in Creating Tetris AI

Developing an AI capable of playing Tetris near-perfectly involves overcoming challenges like rapid decision-making and adaptability to evolving board states, all while maintaining calculation efficiency to keep pace with the game.

Conclusion

Creating a near-perfect Tetris player is a complex yet fascinating endeavor, showcasing how AI can master and optimize gameplay in a classic game like Tetris. This mirrors the broader advancements in AI, highlighting its growing ability to tackle and excel in human-designed challenges.

tetrisai's People

Contributors

jdecorte-be avatar matscosan avatar

Stargazers

CECI-BEST-LLN avatar

Watchers

 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.