B PSU 155 Tetris.pdf


Aperçu du fichier PDF b-psu-155-tetris.pdf

Page 1 2 3 4 5 6


Aperçu texte


Tetris
80’s puzzle game in terminal phase
binary name:
repository name:
repository rights:
language:
group size:
compilation:

tetris
PSU_$YEAR_tetris
ramassage-tek
C
2
via Makefile, including re, clean and fclean rules

• Your repository must contain the totality of your source files, but no useless files (binary, temp files,
obj files,...).
• All the bonus files (including a potential specific Makefile) should be in a directory named bonus.
• Error messages have to be written on the error output, and the program should then exit with the
84 error code (0 if there is no error).
Authorized functions: rand, srand, getopt, and all functions used for PSU projects until this point
The goal of this project is to recreate the Tetris game in a UNIX terminal, with the Gameboy version rules. You have
to use ncurses.
In the folder of your binary, there must be a tetriminos directory, which contains files that describe the game pieces.

Terminal
- + x
∼/B-PSU-155> ls ./tetriminos/
bar.tetrimino
square.tetrimino
5.tetrimino
7.tetrimino
inverted-L.tetrimino
4.tetrimino
6.tetrimino
These files are composed in the following way:
1. on the first line, the size and color of the piece in this format: width height color_code\n (the number of
the color corresponds to the ncurses capacity’s color numbers),
2. on the h following lines (where h is the height of the tetrimino), the piece’s shape composed with asterisks (*)
and spaces (’ ’).

Terminal
∼/B-PSU-155> cat -e bar.tetrimino
1 4 2$
* $
* $
*$
* $

For instance, these pieces correspond to the opposite
files:

∼/B-PSU-155> cat -e 6.tetrimino
2 3 6$
**$
*$
**$

1

- + x