Simple maze game


#include <iostream>
using namespace std;

int col = 1;
int row = 2;
const int ROWMAX = 11;
const int COLMAX = 16;

char maze[ROWMAX][COLMAX] =
{
{'B','B','B','B','B','B','B','B','B','B','B','B',' B','B','B','B'},
{'B','M',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','B'},
{'B','B','B','B','B','B','B','B','B','B',' ','B','B','B',' ','B'},
{'B','W',' ',' ',' ',' ',' ',' ',' ','B',' ','B',' ','B',' ','B'},
{'B','B','B','B','B','B','B','B',' ','B','B','B',' ','B',' ','B'},
{'B',' ',' ',' ',' ',' ',' ','B',' ',' ',' ',' ',' ','B',' ','B'},
{'B','B','B','B','B','B','B','B',' ','B','B','B','B','B',' ','B'},
{'B',' ',' ',' ','B',' ',' ',' ',' ','B',' ',' ',' ',' ',' ','B'},
{'B',' ',' ',' ',' ',' ',' ',' ','B','B','B','B',' ','B','B','B'},
{'B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','B'},
{'B','B','B','B','B','B','B','B','B','B','B','B',' B','B','B','B'}
};
void printMaze();
void runMaze(int, int);


void printMaze()
{
for(int row = 0; row < ROWMAX; row++)
{
for(int col=0; col < COLMAX; col++)
cout << maze[row][col];
cout << "\n";
}
}

void runMaze(int row, int col)
{
if( (row>0 && row<ROWMAX) && (col>0 && col<COLMAX)) {
if( maze[row][col] == 'W' ) return;

if( maze[row][col] == ' ') {
maze[row][col]='*';

runMaze(row, col+1);
runMaze(row, col-1);
runMaze(row-1, col);
runMaze(row+1, col);
}
}
}

int main()
{
cout << "Maze before solution:\n";
printMaze();
cout << "Maze after solution:\n";
runMaze(1, 2);
printMaze();
return 0;
}




I keep getting a multi character character constant error, im not sure what's wrong?
You have more then one character inside one of your ' 's.
What do you mean by this? I only see one B within the single quotes.
Last line of the array initialization:
{'B','B','B','B','B','B','B','B','B','B','B','B',' B','B','B','B'} ^
Topic archived. No new replies allowed.