AI

Spent a lot of time thinking about the AI. Here’s what I think is my best shot:

(do this every time a new piece is chosen)

Repeat for each column and rotation possible:

-Apply r rotatiosn and move piece to x column as fast as possible

-Compute the resulting board

-Store the sequence of moves and the amount of points (inversely proportional to average column height and directly proportional to number of lines cleared)

Choose the sequence of moves that gives higher points.

 

This will miss all scenarios where the best move involves going to one side and then back below another piece. It will also require one move per y drop or it’s gonna look very ugly.

Wish I could’ve come up with something better but I’m not even sure I’ll be able to get this working under a 16MHz processor in the few hours I have left.