Tetris Autoplayer

Hello, i would like to ask. I’ve almost got no clue how does Autoplayer works. After reading the both the Project description and the Project Presentation. I would really like some explanation, can you explain to me what is ending state in Project presentation means. And where is the AutoPlayerView located?

1 Like

The project presentation already gives a pretty good hint on slides 23 and 24.
For each state, there are only a certain number of moves:

  • Left, Right, Down
  • Rotate

Now you think about: What really matters?

  • Is it essential to go left, left, down or down, left, left
  • Does it matter to rotate and then go left or the other way around?

When is one or the other order essential and when does it not matter?

You will come to a notion of an ending state for a piece.
Such ending states are manageable (as said in the presentation, there are at most 40 for each piece).
Now, these states represent the consequences of your actions.

You could use this information to decide what action will give the best outcome.
There are many ways to determine what “the best outcome” is:

  • Minimax
  • Heuristic evaluation of the states directly using a heuristic function h:\text{State}\to \mathbb{R}
  • Search algorithms
  • Heuristic search algorithms
  • depth-cut heuristic augmented searches

And for each approach, there are multiple ways to implement it (classically, graph-based search, neural network, …).
You have to decide how much effort you want to invest, what is a good strategy for Tetris, how to choose the hyper parameter, how to tune the parameter, and what strategy is fast enough.

Depending on how you perform in these decisions, your AI will be good enough to

  • Get the points for the exercise
  • Beat the tutor AI
  • Win the tournament

Note:
If you are interested in AI, the “artificial intelligence” course in the summer semester might be a good lecture to attend.
It shows a general introduction to many of the possibilities and areas of artificial intelligence.
If you are specifically interested in how one performs all these search algorithms efficiently although the search space is much too large to even imagine, and what these search strategies might also be useful for, AI Planning in winter terms might be a good lecture to attend.

3 Likes

There is one case that make me confusing about whether the order matters.

|+ +        |       + + 
|+          |     + +
|+ + + + + +|
|+ + + + + +|

Lets say we have the left side tiles at the ground and piece z above it.
Then I guess the order matters where the piece should make a dodge move (first right and then left) in order to have the state as follows:

|+ + + +    |
|+ + +      |
|+ + + + + +|
|+ + + + + +|

When I think about those cases; implementing the ai becomes so confusing for me because I feel like lots of possibilities - more than 40 - there. Is it really the case? I would be glad if you make comments on that issue.

Thanks in advance
Bahadir.

Yes, the order of the last few moves matter:

  • Down vs Right, Down, Left

Depending on your approach, you have to decide how to represent such cases and what you let your ai choose.

In the end, you always have five possibilities:

  • Left
  • Right
  • RCW
  • RCCW
  • Down

Depending on your approach, you might have intermediate/future possibilities and targets.
The amount heavily depends on your approach.
Whether you discard some possibilities or group some together.

1 Like