up,down,left and right


Make a program that outputs a simple grid based gameboard to the screen using either numbers or characters.
i.e.

. . . . . . . . . .
. G . . . . . . . .
. . . . . . T . . .
. . . . . . . . . .
. . . . T . . . . .
. . . . . . T . . .
. . . . . . . . . X



or

0 0 0 0 0 0 0 0 0 0
0 5 0 0 6 0 0 0 0 0
0 0 0 0 0 0 7 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 7 0 0 0 0 0 0
0 0 0 0 0 0 7 0 0 0
0 0 0 0 0 0 0 0 0 4


Allow the user (marked by G in the example) to move either up, down, left, or right each turn. If the player steps on a trap then they lose. If the make it to the treasure 'X' then they win.

How to write that if he entered the up button.......
does it have a number or a name?
You don't have to use the button marked with a little up arrow.
Why don't you give the user a menu with North, South, East, and West choices marked by N, S, E, W or even 1, 2, 3, 4?

What are the rules for the trap and treasure locations. Is it supposed to be random?
Last edited on
Topic archived. No new replies allowed.