Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. void MinesweeperBoard::revealField(int x, int y)
  2. {
  3.  
  4.     if(x>=0 || x<=width)
  5.     {
  6.         if(y>=0 || y<=height)
  7.         {
  8.             if(board[y][x].isRevealed==false)
  9.             {
  10.                 if(getGameState()!=FINISHED_LOSS && getGameState()!=FINISHED_WIN)
  11.                 {
  12.                     if(board[y][x].hasFlag==false)
  13.                     {
  14.                         if(board[y][x].hasMine==false)
  15.                         {
  16.                             board[y][x].isRevealed=true;
  17.                             return;
  18.                         }
  19.                         if(board[y][x].hasMine==true && player_moves==0 && mode!= DEBUG)
  20.                         {
  21.                             board[std::rand()%height][std::rand()%width].hasMine=true;
  22.                             board[y][x].isRevealed=true;
  23.                             return;
  24.                         }
  25.                         if(board[y][x].hasMine==true)
  26.                             state=FINISHED_LOSS;
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement