コード例 #1
0
        public IBoard ProblemFiveBoard(IPlayerPair players)
        {
            string completeBoard = "R,0,0/Q,3,0/K,4,0/R,7,0/" + "P,0,1/P,1,1/P,2,1/P,5,1/P,6,1/"
                                   + "N,2,2/P,3,2/" + "B,2,3/P,4,3/" + "b,2,4/n,3,4/p,4,4/N,6,4/" + "n,2,5/"
                                   + "p,0,6/p,1,6/p,2,6/p,5,6/p,6,6/" + "r,0,7/b,2,7/q,3,7/r,5,7/k,6,7";

            return(this.FromStringToBoard(players, completeBoard, CLASSIC_BOARD_COLUMNS, CLASSIC_BOARD_ROWS));
        }
コード例 #2
0
 public IBoard ClassicBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players,
                                   "R,0,0/N,1,0/B,2,0/Q,3,0/K,4,0/B,5,0/N,6,0/R,7,0/P,0,1/P,1,1/P,2,1/P,3,1/"
                                   + "P,4,1/P,5,1/P,6,1/P,7,1/r,0,7/n,1,7/b,2,7/q,3,7/k,4,7/b,5,7/"
                                   + "n,6,7/r,7,7/p,0,6/p,1,6/p,2,6/p,3,6/p,4,6/p,5,6/p,6,6/p,7,6",
                                   CLASSIC_BOARD_COLUMNS, CLASSIC_BOARD_ROWS));
 }
コード例 #3
0
        public void SetUp()
        {
            this._players = new PlayerPair(new Player(new User("Alessandro"), PlayerColor.WHITE),
                                           new Player(new User("Tommaso"), PlayerColor.BLACK));

            this._gameController = new ClassicGameController(this._startingBoardFactory.ClassicBoard(this._players),
                                                             this._pieceMovementStrategies, this._players);
            this._movementManager = new ClassicMovementManager(this._gameController);
        }
コード例 #4
0
        private IGame AllClassicApartFromMovementStrategy(IPlayerPair players,
                                                          IPieceMovementStrategies pieceMovementStrategy, GameType type)
        {
            IGameController gameController = new ClassicGameController(this._startingBoardFactory.ClassicBoard(players),
                                                                       pieceMovementStrategy, players);

            return(IGame.Builder().GameType(type).GameController(gameController)
                   .MovementManager(new ClassicMovementManager(gameController)).Build());
        }
コード例 #5
0
        private static IGame AllClassicDifferentBoard(IPlayerPair players, IBoard startingBoard,
                                                      GameType type)
        {
            IGameController gameController = new ClassicGameController(startingBoard,
                                                                       new ClassicNoCastlingPieceMovementStrategies(), players);

            return(IGame.Builder().GameType(type).GameController(gameController)
                   .MovementManager(new ClassicMovementManager(gameController)).Build());
        }
コード例 #6
0
        private IBoard FromStringToBoard(IPlayerPair players, string board, int columns, int rows)
        {
            IBoardBuilder boardBuilder = new BoardBuilder();

            var pieces = board.Split("/");

            foreach (string pieceId in pieces)
            {
                var splitted = pieceId.Split(",");

                string pieceName = splitted[0];
                int    xPos      = int.Parse(splitted[1]);
                int    yPos      = int.Parse(splitted[2]);

                boardBuilder.AddPiece(this.GetPieceFromComponents(players, pieceName, xPos, yPos));
            }

            return(boardBuilder.Columns(columns).Rows(rows).Build());
        }
コード例 #7
0
 public IBoard ProblemFourBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players,
                                   "K,0,7/Q,1,6/B,5,7/B,6,7/p,5,5/r,5,3/r,7,3/q,6,2/p,7,1/p,5,1/p,3,1/p,1,1/N,0,2/N,3,2/R,2,3/k,0,1/b,0,0",
                                   CLASSIC_BOARD_COLUMNS, CLASSIC_BOARD_ROWS));
 }
コード例 #8
0
 public IProblem ProblemFive(IPlayerPair players)
 {
     return(new Problem(GenerateMovementsFromString("7-0,7-7/6-7,7-7/3-0,7-4/7-7,6-7/7-4,7-6"), new StartingBoardFactory().ProblemFiveBoard(players)));
 }
コード例 #9
0
 public IBoard PawnHordeBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players, "K,4,4/r,0,7/n,1,7/b,2,7/q,3,7/k,4,7/b,5,7/n,6,7/r,7,7/p,0,6/p,1,6/p,2,6/p,3,6/p,4,6/p,5,6/p,6,6/p,7,6",
                                   CLASSIC_BOARD_COLUMNS, CLASSIC_BOARD_ROWS));
 }
コード例 #10
0
 public IProblem ProblemOne(IPlayerPair players)
 {
     return(new Problem(GenerateMovementsFromString("5-3,4-4/3-6,4-6/4-3,7-6"), new StartingBoardFactory().ProblemOneBoard(players)));
 }
コード例 #11
0
 public IBoard ClassicBoard(IPlayerPair players)
 {
     return(null);
 }
コード例 #12
0
 public IGame Classic(IPlayerPair playerPair) =>
 this.AllClassicApartFromMovementStrategy(playerPair, new ClassicWithCastlingPieceMovementStrategies(),
                                          GameType.CLASSIC);
コード例 #13
0
 private IPiece GetPieceFromComponents(IPlayerPair players, string letter, int x, int y)
 {
     return(this.ChoosePlayerOwner(players, letter).PieceFactory.PieceFromPieceType(this._fromLetterToPieceType(letter), new BoardPosition(x, y)));
 }
コード例 #14
0
 public IBoard ThreeColumnsBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players,
                                   "K,0,0/Q,1,0/N,2,0/P,0,1/P,1,1/P,2,1/k,0,7/q,1,7/n,2,7/p,0,6/p,1,6/p,2,6", THREECOL_BOARD_COLUMNS,
                                   CLASSIC_BOARD_ROWS));
 }
コード例 #15
0
 public IBoard ProblemTwoBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players, "P,3,6/K,5,7/k,7,7/p,7,6/n,7,5", CLASSIC_BOARD_COLUMNS,
                                   CLASSIC_BOARD_ROWS));
 }
コード例 #16
0
 public IBoard ProblemThreeBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players, "k,3,0/p,2,1/B,4,0/K,5,2/Q,7,7", CLASSIC_BOARD_COLUMNS,
                                   CLASSIC_BOARD_ROWS));
 }
コード例 #17
0
 public IProblem ProblemTwo(IPlayerPair players)
 {
     return(new Problem(GenerateMovementsFromString("3-6,3-7/7-5,5-6/5-7,5-6"), new StartingBoardFactory().ProblemTwoBoard(players)));
 }
コード例 #18
0
 public IProblem ProblemThree(IPlayerPair players)
 {
     return(new Problem(GenerateMovementsFromString("7-7,1-1/3-0,4-0/1-1,2-0"), new StartingBoardFactory().ProblemThreeBoard(players)));
 }
コード例 #19
0
 public IBoard ProblemOneBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players, "R,6,7/K,5,3/Q,4,3/p,2,6/k,3,6", CLASSIC_BOARD_COLUMNS,
                                   CLASSIC_BOARD_ROWS));
 }
コード例 #20
0
 public void SetUp()
 {
     this._players = new PlayerPair(new Player(new User("Alessandro"), PlayerColor.WHITE),
                                    new Player(new User("Tommaso"), PlayerColor.BLACK));
 }
コード例 #21
0
 private IPlayer ChoosePlayerOwner(IPlayerPair players, string letter)
 {
     return(letter.ToUpper().Equals(letter) ? players.WhitePlayer : players.BlackPlayer);
 }
コード例 #22
0
 public ClassicGameController(IBoard classicBoard, IPieceMovementStrategies pieceMovementStrategy, IPlayerPair players)
 {
     _classicBoard          = classicBoard;
     _pieceMovementStrategy = pieceMovementStrategy;
     _players = players;
 }
コード例 #23
0
 public IBoard CustomizedBoard(string startingBoard, int columns, int rows, IPlayerPair players)
 {
     return(this.FromStringToBoard(players, startingBoard, columns, rows));
 }
コード例 #24
0
 public IGame PawnHordeVariant(IPlayerPair playerPair) =>
 AllClassicDifferentBoard(playerPair, this._startingBoardFactory.PawnHordeBoard(playerPair),
                          GameType.PAWN_HORDE);
コード例 #25
0
 public IBoard OneDimensionBoard(IPlayerPair players)
 {
     return(this.FromStringToBoard(players, "K,0,0/N,0,1/R,0,2/k,0,7/n,0,6/r,0,5", ONE_D_BOARD_COLUMNS,
                                   CLASSIC_BOARD_ROWS));
 }
コード例 #26
0
 public static IGame GetNewGameInstance(this GameType type, IPlayerPair playerPair) =>
 GameGenerationStrategyMapper[type].Invoke(GameFactory, playerPair);
コード例 #27
0
 public IProblem ProblemFour(IPlayerPair players)
 {
     return(new Problem(GenerateMovementsFromString("1-6,5-2/6-2,5-2/2-3,4-3"), new StartingBoardFactory().ProblemFourBoard(players)));
 }