Question: 3 . 2 Task 2 Write and compile a C + + program to construct and plot a 2 - D square grid of dimension

3.2 Task 2
Write and compile a C++ program to construct and plot a 2-D square grid of dimension NxM with NM and where N and M can vary from twenty to forty. Use a class to hold the grid data. The grid squares either hold the user's bounce pad symbol, the ball, the outline (or wall) characters, or is empty. The ball moves around the grid by bouncing off the walls. The player's goal is to keep the ball from touching the bottom wall which is protected by the (two characters wide) bounce pad that the user can move left and right via keystrokes. The player can move the bounce pad freely between the left and right walls just above the bottom wall. The ball can bounce off the bounce pad and each bounce off the pad is worth one point. The ball starts at a random initial position within the grid and moves with velocity (vx,vy)=(1,1) initially. The speed of the ball increases after each bounce off the bounce pad. The player's name and the current score or number of bounces off the bounce pad should be displayed at the top middle of the screen with the grid centered below it. The program should terminate if the ball reaches the bottom wall. An example of what a smaller 14x16, i.e.N=14,M=16, board might look like is shown below.
Player: Susan
a) Use extended characters for the outline of the grid.
b) Input player moves using keyboard keys without carriage return.
c) Code should have error checking for incorrect key entries.
d) Keep the grid and running score information in the same position in the console at each turn using cursor re-positioning characters.
e)[BONUS] Use different color characters for the wall, ball, and bounce pad.
 3.2 Task 2 Write and compile a C++ program to construct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!