示例#1
0
 // Checks to see if the board is still playable
 // should be called after render
 public bool playable()
 {
     for (int row = 1; row < 9; row++)
     {
         for (int element = 1; element < 9; element++)
         {
             Tile tile = rows[row][element];
             if (tile.isAnEmpty())
             {
                 EmptySpace empty = (EmptySpace)tile;
                 if (empty.isMarked())
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#2
0
 public void place(int x, int y)
 {
     if (getXY(x, y).isAnEmpty())
     {
         EmptySpace empty = (EmptySpace)rows[y][x];
         if (empty.isMarked())
         {
             empty.flipPieces();
             rows[y][x] = new Piece(x, y, this, currentTurn.clone());
             currentTurn.flip();
         }
         else
         {
             // Raise error
             throw new BadInput();
         }
     }
     else
     {
         // Raise error
         throw new BadInput();
     }
 }