public void TestInit() { var positionFinder = new PositionFinder(_boardSize); _surroundingTileFinder = new SurroundingTileFinder(_boardSize, positionFinder); var board = new Board(_boardSize, positionFinder, _surroundingTileFinder); _tiles = board.Tiles(); }
private static void Main(string[] args) { var positionFinder = new PositionFinder(_boardSize); var surroundingTileFinder = new SurroundingTileFinder(_boardSize, positionFinder); _gameEngine = new Game(new Board(_boardSize, positionFinder, surroundingTileFinder)); _inputMapper = new KeyboardInputMapper(); while (_gameEngine.Board.AvailableMoves().Count > 0) { DrawBoard(_gameEngine.Board); ProcessInput(); } DrawBoard(_gameEngine.Board); System.Console.WriteLine("\n\nGame Over. Score: " + _gameEngine.Score() + ". Press Enter to continue."); System.Console.ReadLine(); }
public BoardTestDouble(int boardSize, PositionFinder positionFinder, SurroundingTileFinder tileFinder) : base(boardSize, positionFinder, tileFinder) { }
public void Score() { var expectedScore = 0; PositionedTile bottomLetTile = _board.Tiles()[0]; _board.SetCurrentTile(bottomLetTile); _game.Chomp(Directions.NorthEast); PositionedTile surroundingTile = _game.Board.Tiles()[_boardSize + 1]; expectedScore += surroundingTile.Number; Assert.AreEqual(expectedScore , _game.Score()); var surroundingTileFinder = new SurroundingTileFinder(_boardSize, _positionFinder); surroundingTile = surroundingTileFinder.GetTile(surroundingTileFinder.GetSurroundingPosition(_game.Board.CurrentTile.Position, Directions.East), _game.Board.Tiles()); expectedScore += surroundingTile.Number; _game.Chomp(Directions.East); Assert.AreEqual(expectedScore, _game.Score()); }