예제 #1
0
 public void init(Grid owner)
 {
     // Gamefield
     _gameField.populate();
     owner.Children.Add(_gameField);
     // Header
     _header.populate();
     _header.setMinesCountText(Convert.ToString(_gameField.maxBombs()));
     owner.Children.Add(_header);
 }
예제 #2
0
        // Checks the game state
        private gameState checkGameState()
        {
            int tileCount     = _owner.rows() * _owner.cols();
            int revealedTiles = 0;

            foreach (Tile tile in _owner.tiles())
            {
                if (tile.isRevealed() && !tile.isBomb())
                {
                    revealedTiles++;
                }
            }
            if (revealedTiles == tileCount - _owner.maxBombs())
            {
                return(gameState.Won);
            }
            else
            {
                return(gameState.Continue);
            }
        }