I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of:

a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step.

b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible.

c) This is arguable, but the AI should try to keep as minimum height as possible.

d) The number of columns containing atleast one block should be minimised.

But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?

  • \$\begingroup\$ I assume the 19 different pieces are the possible 19 fixed tetrominos ("tetris blocks" without rotation)? \$\endgroup\$ – Philipp Jun 13 '16 at 10:44

Another strategical rule of Tetris you didn't mention is that it is crucial to avoid closing up holes.

    || Bad move!

###   ##### #
###  ###### #
### ####### # <-Creates a closed up hole on this row. 
########### #

Place it somewhere on top instead!

When there is no way around it, it's better to create the hole in a row which already has one or more closed up holes instead of ruining another row.

Also, I understand where you are coming from with rule b), but avoiding bumpiness isn't always the best course of action. What's actually important is to keep the top in a shape which is able to accommodate a wide variety of possible tetrominios without creating holes. A perfectly flat surface isn't necessarily ideal for this. Especially in your variant where the T-, L- and J-tetrominios will not always occur in the rotation where they have a flat bottom.

Another thing to consider when you want to strengthen your AI: A good AI doesn't just think one turn ahead but several turns. It doesn't just need to consider how to place this piece, but also the next, the one after that, etc.

When the next piece is unknown, you can calculate the usefulness of each possible one after the move currently considered and pick the move with the best average rating for all possible follow-ups.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.