**I am working on a game that is a maze type thing. I am trying to get the lines i draw in the grid to be randomly generated. But I think that there is one little thing I am doing wrong because I dont know enough about randomly generated numbers and characters with the puesdo thing.**
Here is my code:
**Everytime I run it, it just outputs a full gray block which is that it is supposed to do for the void fillmaze and then displays the maze which is the void displaymaze function. Then when it gets to the void drawmaze1 function it doesnt do anything and usely gives me a "Winsioux c++ gui debug has caused an error in KERNEL32.DLL" error.
**Any ideas what Im doing wrong?? PLEASE reply**
Here is my code:
Code:
int main()
{
char maze1[23][35];
char fil=219;
int r=0;
int c=0;
filmazes(maze1, fil);
display_themaze1(maze1);
drawmaze1(maze1);
return 0;
}
void drawmaze1(char maze1[23][35])
{
srand((signed)time(0));
for(int loopcount=0; loopcount!=10; loopcount++)
{
srand(rand());
int random = (rand() % 20+1);
int rowrandom = (rand() % 22+1);
int colrandom = (rand() % 34+1);
int r=0;
while(r<=random)
{
maze1[rowrandom+r][colrandom]=' ';
r++;
}
}
for(int loopcount=0; loopcount!=10; loopcount++)
{
srand(rand());
int random = (rand() % 20+1);
int rowrandom = (rand() % 22+1);
int colrandom = (rand() % 34+1);
int c=0;
while(c<=random)
{
maze1[rowrandom][colrandom-c]=' ';
c++;
}
}
}
void display_themaze1(char maze1[23][35])
{
for(int r=0;r<=22;r++)
{
for(int c=0;c<=34;c++)
{
cout << maze1[r][c];
}
cout <<endl;
}
}
void filmazes(char maze1[23][35], char fil)
{
for(int r=0;r<=22;r++)
{
for(int c=0;c<=34;c++)
{
maze1[r][c]=fil;
}
}
}
**Everytime I run it, it just outputs a full gray block which is that it is supposed to do for the void fillmaze and then displays the maze which is the void displaymaze function. Then when it gets to the void drawmaze1 function it doesnt do anything and usely gives me a "Winsioux c++ gui debug has caused an error in KERNEL32.DLL" error.
**Any ideas what Im doing wrong?? PLEASE reply**