in desperate need of help!!!

so im utterly terrible at coding. and my summative is due tomorrow, i know there's a lot of people who enjoy coding, im just looking for any kind of help.
i need a game with this stuff in it, it doesn't need to be all. im just desperate at this point guys, please help me out!!!
String manipulation
2-d Arrays
Number manipulation
Functions
pass by reference
pass by variable
void function
Loops
Different variable use
Conditional Statements
if/case
Documentation
Post in the job section and dont forget to mention how much you are willing to pay.
Last edited on
I suggest "Hangman". You can find a number of tutorials online. Here is one written in C that your instructor is not likely to believe you wrote yourself:

http://www.eastcoastgames.com/cpp/chapter4.html

Use that as a reference, crank out a quick MVP and come back to us to fill in the holes.

EDIT: +1 TarikNeaj, this is a valid option.
Last edited on
A simple way to put them all together:

It's a game, the 2D array is probably a way to store the field map. Number manipulation, functions, loops and conditionals will be added automatically when you start programming. To implement string manipulation, you could probably use some way to let the user enter a name and convert it to uppercase for a result screen at the end. The documentation is up to you, you just add comments to your code (which is probably a good practice anyways).

It's always hard to program something with a strict deadline (and probably even more if you like waiting until the last moment). Anyhow, how about implementing a very simple snake game? Snake is not all that hard to program:

You use a 2-dimensional array of "states" to make field. States are very simple for snake, you just use a boolean. True means the snake is there, false means the snake is not there. An example:

1
2
bool field[FIELD_WIDTH][FIELD_HEIGHT] = {}; //Zero initialize array, 2D array used
field[0][0] = true; //Make the snake start at (0,0) 


Now for the ease of programming, you can use two integers, one for the x-position of the head, one for the y-position. You then move these along the field.

Now at the core, you check the control, adjust the x and y position of the head and move the snake along it using a given direction:

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
int x_head = 0; //These should match the coordinate given in the field
int y_head = 0;
int direction = DIRECTION_LEFT; //Make the snake start going left

...
//Later in the control loop
switch(control) //Control is the entered key
{
    case 'a':
        direction = DIRECTION_LEFT;
        break;
    case 'f':
         direction = DIRECTION_RIGHT;
         break;
    //etc.
}

if(direction == DIRECTION_LEFT)
    --xhead;
if(direction == DIRECTION_RIGHT)
    ++xhead;

if(xhead < 0) //In case we would go out of the field on the left
    xhead = FIELD_WIDTH - 1; //Wrap around
if(xhead >= FIELD_WIDTH) //The same, but for the right side
    xhead = 0; //Wrap around 


Next you check if the new head position is already taken by the sname, if so, game over:

1
2
3
4
5
if(field[xhead][yhead]) //If the value is true, the snake is there
{
    game_over(); //Call a function that writes a game over screen
    break; //Break out of the game loop (a while-loop going on until the end)
}


Last thing to do would be to draw a character to the position of the snake head, and erase the last character in the snake. To erase, simply overwrite a character with a space, which makes it disappear (saves you the work of clearing the screen). To write to a given x-y coordinate, you will have to use some platform-dependent console function (for Windows, try SetConsoleCursorPosition).

Of course this is just a global setup, and I already used most of the requirements (just write the game, the requirements will come by themselves).

Other games are possible too, but snake is a relatively easy game to write, you could also try pacman or tetris, but those have more advanced logic.
Topic archived. No new replies allowed.