- This project is based on
Tetrisgame. - The program handles several pieces of different shapes, aiming to fit all of them into a 4x4 grid.
- The objective is to arrange the pieces without any gaps, ensuring that all the components find a suitable place within the grid.
-
Initially, the program does a
pre-processingto get all the valid ways to postion each piece, so that it's ready to use whenever it's needed later on during the whole excution proccess. -
The core concept involves implementing a
backtracking algorithm using threads. Each thread manages its own 4x4 grid and begins by strategically placing valid pieces. Then, it invokes another thread, acting as a child, to complete the process. -
The advantage is that the parent thread does not pause or wait for its child to finish, enabling both of them to proceed with their work concurrently. Both threads operate simultaneously, continuously adding pieces and generating children in an uninterrupted manner.
-
In summary, the entire tree formed by the backtracking algorithm operates concurrently, leading to a faster and more efficient way to achieve an optimal result.
- The program shows various letter-shaped blocks (L, T, I, O, Z, S) that can be arranged.
- As a user, you pick the quantity of each shape, and the program provides a potential arrangement solution for the Tetris board.
- Each time you run the program with the same input, it usually gives a different valid solution.
- In case of valid query, the program visualize the steps for the solution :
- In case of invalid query :


