Advertisement
Daniilsadaweq

Untitled

Dec 8th, 2022
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. bool deadEnd(int x, int y, int** main_maze, int height, int width){
  2.     int a = 0;
  3.  
  4.     if(x != 1){
  5.         if(main_maze[y][x-2] == pass||
  6.                 main_maze[y][x-2] == room)
  7.             a+=1;
  8.     }
  9.     else a+=1;
  10.  
  11.     if(y != 1){
  12.         if(main_maze[y-2][x] == pass||
  13.                 main_maze[y-2][x] == room)
  14.             a+=1;
  15.     }
  16.     else a+=1;
  17.  
  18.     if(x != width-2){
  19.         if(main_maze[y][x+2] == pass||
  20.                 main_maze[y][x+2] == room)
  21.             a+=1;
  22.     }
  23.     else a+=1;
  24.  
  25.     if(y != height-2){
  26.         if(main_maze[y+2][x] == pass||
  27.                 main_maze[y+2][x] == room)
  28.             a+=1;
  29.     }
  30.     else a+=1;
  31.  
  32.     if(a == 4)
  33.         return true;
  34.     else
  35.         return false;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement