Skip to content

An artificial intelligence for the game Tetris with a fully functional Tetris emulator in C. Combine different types of AI and learning algorithms

License

Notifications You must be signed in to change notification settings

SunnyDjinn/Rusty-Sapphire

Repository files navigation

Rusty-Sapphire

An artificial intelligence for the game Tetris with a fully functional Tetris emulator in C. Combine different types of AI and learning algorithms

Compilation:

On Linux/MAC OS: Type the command "make" on a terminal, in the folder where the sources and the makefile are located

Execution:

On Linux/MAC OS: execute using "./Tetris" after compilation

The program is set to run the AI reading the pieces from the "pieces" file, and writing the moves executed in the "moves" file. /!\ It automatically generates a pieces file, and overrides the previous one /!\ Comment the "generatePiecesFile(LENGTH)" line to avoid that

The main function is located in "Tetris.c". From there, you can choose to: - run the AI using the "pieces" file as an input - run the genetic algorithm - run the hill climbing algorithm

Comment or uncomment the lines corresponding to the different actions.

The parameters are set as follows: - LENGTH: 1000, number of pieces to generate/read/play - DISPLAY: 1, allows the program to display the game board after every move played - DEPTH: 2, the depth the AI uses to look the pieces ahead - GENETIC_GENERATIONS_NB: 100, number of generations generated by the genetic algorithm - GENETIC_GAMES_NB: 10, number of games per individual and per generation - GENETIC_PIECES_LENGTH: 10000, number of pieces per game - GENES_NB: 100, number of individuals per generation - PRECISION: 0.001, slight modification for genetic algorithm, or modification for hill climbing - HILL_CLIMBING_GAMES_NB: 10, number of games played per modification in hill climbing - HILL_CLIMBING_GAME_LENGTH: 10000, number of pieces per game for hill climbing

You can find these constants in "Tetris.h" and modify them as your convenience

About

An artificial intelligence for the game Tetris with a fully functional Tetris emulator in C. Combine different types of AI and learning algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages