Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- int SIZE = 10;
- char mur1[]=" __";
- char mur2[]="| ";
- char mur_des[]= " ";
- //labyrinthe générateur
- void maze_g(char m[2*SIZE+1][3*SIZE+1]){
- int j,i,row=0;
- for(i=0;i<= 2*SIZE;i++){
- for(j=0;j < SIZE * 3+1;j+=3){
- if((i%2) == 0){
- m[i][j]=' ';
- m[i][j+1]='_';
- m[i][j+2]='_';
- }else{
- m[i][j]='|';
- m[i][j+1]=' ';
- m[i][j+2]=' ';
- }
- }
- }
- row = rand() %(3*SIZE+1)+1;
- printf("row = %d\n",row);
- m[row][0] = '>';
- row = rand() % (2*SIZE+1) +1;
- printf("row = %d\n",row);
- m[row][3*SIZE] = '>';
- }
- //maze printer
- void maze_p(char m[2*SIZE+1][SIZE * 3+1]){
- int i=0,j;
- maze_g(m);
- for(i=0;i <= 2*SIZE; i++){
- printf("\n");
- for(j=0;j<SIZE*3+1;j++){
- printf("%c",m[i][j]);
- }
- }
- }
- int main(){
- char maze[2*SIZE+1][SIZE*3+1];
- maze_p(maze);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement