Beispiel #1
0
 public TileFactory(GameSettings gameSettings, TileCallbacks tileCallbacks, Board board)
 {
     _tileCallbacks = tileCallbacks;
     _board         = board;
     _tileSize      = 500 / Math.Max(gameSettings.Columns, gameSettings.Rows);
     _startPosition = gameSettings.Rows > gameSettings.Columns
         ? new Point(((gameSettings.Rows - gameSettings.Columns) * _tileSize) / 2, 0)
         : new Point(0, ((gameSettings.Columns - gameSettings.Rows) * _tileSize) / 2);
 }
Beispiel #2
0
        public Game(GameBox gameBox, GameSettings gameSettings)
        {
            _gameBox      = gameBox;
            _gameSettings = gameSettings;

            _gameTimer = new Timer {
                Interval = 1000
            };
            _gameTimer.Tick += UpdateTimerDisplay;

            var tileCallbacks = new TileCallbacks(TileFlaggedCallback, TileFlippedCallback, Loose);

            _board  = new Board(gameSettings, tileCallbacks);
            _solver = new Solver(new SolvingContext(), _board);

            _secondsElapsed = 0;
            _flaggedCount   = 0;
            _flippedCount   = 0;
            _state          = GameState.NotStarted;
        }
Beispiel #3
0
 public Board(GameSettings gameSettings, TileCallbacks tileCallbacks)
 {
     GameSettings = gameSettings;
     _board       = new ITile[gameSettings.Columns, gameSettings.Rows];
     _tileFactory = new TileFactory(gameSettings, tileCallbacks, this);
 }