Hello Everyone,

Just started my intro to C++ class and was given a code to complete to help prepare me for further classes.

What I need to do it create a grid using arrays like this (which I completed):

000
010
000

and then somehow move the "1" to other parts of the grid.

Any tips/suggestions/links to tutorials is appreciated and thanks for helping out.

So you'll obvs. have your array "Board[3][3]". And values will be "0" or "1".
You want a loop that will reprint the game board. Use 'system("cls");' on Windows to clear the console. Then reprint the board.
Each loop, the user should be asked to press a key ("W", "A", "S" or "D"). If they put in another key, don't do anything, but don't report it either. Have a variable which stores the location of the "1". Obvs., if the player presses "W", take one off the "y" value of the coord.
Have a loop that goes through your array. If it hits "1" print "1", else print "0" (or vice versa). Don't forget that when you move, change the current position to "0", THEN change the next position (the one you are moving to) to "1".

Hope this helps :) If so, please upvote. Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.