Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Please add comments in your code so I understand what you have done, thank you!

A good first step when creating a computer program is to start the detailed design process using pen and paper. With this in mind, write out the following:

List all the steps in Tetris.

Find out the data (e.g. a bucket, etc.) that you will have in the program.

Find out what are the data structures you need to use to store those data.

Find out the actions that your program needs for the game. All the actions will be functions.

Come up with the sequence how you would call functions from the main function, inside the game loop, and from inside other functions.

Remember, you will do all of this with a pen and a paper before you write any code on the computer.

Now take your hand-written detailed design and create your C++ program. In the program, you will have:

All the data structures (e.g., bucket, shape array, etc.) declared

The function declarations and empty body implementations

The functions being called in the "main" function and from any other functions

Refer to your hand-written notes and include them as comments in your program. Describe your program with tons of comments, especially for all the function implementations for the game loop.

Put a display in your functions that would say which function it is in, e.g., "In moveShape." To slow down the program, you can slow it down with "sleep".

Remember, you are using blank or empty calling functions, as in:

/* Add comments at the top of the program describing what this program is about. You can provide example input and output of program if applicable.*/

// Gets the input from the user.
bool getUserInput() {
cout << "In getUserInput function" << endl;
sleep(500);
}

// Finds the key is pressed.
// Then, calls the appropriate function to move the shape
void moveShape (char input) {

cout << "In moveShape function" << endl;
sleep(500);

// You might have a switch case or something to find which key is pressed.

//Then, in each case call the appropriate function, like below.
moveShapeLeft();

}

/* The main function where all the actions start. */
int main(){

while(!gameOver) {
//(1) Gets the user input.
key = getUserInput();

//(2) Displays the bucket.

//(3) Moves the shape
moveShape(key);
....
....
....
}
}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93081348

Have any Question?


Related Questions in Computer Engineering

If there are 30 students total and 13 of them have blue

If there are 30 students total and 13 of them have blue socks and 17 have red socks. Randomly select a student from the class list. What is the probability of the student having red socks?

If unemployment rate is 55 and underemployed unemployed and

If unemployment rate is 5.5% and underemployed, unemployed and discouraged workers is 8.4%. What is % of underemployed and discouraged. Is it as easy as just 8.4-5.5?

Wat type of malware do you think is the most destructive

What type of malware do you think is the most destructive : viruses, worms, trojan programs, spyware or adware.

You are evaluating two different silicon wafer milling

You are evaluating two different silicon wafer milling machines. The Techron I costs $255,000, has a three-year life, and has pretax operating costs of $68,000 per year. The Techron II costs $445,000, has a five-year lif ...

In linux what synchronization methods they use within the

In Linux what synchronization methods they use within the kernel, please dig into your findings for Linux.

Sorted array insertiona implement the fastest possible

Sorted Array Insertion a) Implement the fastest possible algorithm to insert a new entry into a sorted (in ascending order) array of strings. Duplicates are NOT allowed - throw an IllegalArgumentException if a duplicate ...

A single precision ieee 754 number is stored in memory at

A single precision IEEE 754 number is stored in memory at address X. Write a sequence of ARM instructions to multiply the number at X by 16 and store the result back at X. You must accomplish this without using any float ...

Question as we have seen traditional and agile schedule

Question : As we have seen, traditional and Agile schedule developments are quite different. Agile project management was originally developed to do software development. Could a traditional process be successfully used ...

What are some analysis and crime investigative methods that

What are some analysis and crime investigative methods that could be used in identifying gangs and/or gang activities?

Hayley motorcycle company just paid a dividend of 14 today

Hayley Motorcycle Company just paid a dividend of $1.4 today, and is expected to pay a dividend in year 1 of $1.8, a dividend in year 2 of $2.3, a dividend in year 3 of $2.9, and a dividend in year 4 of $3.8. After year ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As