public/subjects/tetris-optimizer
EvilgeniuS1982 9053a749d0
Update README.md
2022-02-25 15:44:29 +00:00
..
audit Update README.md 2022-02-17 17:13:23 +00:00
badexample00 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
badexample01 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
badexample02 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
badexample03 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
badexample04 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
badformat move subjects to folders 2020-06-16 19:22:03 +02:00
goodexample00 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
goodexample01 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
goodexample02 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
goodexample03 Reformat markdown (with prettier) 2021-04-27 21:04:54 +02:00
hardexam move subjects to folders 2020-06-16 19:22:03 +02:00
README.md Update README.md 2022-02-25 15:44:29 +00:00

README.md

tetris-optimizer

Objectives

Develop a program that receives only one argument, a path to a text file which will contain a list of tetrominoes and assemble them in order to create the smallest square possible.

Instructions

The program must :

  • Compile successfully
  • Assemble all of the tetrominoes in order to create the smallest square possible
  • Identify each tetromino in the solution by printing them with uppercase latin letters (A for the first one, B for the second, etc)
  • Expect at least one tetromino in the text file
  • In case of bad format on the tetrominoes or bad file format it should print ERROR
  • The project must be written in Go.
  • The code must respect the good practices.
  • It is recommended to have test files for unit testing.

Allowed packages

Example of a text File

#...
#...
#...
#...

....
....
..##
..##
  • If it isn't possible to form a complete square, the program should leave spaces between the tetrominoes. For example:
ABB.
ABB.
A...
A...

Usage

$ cat -e sample.txt
...#$
...#$
...#$
...#$
$
....$
....$
....$
####$
$
.###$
...#$
....$
....$
$
....$
..##$
.##.$
....$
$
....$
.##.$
.##.$
....$
$
....$
....$
##..$
.##.$
$
##..$
.#..$
.#..$
....$
$
....$
###.$
.#..$
....$
$ go run . sample.txt | cat -e
ABBBB.$
ACCCEE$
AFFCEE$
A.FFGG$
HHHDDG$
.HDD.G$
$

This project will help you learn about:

  • The use of algorithms
  • Reading from files