Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Acknowledgements

I express my sincere gratitude to computer teacher


Parvathy miss for guiding me throughout the course of this project. I
am also grateful to the school Principal, G Devan sir for providing the
necessary facilities. I would also like to thank my parents for supporting
in all my endeavours.

Introduction
Tetris is a Russian tile-matching puzzle video game,
originally designed and programmed by Alexey Pajitnov."Tetriminos"
are game pieces shaped like tetrominoes, geometric shapes composed
of four square blocks each. A random sequence of Tetriminos falls
down the playing field (a rectangular vertical shaft, called the "well" or
"matrix").The objective of the game is to manipulate these Tetriminos,
by moving each one sideways (if the player feels the need) and rotating
it by 90 degree units, with the aim of creating a horizontal line without
gaps. When such a line is created, it disappears, and any block above
the deleted line will fall. As the game progresses, the Tetriminos fall
faster, and the game ends when the stack of Tetriminos reaches the top
of the playing field and no new Tetriminos are able to enter.

Header Files

IOSTREAM - for I/O operations


CONIO.H
- for getch() and kbhit()
STDLIB.H
- for exit(), srand(), rand()
WINDOWS.H - for using GetStdHandle(),
SetConsoleTextAttribute(),
SetConsoleCursorPosition() and COORD struct

TIME.H
CCTYPE
FSTREAM
TIMER.H
CMATH

- for using time_t class and time()


- for using tolower()
- for reading and writing data onto files
- for Timer class
- for floor()

Functions

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

arrmax(int)
arrmin(int)
delay(float)

- for finding maximum value in the array


- for finding minimum value in the array
- for creating time delay and for calling
input()
display()
- to display game arena
gameover()
- to check if game is over
gotoxy(int,int)
- to go to particular coordinate in console
screen
input()
- to input and move tetriminos
makepiece( )
- generates the type and position of the
tetrimino to be created
piecebuild()
- to create a tetrimino at the top by taking
input from makepiece() function
piecedesign(char) - fills block area in arena with a certain
character
rowclear()
- to clear completely filled rows and to
compute the score
block_at_bottom() - to check if the block has reached the
bottom of the arena or touched another
block

Code
The code for this program was written in C++ following the current
ISO C++ 11 standards. The IDE used was the MinGW version of
Dev C++ 5.7.1 GCC compiler.

Output

Limitations
Save file cannot be named temp_tetris_sav.dat
Game lags in lower spec systems
Not able to rotate tetriminos at the edge of the arena

Bibliography

Wikipedia (https://en.wikipedia.org/)
Stack Overflow (http://stackoverflow.com/)
http://www.cplusplus.com/
NCERT Class 12 Computer Textbook

You might also like