Trevor Bivi
Software Engineering Student Home Projects Work Experience About GitHub
Sound Mixer Minecraft Tools RuneScape Bot API
Garden Watering System Tetris Bot Steam Market Analyser
3D Computer Game Phone Game Other Projects
Mar 2017
Tetris Bot
Languages used
 Python extended with C.

What it is
 This is a program that automatically plays Tetris. It can play marathon mode and battle two-person mode on tetrisfriends.com, trying to use only Tetris (clearing four lines at once).


A video of the bot reaching level 13 of 15 on marathon mode with one back-to-back Tetris combo

How it works
 This bot reads pixel colours to capture board data. It then simulates all possible moves in the coming four turns to find the next move for the best outcome. The best outcome is determined by weighing in factors like the amount of Tetris that are performed, the number of holes created or removed, and the sum squared error of the column heights. A low sum squared error means there will be lots of ways to place blocks neatly in the future. This part of the program was re-written in C and sped up the average time needed to complete the simulations by over 100x. The bot then performs the chosen move and repeats.

Potential improvements
 This bot performs the simulations while the piece is already falling. It would be better to make it start simulating the options for its next move while performing its current one with multiprocessing. The biggest problem is the minimum time a key must be pressed for to be detected on this game client. Making the program work with a different version of Tetris would allow it to place blocks much faster and easily beat marathon mode.