Instructions

This will be a short project (like the square roots program) will be an extension of the last couple bonus questions and should review your knowledge of multidimensional arrays, file IO, and functions.

An example executable is available here for you to try out for yourself.

Write a simple game where the player, represented by a character, can input the characters w, a, s, or d to move around a grid to get to an objective, represented by another character, and can’t pass through other objects represented by another character.

Example board – P = player, W = wall, G = goal:

. . . . . . . . . .
. G . . . . . . . .
. . . . . . W . . .
. . . . . . . . . .
. . . . W . . . . .
. . . . . . W . . .
. . . . . . . . . P

Once you have got that part, try adding these features:

  • Inputting the user’s selection without them pressing enter (see bottom of this page)
  • Inputting the game board from a file
  • A menu system to select and play a file
  • Having multiple levels of board, and characters that represent stairs up and down
  • Multiple levels and a score
  • Randomly generated maps
  • A way to edit and save game boards

Functions you will most likely want to use but might not know:

  • system(“cls”);
  • Clears the console screen (on windows).
  • _getch();
  • Returns a character from the console input without waiting for the user to press enter. Included in the library <conio.h>
Toggle Answer