- Program that produces the smallest possible square board that can fit given Tetris pieces. Among all possibilities, Tetris pieces were placed on their most upper-left position.
- Learn about string manipulation (string parsing from reading a file) and memory management
- Learn how to use and traverse a linked list (data structure)
- Learn how implement recursive backtracking algorithm
The input is a file that contains a list of Tetris pieces. Every Tetris piece fits in a 4x4 chars square and all Tetris pieces are separated by a newline each. Each Tetris piece follows the four rules below:
- Each Tetris piece is precisely 4 lines of 4 characters, each followed by a new line (4x4 square)
- A Tetris piece is composed of 4 blocks.
- Each character must be either a block character (#) or an empty character (.)
- Each block of a Tetris piece must touch at least one other block on any of its 4 sides (up, down, left, and right)
The smallest assembled square of Tetris pieces will be produced on the standard output, with letters A - Z representing the order of the Tetris pieces in the list and placed on the board.
- Because there are only 26 letters in the alphabet, the list of Tetris pieces is limited to 26 when reading the input file.
- Please refer to the example to the right
Please ensure you have gcc compiler and that you are using a Unix/Linux terminal
- Open Terminal and clone Repository into desired location
- Type "make" in the command line to create the executable program called "fillit"
- Run the executable by typing "./fillit file" where file is the text file containing the list of Tetris pieces
- Try typing "./fillit input" in the command line to view the output or create your own input file
- Program can be further optimized by storing each Tetris piece as bits instead of an integer array in our data structure
- Jinyu Liu (Partner for this project)
- Medium blog by Beth Locke


