public void ShouldGenerateInitialBlackMoveCorrectly() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(); board.MakeMove(board.Moves[0][0]); board.GenerateMoves(); board.Moves[board.Ply][0].ToSquare.Should().Be(71); }
public void ShouldGenerateTwentyInitialReplies() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(); board.MakeMove(board.Moves[0][0]); board.GenerateMoves(); board.Moves[board.Ply].Count.Should().Be(20); }
public void ShouldGenerateSixteenInitialBlackMoves() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhitePawnPieceList); board.Moves[board.Ply].Count.Should().Be(16); }
public void ShouldGenerateFourHundredMovesAtDepthOneFromInitialPosition() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(); for (int count = 0; count < board.Moves[board.Ply].Count; count++) { if (board.MakeMove(board.Moves[0][count])) { board.GenerateMoves(); board.TakeMove(); } } board.Moves[0].Count.Should().Be(20); board.Moves[1].Count.Should().Be(20); }
public void ShouldGenerateFourMovesWhenBlackPawnIsPromoted() { const string boardSetup = "8/8/8/8/8/8/rrrrrrrp/8 b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(boardSetup); board.GenerateMoves(board.WhitePawnPieceList); board.Moves[board.Ply].Count.Should().Be(4); }
public void ShouldGenerateFourteenMovesIfFourteenBlackMovesAreAvailable() { const string initialBoardSetup = "r7/1ppppppp/8/8/8/8/1PPPPPPP/1NBQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteRookPieceList); board.Moves[board.Ply].Count.Should().Be(14); }
public void ShouldGenerateOneMoveIfOneWhiteMoveIsAvailable() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQ1BNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteQueenPieceList); board.Moves[board.Ply].Count.Should().Be(1); }
public void ShouldMoveFromCenterToEdgesOfBoard() { const string initialBoardSetup = "8/8/8/8/3q4/8/8/8 b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteQueenPieceList); board.Moves[board.Ply].Count.Should().Be(27); }
public void ShouldGenerateTwentyNineMovesFromBA3() { const string boardSetup = "rnbqkbnr/pppp1ppp/4p3/8/1P6/B7/P1PPPPPP/RN1QKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(boardSetup); board.GenerateMoves(); board.Moves[board.Ply].Count.Should().Be(29); }
public void ShouldMoveAndCaptureSingleAvailableTarget() { const string initialBoardSetup = "8/8/pppppppP/6rq/bbbbbbbb/8/8/8 b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteQueenPieceList); board.Moves[board.Ply].Count.Should().Be(1); }
public void ShouldMoveAndCaptureAllAvailableTargets() { const string initialBoardSetup = "8/8/8/2BBB2/2BqB3/2BBB2/8/8 b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteQueenPieceList); board.Moves[board.Ply].Count.Should().Be(8); }
public void ShouldGenerateAllCaptureMovesIfAllDirectionsAreAvailable() { const string initialBoardSetup = "8/8/pppppppp/pppKpppp/pppppppp/8/8/8 w - - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKingPieceList); board.Moves[board.Ply].Count.Should().Be(8); }
public void ShouldGenerateNoInitialMoves() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKingPieceList); board.Moves[board.Ply].Count.Should().Be(0); }
public void ShouldGenerateFourteenMovesIfFourteenWhiteMovesAreAvailable() { const string initialBoardSetup = "rnbqkbn1/ppppppp1/8/8/8/8/PPPPPPP1/7R w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteRookPieceList); board.Moves[board.Ply].Count.Should().Be(14); }
public void ShouldHaveEightMovesFromTheMiddleOfTheBoard() { const string initialBoardSetup = "8/8/8/3n4/8/8/8/8 b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKnightPieceList); board.Moves[board.Ply].Count.Should().Be(8); }
public void ShouldHaveTwoMovesForBlackKnightOnTheFirstRank() { const string initialBoardSetup = "rn6/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKnightPieceList); board.Moves[board.Ply].Count.Should().Be(2); }
public void ShouldUpdatePlyAfterMakingMove() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(); board.MakeMove(board.Moves[0][0]); board.Ply.Should().Be(1); }
public void ShouldGenerateTwoMoveWhenOnlyTwoCapturesAreAvailable() { const string boardSetup = "rnbqkbnr/rnbqkbnr/rnbqkbnr/rnbqbbnr/rnbPkbnr/rnbqkbnr/rnbqkbnr/rnbqkbnr w KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(boardSetup); board.GenerateMoves(board.WhitePawnPieceList); board.Moves[board.Ply].Count.Should().Be(2); }
public void ShouldHaveFourInitialMovesForBlack() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKnightPieceList); board.Moves[board.Ply].Count.Should().Be(4); }
public void ShouldCastleKingSideWhenBlackToMove() { const string initialBoardSetup = "rnbqk2r/pppppppp/8/8/8/8/PPPPPPPP/RBNQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.CastlePermission = CastlePermissions.WhiteKing | CastlePermissions.WhiteQueen | CastlePermissions.BlackKing | CastlePermissions.BlackQueen; board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKingPieceList); board.Moves[board.Ply].Count.Should().Be(2); }
public void ShouldHaveFourInitialMovesForBlackToTheCorrectSquares() { const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1"; var board = new Game.Board(); board.ParseFen(initialBoardSetup); board.GenerateMoves(board.WhiteKnightPieceList); board.Moves[board.Ply][0].PieceToMove.Square.Should().Be(92); board.Moves[board.Ply][0].ToSquare.Should().Be(73); board.Moves[board.Ply][1].ToSquare.Should().Be(71); }