This project is a Tetris AI that plays the classic Tetris game using a greedy algorithm about where to place incoming pieces. The project includes several modules, each responsible for a specific task in the AI.
- Python 3.x
board_generator.py: Generates the game board with specified dimensionsboard_grader.py: Calculates the score of a given board based on the number of holes, evenness of the board, and a variety of other factorsclear_lines.py: Checks for and clears completed lines on the boardcolor_check.py: Detects the color of a Tetris piecehole_checker.py: Detects holes in the boardkeylogger.py: Captures and processes keyboard inputs from the usermain_brain.py: The main module that ties all the other modules together to make decisions about where to place incoming piecesmove_executor.py: Executes moves on the board (e.g., rotate, move left/right, drop)poss_instructions.py: Defines the set of possible moves that the AI can makeprint_board_module.py: Prints the current state of the board to the consoleput_piece_on_board.py: Places a given Tetris piece on the board given a certain instructionrgb_detector.py: Detects the RGB color value of a pixel on the screentetris.py: The main Tetris AI game scripttetris_ready_checker.py: A module that checks if the board is ready for a tetris (i.e. it has a 4 block deep well on the right)
This project was created by Samuel Zhu.