Skip to content

Tetris written in C++ with an Evolutionary AI implemented

Notifications You must be signed in to change notification settings

bariccattion/Tetris_Evolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris Evolution

A Tetris in C++ for terminal, but with an Evolutionary AI implemented. All genes and values were choosen based on this paper.

Evolutionary AI

I have built a computer player that chooses the best move by rating each possible next-state using an evaluation function. After alot of experimentation, the evaluation function ended up being a weighted sum of these values: Filled Spot Count, Weighted Filled Spot Count, Maximum Altitude, Connected Holes Count, Maximum Well Depth, Number of Lines Cleared, Row Transitions and Hole Count. A genetic algorithm finds optimal weights for the function. A genetic algorithm simulates adaptation, mutation, natural selection, reproduction, chromosome crossover, and evolution.

Other changes

Each tetris game has an random algorithm implemented for selecting the next tetromino. The original tetris had an unbiased randomizer. No opinion to which piece should come next, just pick one and give it to the player. While an unbiased randomizer offers the greatest pure puzzle challenge to players, it is unstable, and can actually result in an unbeatable sequence. Since the idea of this project is to test the Evolutionary AI, I have implemented a version of the Tetris Worlds random generator. You can read more about how all tetris random algorithm works in this link over here, but in short, the TGM3 algorithm tries to fix the unbeatable sequence problem, and also allows for many building strategies to be consistently viable, which I would love for the AI to find out by itself.

About

Tetris written in C++ with an Evolutionary AI implemented

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published