Maze

How can you do some walls for the maze?
Like here in my code? can you put some walls so i can make it like a maze
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#include <iostream>
//#include <conio.h>
//#include <cctype>
//#include <string>
//#include <windows.h>
//#include <ctime>
//#include <fstream>
//#include <cstdlib>
//using namespace std;
//void cursor();
//void showboard();
//void intro2();
//bool checkmove (int move,int a,int b);
//void checkenemy();
//void display(char mych,int times);
//
//bool checkmove (int move,int a,int b);
//struct abry{
//char board[5][10];
//int lives;
//int score,moves;
//int ctr;
//bool win;
//string name;
//}ab;
//char move;
//int n[6]={rand()%5,rand()%5,rand()%10,rand()%10,rand()%5,rand()%10};
//int a=0,b=0;
//int main()
//{
//cout<<"Please enter your name before playing: ";
//cin>>ab.name;
//ofstream outfile("C:\\abry.txt",ios::app);
//ab.win=false;
//ab.lives=2;
//ab.score=0,ab.moves=-1;
//system("cls");
//ab.ctr=0;
//ab.score=0;
//srand ( time(NULL) );
//char move;
//int a=0,b=0;
//ab.win=false;
//for (int i=0;i<5;i++)
//{
//for (int j=0;j<10;j++)
//ab.board[i][j]='.';
//}
//
//intro2();
//
//ab.board[n[0]][n[2]]='T';
//ab.board[n[1]][n[3]]='T';
//ab.board[n[4]][n[5]]='T';
//
//ab.board[a][b]='M';
//ab.board[4][9]='F';
//
//
//showboard();
//while (ab.win!=true)
//{
//if (ab.lives==0)
//{
//cout<<"You newb, you lose.";
//break;
//}
//
//if (kbhit()){
//move=getch();
//move=tolower(move);
//if (checkmove(move,a,b)==true)
//continue;
//ab.ctr++;
//ab.score+=100;
//switch (move)
//{
//case 'w':
//ab.board[a][b]='.';
//a-=1;
//break;
//case 'a':
//ab.board[a][b]='.';
//b-=1;
//break;
//case 's':
//ab.board[a][b]='.';
//a+=1;
//break;
//case 'd':
//ab.board[a][b]='.';
//b+=1;
//break;
//default:
//	ab.ctr--;
//	ab.score-=100;
//        cout<<"Invalid move";
//        continue;
//}
//}
//system("cls");
//if (ab.board[a][b]=='F')
//{
//ab.win=true;
//ab.score+=250;
//}
//else if (ab.board[a][b]=='T')
//{
//if ((n[0]==a && n[2]==b))
//{
//n[0]=rand()%5;
//n[2]=rand()%10;
//ab.board[a][b]='.';
//}
//else if (n[1]==a && n[3]==b)
//{
//    n[1]=rand()%5;
//    n[3]=rand()%10;
//ab.board[a][b]='.';
//}
//else
//{
//n[4]=rand()%5;
//n[5]=rand()%10;
//ab.board[a][b]='.';
//}
//ab.score-=25;
//a=0;
//b=0;
//ab.lives-=1;
//}
//
//ab.board[n[0]][n[2]]='.';
//ab.board[n[1]][n[3]]='.';
//ab.board[n[4]][n[5]]='.';
//for (int i=0;i<6;i++)
//{
//if (rand()%2)
//n[i]=n[i]+rand()%2;
//else
//n[i]=n[i]-rand()%2;
//}
//checkenemy();
//ab.board[n[0]][n[2]]='T';
//ab.board[n[1]][n[3]]='T';
//ab.board[n[4]][n[5]]='T';
//ab.board[a][b]='M';
//showboard();
//_sleep(500);
//}
//if (ab.win==true)
//cout<<"Congratulations!";
//if (ab.win==true || ab.lives==0)
//outfile<<ab.name<<" has won MarlonMan with the score of "<<ab.score<<" and with the minimum moves of "<<ab.moves<<".\n";
//outfile.close();
//system("pause>0");
//return 0;
//}
//
//void showboard()
//{
//ab.board[4][9]='F';
//ab.moves++;
//cout<<"\t\t\t      MarlonEatingMan 1.04\n";
//cout<<"Legend:\nM = MarlonMan\tT = Traps\tF = Food";
//cout<<endl<<endl<<"\t\t\tScore: "<<ab.score<<"\t\t\t Moves: "<<ab.ctr<<endl;
//display('_',80);
//cout<<endl<<"\t\t\tab.lives left : ";
//for (int i=1;i<=ab.lives;i++)
//cout<<"<3 ";
//cout<<endl<<endl;
//for (int i=0;i<5;i++)
//{
//cout<<"\t\t\t";
//for (int j=0;j<10;j++)
//cout<<ab.board[i][j]<<"  ";
//cout<<endl;
//}
//cout<<"\n\t\t\t     Use WASD for movements"<<endl;
//}
//
//bool checkmove(int move,int a,int b)
//{
//bool invalid;
//if ((move=='w')&&(a==0))
//{
//cout<<endl<<"\t\t\t";                        
//cout<<"Invalid move";
//invalid=true;
//}
//else if ((move=='a')&&(b==0))
//{
//     cout<<endl<<"\t\t\t";
//cout<<"Invalid move";
//invalid=true;
//}
//else if ((move=='s')&&(a==4))
//{
//     cout<<endl<<"\t\t\t";
//cout<<"Invalid move";
//invalid=true;
//}
//else if ((move=='d')&&(b==9))
//{
//     cout<<endl<<"\t\t\t";
//cout<<"Invalid move";
//invalid=true;
//}
//else
//invalid=false;
//
//return invalid;
//}
//void checkenemy()
//{
//for (int i=0;i<2;i++)
//{
//if (n[i]==-1)
//n[i]++;
//else if (n[i]==5)
//n[i]--;
//else if (ab.board[n[0]][n[2]]=='F')
//n[0]--;
//else if (ab.board[n[1]][n[3]]=='F')
//n[1]--;
//else if (ab.board[n[4]][n[5]]=='F')
//n[4]--;
//else if (ab.board[n[0]][n[2]]=='T')
//n[0]--;
//else if (ab.board[n[1]][n[3]]=='T')
//n[1]--;
//else if (ab.board[n[4]][n[5]]=='T')
//n[4]--;
//else if (ab.board[n[0]][n[2]]=='M')
//n[0]++;
//else if (ab.board[n[1]][n[3]]=='M')
//n[1]++;
//else if (ab.board[n[4]][n[5]]=='M')
//n[4]++;
//}
//
//for (int i=3;i<5;i++)
//{
//if (n[i]==-1)
//n[i]++;
//else if (n[i]==11)
//n[i]--;
//}
//
//
//if (n[4]==-1)
//n[4]++;
//else if (n[4]==5)
//n[4]--;
//if (n[5]==11)
//n[5]--;
//else if (n[5]==-1)
//n[5]++;
//}
//
//
//
//void intro2()
//{
//int s=16;
//cout<<endl<<endl;
//for (int j=0;j<240;j++)
//{
//SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), s++);
//cout<<' ';
//}
//SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 81);
//cout<<"    _______ _______  ______         _____  __   _      ______ _______ __   _    "
//    <<"    |  |  | |_____| |_____/ |      |     | | \\  |      |  |  ||_____| | \\  |   "
//    <<"     |  |  | |     | |    \\  |_____ |_____| |  \\_|      |  |  ||     | |  \\_|    ";
//for (int j=0,s=16;j<240;j++)
//{
//SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), s++);
//cout<<' ';
//}
//SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
//cout<<"\n\t\t\t   PRESS ANY KEY TO START GAME";
//system("pause>0");
//system("cls");
//} 
//
//void cursor()
//{
//     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//CONSOLE_CURSOR_INFO CursoInfo;
//CursoInfo.dwSize = 1; 
//CursoInfo.bVisible = false;
//SetConsoleCursorInfo(hConsole, &CursoInfo);
//}
//void display(char mych,int times) // function for display layout
//{
//for (int i=0;i<times;i++)
//cout<<mych;
//} 
First off, I have to ask. Why do you always comment out your code? If it wasn't commented out, it would have syntax highlighting, making it easier to read!

And if you look at the post in reply I made, to your topic the other day:
http://www.cplusplus.com/forum/beginner/92515/#msg497227

If you cout << ( char ) 219;, you can use this character to print the walls etc.

I've made a maze game in the console before:
http://s749.photobucket.com/albums/xx132/Bigdave876/Cpp/?action=view&current=maze_zpsdc2590b2.png
Last edited on
That's some pretty awesome stuff Lynx

@progga, Also once you've removed commenting, the script should ideally have correct spacing (i.e. Add spacing please)
lol, thanks. I'll put the code on my website( link in profile ) later, in case you want it.

I never actually finished the maze creator though. Use the keyboard to create a maze within the console.
Could you do this project for me, Just ONCE Please. i really need it because our professor didn't teach this to us. he thought that all of he's student can do this. my classmate made this he's so advanced into this. and i'm just a first year student and he didn't teach us the basic. PLEASE :)
ahaha, no, no, no. I don't do people's work for them! You'll learn nothing at all from it. Then when you come to use the same techniques again, you'll have no choice but to come back here for help.

What's the point in that?!
no no no no, i will just need some tips in the future. because my professor didn't teach us this piece of shit. he thought that all of his students are all the same. this is the one of my classmates work and i don't know how did he did it . i don't know the basics so i need some professional help here. my professor expects to much from us.
I went to university and studied C++ for a while, my professor's answer to "I'm stuck with this..." was usually, "I don't know, look it up on Google...".

I'm guessing he wanted us to be as good as he thought he was. Which was nothing... ahaha

I'll more than gladly help you. I just wont give you the answers. Be more specific as to what you need help with.
Some tips for the future = maybe paste more than just a single line of code,
#include <iostream>

Anything which is commented out is done for a reason, maybe because it is not working, obsolete, etc and is ignored, not just by the compiler, but by the human reader too.
Topic archived. No new replies allowed.