Challenge for beginners/Feedback please

Gday all,

I have come up with a basic program as part of a challenge to myself to get a good grasp on how to employ aspects of C++. I would appreciate feedback on my solution to the problem I outline below. Also; I think this is a good practice problem for people around my level starting out.

Challenge:
ASCII Maze game - a 10x10 maze using * as wall symbol and + as the character symbol (defined within the code). Goal - move the character to the exit (marked as 'e')

Requirements -
V1: Basic program that can take an array defined within the code (maze[10][10]) and print it to the screen with a set starting point. Accept input (w/a/s/d) to move character around, not letting character move through walls. Finish when character arrives at the 'e'.

I think this is a good challenge for people starting out after completing tutorials. It requires (challenges you to apply) the following:
2D array handling (copying, checking arrays for data, replacing data, + other?)
getch() input (optional)
if/for control statements
methods


Subsequent challenges:
V1.1 - Starting point not set - marked by 's' in the array initially - a method within code to find this position, replace with '+' and get the starting location within the array

V1.2 - Ability for multiple mazes stored, loading the applicable one as a choice (eg. user gets a choice of maze 1, 2 or 3) and ability to repeat once finished

V2 - Doors within the maze - 'a' through 'd' able to be opened by moving over a switch ('1' through '4' respectively) - Can disappear when you go over them

V3 - Time based walls - go down (disappear) after 5 moves, reappear after another 5 (Possible hint - I used # for wall up, ` for wall down; allows you to easily keep track of door locations)- Can disappear when you go over them

V4 - Progression/'campaign' mode - An option at the start to do all mazes in order -when they finish one, they move onto the next one

V5 - 'wall destroyer' symbol; Whenever the character moves over '!' they turn from + into - and are able to go through ONE wall. Once one wall has been destroyed, turn back into + and unable to go through more walls. (NB - Maze design here requires careful consideration so the player cannot go outside the maze area)



If anyone is interested in ideas on how to implement this, I am happy to share what I have, otherwise I am very keen to get some more experienced people's feedback on my code for the above!

Cheers,

M
I think I'll have a go at this! I've read about maze generation on wiki a few times and have been wanting to try it. May be a few days before I post any code though, I just had a baby! :D

I think though, in V2.1, the ability to repeat should be in V1.1. I know it's nit picking, but setting up a loop to repeat would be the first thing to do, before coding more.

Especially for begginers. As some begginers put the loops in the wrong places. And creating a loop could be a problem with more code than need be.
Glad you like the concept! I found it was a great challenge initially and the subsequent versions (which is what I wanted to get to) were good building blocks.

The V1.X stuff can all be done together - that is what I had at the end of V1 but I thought I should put it in smaller chunks! Agreed though; although there will be several loops through the program so there should be sufficient practice!


Of note - I am not referring to random generation, as an example; my current 3 mazes:

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
27
28
29
30
31
32
string maze1[10][10] = {{"*", "*", "*", "*", "*", "*", "*", "*", "*", "*"},
                      {"*","s"," "," "," ","*"," "," "," ","e"},
                      {"*","*","*","*"," ","*"," ","*","*","*"},
                      {"*"," "," "," "," ","*"," "," "," ","*"},
                      {"*"," ","*","*","*","*","*","*"," ","*"},
                      {"*"," "," ","*"," "," "," ","*"," ","*"},
                      {"*","*"," ","*"," ","*"," "," "," ","*"},
                      {"*","1"," ","*"," ","*","*","*","*","*"},
                      {"*","*"," ","a"," "," "," "," "," ","*"},
                      {"*", "*", "*", "*", "*", "*", "*", "*", "*", "*"}};
                      
string maze2[10][10] = {{"*","*","*","*","*","*","*","*","*","*"},
                      {"*"," "," "," "," "," "," "," "," ","e"},
                      {"*"," ","*","*","*","*","*","*","*","*"},
                      {"*"," ","*","2"," ","*","1","#"," ","*"},
                      {"*","b","*","*","a","*","*","*"," ","*"},
                      {"*"," "," ","*"," "," "," ","*"," ","*"},
                      {"*","*"," ","*"," ","*"," ","c"," ","*"},
                      {"*","3"," ","*"," ","*","*","*","*","*"},
                      {"*","*"," "," "," "," "," ","s"," ","*"},
                      {"*","*","*","*","*","*","*","*","*","*"}};
                      
string maze3[10][10] = {{"*","*","*","*","*","e","*","*","*","*"},
                      {"*","*","*","*","*","c","*","*","*","*"},
                      {"*","*","*","*","2","#","*"," ","*","*"},
                      {"*","*","!","*","#","#","*"," ","*","*"},
                      {"*","*","a","*"," "," ","*"," ","*","*"},
                      {"*","*"," ","*"," "," ","b"," ","*","*"},
                      {"*","*"," ","*"," ","s","*","1","*","*"},
                      {"*","*"," "," "," ","*","3","*","*","*"},
                      {"*","*","*","*","*","*","*","*","*","*"},
                      {"*","*","*","*","*","*","*","*","*","*"}};


Future plans (ie. maybe V100 or so...) is maybe reading mazes from a text doc (lines of string converted to 2d array) rather than having them all stored in code!

Let me know if you want me to put mine up or go through my solution for movement/collision detection etc!
And congratulations on the billy lid!!! (kid)
ahaha thanks!

And I'm not too bad with my movement/collision detection. Take a look at my "robots" program:
http://sites.google.com/site/davevisone/home/cplusplus-programming-download
ok you are miles above what I am looking at! haha although you could probably take it to the next level!
Ill PM you my code so you can see what I am getting at!
Topic archived. No new replies allowed.