How to calculate maximum coverage of a matrix by tetris tiles?

300 views Asked by At

I am building a recursive function that will be given a size of a matrix (Rows and Cols).

The function will print the first optimal cover it encountered.

What I am looking for is the a way to calculate what will the optimal cover be, numerically. meaning, how many blank spaces will be left. Meaning, I need the stop signal for my recursive function.

There are 4 defined shapes; they can not be turned, but can be placed as many times as I want (including 0). These are the shapes:

XX
X0

00X
XXX

0X0
XXX

0X
XX
X0

0 representing blank spaces.

Given a specific matrix size, how can I know what is the maximum coverage of that matrix? As to the algorithm itself that will return the first optimal coverage, I think I will handle it myself.

I am writing in C but not looking for a source code - only an algorithm, preferably simple :)

BTW, no luck with trying to convert ALGORITHM X to match my problem.

0

There are 0 answers