Find out the data that you will have in the program

Assignment Help C/C++ Programming
Reference no: EM131369800

ASSIGNMENT

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);

....

....

....

}

}

This is just an example. You need to come up with your own game loop and dummy functions.

The aim is to see that you have the game loop under control. Work on it until it runs well through the correct sequence of events.

Reference no: EM131369800

Questions Cloud

Training development and performance management-appraisals : Training development and performance management & appraisals. We will review the vast importance of impactful training and development of an organization's existing employee network. As organizations face more and more competition and change, trainin..
What is the difference between the two versions of the game : Conceptually, what is the difference between the two versions of the game? Is there any practical difference between the two versions as far as a player is concerned?
Capacity requirements planning includes planning : Capacity requirements planning includes planning the following resources:
Issuing respiratory protection : Employers are required to put engineering and administrative controls in place before issuing respiratory protection. Should this hierarchy of controls be required, or should employers be able to skip controls and go straight to respirators? Why is i..
Find out the data that you will have in the program : Find out the data 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.
How many possibilities are there in order of selection : An oil company can only afford to drill at eight sites, sequentially chosen. How many possibilities are there, in order of selection?
A deculturation strategy of merging two corporate cultures : A deculturation strategy of merging two corporate cultures should be applied:
Demand considerations for over-the-road transportation : Conduct research that will enable you to compare and contrast supply and demand considerations for over-the-road transportation. Summarize your thoughts in a MS Word (or similar application) document. Your answer should be at least 500 words in lengt..
How many possible ordered choices of 3 out of 6 candidates : A committee is evaluating six equally qualified candidates for a job.- How many possible ordered choices of three out of six candidates are there?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Putting objects within objects is the essence of composition

Putting objects within objects is the essence of composition. It is called composition for obvious reasons. As we always say that if something is made from other things that it is composed from those things.

  Gcd between two positive integer numbers

Write a C++ code for calculating the GCD (Greatest Common Divisor) between two positive integer numbers. You  should  use Euclid's  original  subtraction  based  GCD algorithm ( not  using  modulo operator). You should write a function following t..

  Write a function named xytopolar

Write a function named "XYtoPolar" that has 2 double value parameters and 2 double reference parameters that converts x,y coordinates to polar coordinates. The prototype is: void XYtoPolar(double x, double y, double* angle, double* radius);

  Provide a makefile to compile your code

You are to implement a Virtual Memory Manager in C or C++ and submit the source code, which we will compile and run. Please provide a Makefile to compile your code and submit as a single tar, tar.Z, tar.bz2, zip file through NYU classes

  Write a program that will read in number of 2 point basket

Write a program that will read in the number of 2 point baskets and the number of 3 point baskets a player makes.  Print the number of each baskets and the total number of points scored.

  Write a program that creates a picture of a mountain

Write a program that creates a picture of a mountain panorama from a height profile entered by the user -  The height profile shall be stored in a one-dimensional array of integers. The array indices correspond to the columns of the picture. The va..

  Define program testing & documentation

Devise a test plan carefully, making sure that the purpose of the particular test is clearly stated, the data for each test is specified (that is, any inputs expected from the user or the programmer), and a description of the expected result from ..

  Write a main function that reads pairs of positive integers

Prepare a function that has two positive integer parameters (say high and low) that returns the number of powers of two between (but not equal to) those parameters.

  Determine the reynolds number of flow in a rectangular

determine the reynolds number of flow in a rectangular channel 2m deep and 4m wide if the water level is 60 and running

  Explain the tree traversals in all orders

If the node 30 is deleted, the erase algorithm selects which node as the replacement node?

  Ansi-c program which allows the user to play a game

Your task is to write an ANSI-C program which allows the user to play a game. This will require I/O from both the user and from ?les.

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd