AI working but really dumb
Implementing the AI of my last post wasn’t nearly as hard as I figured it’d be.. and not very slow either. It’s likely that a more complete AI is possible!
Here’s what it does:
(do this every time a new piece is chosen)
Repeat for each column and rotation possible:
-Apply r rotations 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.
Minimizing average column height is a bad idea after all. It ends up chosing to stack high towers to keep some columns really low and loses the game very quickly. I’ll try throwing in more criteria and see what happens.