mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OGordoo
4514987efe
|
4 years ago | |
---|---|---|
.. | ||
audit | 4 years ago | |
badexample00 | 4 years ago | |
badexample01 | 4 years ago | |
badexample02 | 4 years ago | |
badexample03 | 4 years ago | |
badexample04 | 4 years ago | |
badformat | 4 years ago | |
goodexample00 | 4 years ago | |
goodexample01 | 4 years ago | |
goodexample02 | 4 years ago | |
goodexample03 | 4 years ago | |
hardexam | 4 years ago | |
README.md | 4 years ago |
README.md
tetrisoptimizer
Objectives
Develop a program that receives only one argument, a path to a text file which will contain a list of tetrominoes to assemble them in order to create the smallest square possible.
Allowed packages
- Only the standard go packages are allowed
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 that the code should present a test file.
This project will help you learn about:
- The use of algorithms
- Reading from files
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
student@ubuntu:~/tetrisoptimizer$ cat -e sample.txt
...#$
...#$
...#$
...#$
$
....$
....$
....$
####$
$
.###$
...#$
....$
....$
$
....$
..##$
.##.$
....$
$
....$
.##.$
.##.$
....$
$
....$
....$
##..$
.##.$
$
##..$
.#..$
.#..$
....$
$
....$
###.$
.#..$
....$
student@ubuntu:~/tetrisoptimizer$ ./tetrisoptimizer sample.txt | cat -e
ABBBB.$
ACCCEE$
AFFCEE$
A.FFGG$
HHHDDG$
.HDD.G$
student@ubuntu:~/tetrisoptimizer$