Answer the question
In order to leave comments, you need to log in
What can be the algorithm for filling the matrix?
There is a matrix 4 cells wide.
The height is unlimited.
It is necessary to fill the matrix in such a way that it is always completely filled and mixed.
Elements can be 1x1, 1x2, 2x1, 2x2
What is the best fit here?
Answer the question
In order to leave comments, you need to log in
Random.Next(4) to get the figurine
Search/traverse the matrix in depth/width according to the shape of the figurine - i.e. there will be 4 implementations, how to fit a figure into the matrix
Checks for extreme values, so that if one line remains, then the figures are selected from the first three, if 3,2,1 cells remain the last.
Start from position 0,0 and move further to the right (the bypass algorithm must have rules for where and how to press, for example, right + up.)
This should be enough.
You have a simple Tetris! ) Only upside down.
Take a random piece and try to place it so that it occupies the cells in the topmost row-with-holes. If that's not possible, randomly choose again from 1-width shapes (1x1, 1x2).
Everything.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question