An algorithm to make the smallest possible "square" with a given list of tetrominoes, with no external C libraries.
- git clone https://github.com/pawaters/fillit
- open your terminal:
cd fillit
./fillit [input_file_of_your_choice]
For example:
./fillit valid1_test7
As you can see, each tetrimino is represented with a letter.
In summary:
- Main: checks if one file only is given as argument, and performs some basic format checks on the input file.
- Parse: takes the input file and converts it in a structure we defined, which enables our program to work on it .
- Validate: makes all the checks on the input so no edge case is left.
- Solve: we create an initial empty square of size X, try to put the tetriminoes, and if it doesn't work, increase the size and try again.
- Output & clean up: prints the square with the solution, and frees the memory used we do not need anymore.
For more detail on the logic, please check the files and its comments.