コード例 #1
0
        public static void Main(string[] args)
        {
            var board       = new Board();
            var blackPlayer = HumanPlayerConsoleAdapter.CreateFor(PlayerType.Black);
            var whitePlayer = NoviceComputerPlayer.CreateFor(PlayerType.White, board);

            var shogiGame = new ShogiGame(new BoardConsoleRender(), blackPlayer, whitePlayer, board);

            shogiGame.Start();
        }
コード例 #2
0
        public void FavourExposedMoveToRiskOfCaptureMove()
        {
            var boardState = new BoardState();

            boardState.Add(new Pawn(PlayerType.Black, "3g"));
            boardState.Add(new Pawn(PlayerType.Black, "2g", false));
            boardState.Add(new Bishop(PlayerType.White, "5c"));

            var board       = new Board(boardState, PlayerType.Black);
            var moveAdvisor = NoviceComputerPlayer.CreateFor(PlayerType.Black, board);
            var bestMove    = moveAdvisor.AskForNextMove();

            Assert.Equal("3g3f", bestMove);
        }
コード例 #3
0
        public void MoveToCheckMateIfPossible()
        {
            var boardState = new BoardState();

            boardState.Add(new King(PlayerType.White, "1c"));
            boardState.Add(new Lance(PlayerType.White, "1b"));
            boardState.Add(new Pawn(PlayerType.White, "1d"));
            boardState.Add(new Bishop(PlayerType.Black, "5c"));
            boardState.Add(new Lance(PlayerType.Black, "2e"));

            var board = new Board(boardState, PlayerType.Black);

            var moveAdvisor = NoviceComputerPlayer.CreateFor(PlayerType.Black, board);
            var bestMove    = moveAdvisor.AskForNextMove();

            Assert.Equal("5c3a", bestMove);
        }