Tetris-optimizer is a program that receives only one argument, a path to a text file which contains a list of tetrominoes to assemble them in order to create the smallest square possible.
git clone https://github.com/SpectreH/tetris-optimizer.git
cd tetris-optimizer
go run . [FILE]
cat tests/sample.txt
...#
...#
...#
...#
....
....
....
####
.###
...#
....
....
....
..##
.##.
....
....
.##.
.##.
....
....
....
##..
.##.
##..
.#..
.#..
....
....
###.
.#..
....
go run . tests/sample.txt
ABBBB.
ACCCEE
AFFCEE
A.FFGG
HHHDDG
.HDD.G
Only standard go packages were in use. In tests
folder you can find several presets to generate squares and in error-tests
folder some bad presets examples.
To go through all tests, you can use:
bash test.sh
- SpectreH (https://github.com/SpectreH)