Beispiel #1
0
 private static void CheckMoveIsntToSameSpace(IPlayedTile playedTile, Coordinate coordinate)
 {
     if (playedTile.Coordinate.X == coordinate.X && playedTile.Coordinate.Y == coordinate.Y)
     {
         throw new MoveTileToSameSpaceException();
     }
 }
Beispiel #2
0
        public void MoveTile(Player player, IPlayedTile playedTile, Coordinate newCoordinate)
        {
            CheckGameNotFinished();
            CheckRightPlayersTurn(playedTile.PlayerPlayOrder);
            CheckNoTilesLeft(player);
            CheckMoveIsntToSameSpace(playedTile, newCoordinate);
            CheckSpaceIsntOccupied(newCoordinate);
            CheckLegalPlacement(newCoordinate);

            // Move is legal
            playedTile.MoveCoordinate(newCoordinate);

            ResetMinMax();
            IncrementPlayer();
        }
 public (int WinnerPlayOrder, IEnumerable <Coordinate> WinningTileCoordinates)? CheckForWinner(GameState gameState, IPlayedTile justPlayedTile)
 {
     var directions = new (Func <Coordinate, Coordinate> NextCoordinate, Func <Coordinate, Coordinate> PreviousCoordinate)[]