I need help for my project

My teacher gave me a sample code and want me to add new codes, but I can't understand the sample code completely, I confused about the code, can someone explain me the codes? I added the codes on the dropbox, its link is posted below the text. Also, I added the text about what the codes provides and what the teacher expect from me. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
IE 201 - Intermediate Programming
Homework 3 
due April 29
th, 2014 
SHAPE ANIMATOR 
In this assignment, you will write a program that will print randomly moving squares and triangles on the screen, 
with random colors, random speed and random direction. The initial x coordinate and the area of each falling object 
are also expected to be random. 
The user will be able to change the speed of the program with keyboard inputs. The user should adjust the speed of 
the falling objects by pressing 1 (slow down) and 2 (speed up). 
While the random shapes are moving, there will be another shape (a two by two square with a color of your choice) 
controlled by the user, which can move in four directions and destroy other shapes. The buttons to press for 
movement in different directions are w for up, s for down, a for left and d for right. When this shape has at least one 
pixel intersecting with another shape, it will make the corresponding shape disappear from the screen if the user 
presses f. 
The sample program you have been given demonstrates how to write a specific character with specific colors on the 
screen at a specific coordinate. The code also tries to demonstrate how to get non-intrusive inputs from the keyboard. 
As you know, if you use cin to get input from the user, the program stops and waits until the user enters a value and 
hits the return key. However _kbhit() instantaneously checks if the user has hit any key on the keyboard up to that 
time. If not, returns false and continues; otherwise returns true. The pressed key can be retrieved as an ASCII 
character by using the _getch() function. 
YOUR TASK 
You will implement a C++ program that animates moving squares and triangles on the screen along with another one 
which is user controlled and can destroy other objects. You will use Console class in the sample program as a basis 
for your source code. Following guidelines should be followed in the implementation: 
 Size, direction and color of the falling objects must be set in the constructor and should not be changed in 
the object's lifetime. These attributes must be assigned randomly. Size should be between 
MAX_OBJECT_SIZE and MIN_OBJECT_SIZE. Direction will be one of the following: from left to right, 
from right to left, from top to bottom, and from bottom to top. Remember console is an 25 (x axis) by 80 (y 
axis) rectangle with (0, 0) being the top left corner. 
 A new object must be created when either an object is destroyed by the user or when an object exits the 
boundaries of the console. You must specify the number of objects on the screen by using #define 
directive. You can also use #define for other parameters that you introduce. 
#define OBJECT_COUNT 10 
 You must not use global functions and global data. 
 Be careful about memory leaks. Your program should run forever without problem. 
 You must use inheritance and polymorphism concepts in your program. Any other solution method will get 
0. 
 You will get 0, if you do not use Console class in the sample program given. 
 Each class must be defined in a separate .h file and each of them must be implemented in a separate .cpp 
file. 
 
 GRADING 
Your homework will be graded on correctness and design. Understandability is considered to be an important aspect 
of good design. An understandable program: 
 Uses a consistent and appropriate indentation scheme. All statements that are nested within acompound 
statement (if, switch, while, for, do...while) should be indented. 
 Uses descriptive identifiers. The names of variables, constants, structure, types, and functions should 
indicate their purpose. Remember C++ can handle identifiers of any length. 
 Contains carefully worded comments.  


https://drive.google.com/file/d/0B7tq7-5Y1zezNkdWdnVIMWtndXM/edit?usp=sharing
Topic archived. No new replies allowed.