Is it possible to express the entire Tetris game using matrix / linear algebra?

I *think* that what would be ideal is having two matrices: the current game state and a matrix that contains nothing but the incoming tetrad. The latter is generated by a time dependent function and the former is generated from the previous state and the tetrad matrix. You could feasibly represent the whole game this way.
Note, an operator from one state (non-zero) to another does exists (for all states). But a general operator (for instance ROTATE), that accounts for context of the existing lines etc... probably does not exist

re: you building a game out of this, even if you figured something out, it is not the most efficient. Even with a sparse matrix, this is less ideal than procedural updates.

But it's an interesting idée. All possible Tetris boards are enumerable, you could express the game as a Markov chain (but an impractically large one)
My initial thought was something like the following.  For number of rows r, number of columns c:

First a vectorspace V_c comprising of Boolean vectors of dimension r [i.e. V_c ~ (Z_2)^c ].  These will represent "on-off" states for the blocks in each row.  So, for example, (1,0,1,1,1) would be a row with the second block empty, and the others filled.

A second, ordered vectorspace W_r, of dimension r, with a basis w_k (k indicating the height from row 1).

Then, every game state is an element of the vectorspace W\_r tensor V_c.  We can do things like suggest quotienting by vectors of the form w_k × (1,1,...,1), which is equivalent to a row clearing.  Define a time step as something like t(w_k × v_j) = w_(k-1) × v_m , where v_j and v_m are related by some rule determining whether blocks can fall down or not.  Rotations will be a similar function (more difficult because you have to identify parts of the vectors in V_r as being part of the falling block, rather than stationary?).

I'm potentially overcomplicating it, but it is a complex problem to start with.  Maybe there is something here that helps anyway.

Edit: Tried my hardest to wrestle with Reddit formatting, I once again lament the lack of LaTeX formatting on this website.
Let me rephrase my question:

The typical approach is to use the control statements (if/else/for/while) to access and modify the 2D grid, which is not linear algebra.

I wonder if there's a mathematical way to collapse those control structures into a series of  matrix transformations.
yes take the free vector space generated by every possible game state, then the transformation matrix from one game state to the next is determined by that same permutation in basis vectors
Interesting I had a similar idea. On the hp 50 g series of calculators the matrix operations are somewhat less "fancy" and I wanted to dive deep in them with some problem.

Tetrix seems perfect for this. Anyway it was a bit of a letdown that, as far as I could, a movement of a piece , say the long piece that goes down once, requires a matrix multiplication with a matrix that is having '1' only where the long piece would be at the next tick, and that is a bummer.

I thought compressed ways to represent this without literally representing the next tick, but I didn't find them. Thus I said "well no, I wanted to spare some operations, not simply map 1:1 everything in matrices".

Please write an article/update if you succeed!
You could probably do this with tensors, where some dimensions would encode the "state" of pieces.  You could then unwrap the tensors into linear matrices.  This would be functionally equivalent to standard arrays, but more difficult.  Don't try to do this, please.
I know a lot about Tetris but not much about linear algebra. Because the pieces rotate are around a point that moves with the piece, I would guess it’s not possible to rotate them with a function. Even most programs just hard-code all 28 possible pieces and rotations. Movements (ie translations) might be a bit easier, but like I said I don’t know a lot about linear algebra.
### I do not think it is possible
Let's simplify the quesiton a bit,

Let's assume the initial matrix is the following


m₀ = [ 1 1 0
0 1 0
0 0 0
]


And you want to goto state m₁   (m₀ have three blocks, and m₁ also have three blocks)


m₁ = [ 1 0 0
0 1 0
0 0 1
]


So the question is whether you can find a matrix M such as  M x m₀ = m₁


Proof:
Assume you can find one or more matrixes such as
A_n ...A₁A₀ x m₀ = m₁

In this case we have
M = A_n ... A₁A₀

det(A_n ... A₁A₀ x m₀)     = det(m₁)

=> det(A_n ... A₁A₀) det (m₀) = det (m₁)     (∵  det(AB) = det(A)det(B))

But det(m₀) = 0 => det(M) = 0  (LHS)
det(m₁) = 1                    (RHS)  (det of diagonal matrix is the product of diagonal elements)

LHS /= RHS

M does not exist

Almost everything in math tries to boil down to linear algebra because that's what we understand well at the end of the day.

0 like 0 dislike