chess/game: claimable draw at 50-Move-Rule added

master
TiynGER 4 years ago
parent 9ed8b886db
commit 75e804ef6f

@ -5,11 +5,6 @@
ychess is a chess implementation written in nim. ychess is a chess implementation written in nim.
A chess engine is planned. A chess engine is planned.
## Todo
- draw by
- 50-move rule
## Usage ## Usage
Simply download the code and run `nim c -r game.nim`. Simply download the code and run `nim c -r game.nim`.

@ -22,6 +22,7 @@ type
toMove*: Color toMove*: Color
previousBoard*: seq[Board] previousBoard*: seq[Board]
previousCastleRights*: seq[CastleRights] previousCastleRights*: seq[CastleRights]
fiftyMoveCounter: int
## Move as object ## Move as object
Move* = object Move* = object
start: int start: int
@ -231,7 +232,7 @@ proc initMoved(): Moved =
proc initGame*(): Game = proc initGame*(): Game =
## Create and return a Game object. ## Create and return a Game object.
let game = Game(board: initBoard(), moved: initMoved(), let game = Game(board: initBoard(), moved: initMoved(),
to_move: Color.White, previousBoard: @[], previousCastleRights: @[]) to_move: Color.White, previousBoard: @[], previousCastleRights: @[], fiftyMoveCounter: 0)
return game return game
proc initGame*(board: array[0..63, int], color: Color): Game = proc initGame*(board: array[0..63, int], color: Color): Game =
@ -244,7 +245,7 @@ proc initGame*(board: array[0..63, int], color: Color): Game =
same_piece = (board[ind] != compare[ind]) same_piece = (board[ind] != compare[ind])
moved.setField(ind, same_piece) moved.setField(ind, same_piece)
let game = Game(board: board, moved: moved, let game = Game(board: board, moved: moved,
to_move: color, previousBoard: @[], previousCastleRights: @[]) to_move: color, previousBoard: @[], previousCastleRights: @[], fiftyMoveCounter: 0)
return game return game
proc getMove*(start: int, dest: int, prom: int, color: Color): Move = proc getMove*(start: int, dest: int, prom: int, color: Color): Move =
@ -745,13 +746,17 @@ proc checkedMove*(game: var Game, move: Move): bool {.discardable.} =
return false return false
var sequence = newSeq[Move]() var sequence = newSeq[Move]()
let piece = game.board.getField(start) let piece = game.board.getField(start)
var create_en_passant = false var createEnPassant = false
var captured_en_passant = false var capturedEnPassant = false
var fiftyMoveRuleReset = false
var move: Move var move: Move
move = getMove(start, dest, color) move = getMove(start, dest, color)
if (piece == PawnID * ord(color)): if (piece == PawnID * ord(color)):
create_en_passant = dest in game.genPawnDoubleDests(start, color) createEnPassant = dest in game.genPawnDoubleDests(start, color)
captured_en_passant = (game.board.getField(dest) == -1 * ord(color) * EnPassantID) capturedEnPassant = (game.board.getField(dest) == -1 * ord(color) * EnPassantID)
fiftyMoveRuleReset = true
if (game.board.getField(move.dest) != 0):
fiftyMoveRuleReset = true
sequence.add(game.genLegalMoves(start, color)) sequence.add(game.genLegalMoves(start, color))
if (move in sequence): if (move in sequence):
game.board.removeEnPassant(color) game.board.removeEnPassant(color)
@ -762,9 +767,9 @@ proc checkedMove*(game: var Game, move: Move): bool {.discardable.} =
else: else:
game.uncheckedMove(start, dest) game.uncheckedMove(start, dest)
game.toMove = Color(ord(game.toMove)*(-1)) game.toMove = Color(ord(game.toMove)*(-1))
if create_en_passant: if createEnPassant:
game.board.setField(dest-(N*ord(color)), EnPassantID * ord(color)) game.board.setField(dest-(N*ord(color)), EnPassantID * ord(color))
if captured_en_passant: if capturedEnPassant:
game.board.setField(dest-(N*ord(color)), 0) game.board.setField(dest-(N*ord(color)), 0)
if ((90 < dest and dest < 99) or (20 < dest and dest < 29)) and if ((90 < dest and dest < 99) or (20 < dest and dest < 29)) and
game.board.getField(dest) == PawnID * ord(color): game.board.getField(dest) == PawnID * ord(color):
@ -773,6 +778,9 @@ proc checkedMove*(game: var Game, move: Move): bool {.discardable.} =
var prevCastle = game.previousCastleRights var prevCastle = game.previousCastleRights
game.previousBoard.add(game.board) game.previousBoard.add(game.board)
game.previousCastleRights.add(game.moved.genCastleRights()) game.previousCastleRights.add(game.moved.genCastleRights())
game.fiftyMoveCounter = game.fiftyMoveCounter + 1
if fiftyMoveRuleReset:
game.fiftyMoveCounter = 0
return true return true
except IndexDefect, ValueError: except IndexDefect, ValueError:
return false return false
@ -796,9 +804,13 @@ proc threeMoveRep(game: Game): bool =
reps = reps + 1 reps = reps + 1
return reps >= 3 return reps >= 3
proc fiftyMoveRule(game: Game): bool =
## Checks if a draw with the fifty move rule is available in a `game`.
return game.fiftyMoveCounter >= 100
proc isDrawClaimable*(game: Game): bool = proc isDrawClaimable*(game: Game): bool =
## Checks if a draw is claimable by either player. ## Checks if a draw is claimable by either player.
return game.threeMoveRep() return game.threeMoveRep() or game.fiftyMoveRule()
proc isStalemate*(game: Game, color: Color): bool = proc isStalemate*(game: Game, color: Color): bool =
## Checks if a player of a given `color` in a `game` is stalemate. ## Checks if a player of a given `color` in a `game` is stalemate.

@ -268,6 +268,7 @@ testSuite GameTest of TestSuite:
self.check(not self.game.isStalemate(Color.Black)) self.check(not self.game.isStalemate(Color.Black))
self.check(not self.game.isStalemate(Color.White)) self.check(not self.game.isStalemate(Color.White))
## Check isDrawClaimable
method testIsDrawClaimableThreeFoldRepTrue() = method testIsDrawClaimableThreeFoldRepTrue() =
self.setup() self.setup()
self.game.checkedMove(notationToMove("g1f3", Color.White)) self.game.checkedMove(notationToMove("g1f3", Color.White))
@ -293,6 +294,345 @@ testSuite GameTest of TestSuite:
self.game.checkedMove(notationToMove("f6g8", Color.Black)) self.game.checkedMove(notationToMove("f6g8", Color.Black))
self.check(not self.game.isDrawClaimable()) self.check(not self.game.isDrawClaimable())
method testIsDrawClaimableFiftyMoveRuleTrue() =
self.game = initGame([
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, BRook,
0, 0, 0, 0, 0, 0, 0, 0,
WBishop, 0, 0, 0, 0, 0, 0, 0,
0, 0, WKing, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, WRook, 0,
0, 0, 0, BKing, 0, 0, 0, 0
], Color.Black)
self.game.checkedMove(notationToMove("a2a5", Color.Black))
self.game.checkedMove(notationToMove("f5g6", Color.White))
self.game.checkedMove(notationToMove("a5e5", Color.Black))
self.game.checkedMove(notationToMove("h4f6", Color.White))
self.game.checkedMove(notationToMove("e5e2", Color.Black))
self.game.checkedMove(notationToMove("b7a7", Color.White))
self.game.checkedMove(notationToMove("e2e1", Color.Black))
self.game.checkedMove(notationToMove("g6f5", Color.White))
self.game.checkedMove(notationToMove("e1b1", Color.Black))
self.game.checkedMove(notationToMove("f6d4", Color.White))
self.game.checkedMove(notationToMove("e8d8", Color.Black))
self.game.checkedMove(notationToMove("f5e6", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("d4e5", Color.White))
self.game.checkedMove(notationToMove("b1c1", Color.Black))
self.game.checkedMove(notationToMove("a7f7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("e6d5", Color.White))
self.game.checkedMove(notationToMove("c1a1", Color.Black))
self.game.checkedMove(notationToMove("f7h7", Color.White))
self.game.checkedMove(notationToMove("a1a2", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("a2a6", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("a6b6", Color.Black))
self.game.checkedMove(notationToMove("h7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("a7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("b6b1", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("b1e1", Color.Black))
self.game.checkedMove(notationToMove("d6e5", Color.White))
self.game.checkedMove(notationToMove("e1d1", Color.Black))
self.game.checkedMove(notationToMove("d5e6", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("a7b7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b7b3", Color.White))
self.game.checkedMove(notationToMove("c2c6", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c6c1", Color.Black))
self.game.checkedMove(notationToMove("b3h3", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("h3h8", Color.White))
self.game.checkedMove(notationToMove("c8b7", Color.Black))
self.game.checkedMove(notationToMove("h8b8", Color.White))
self.game.checkedMove(notationToMove("b7a7", Color.Black))
self.game.checkedMove(notationToMove("b8b4", Color.White))
self.game.checkedMove(notationToMove("c1d1", Color.Black))
self.game.checkedMove(notationToMove("e6d7", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("d6c7", Color.White))
self.game.checkedMove(notationToMove("c1h1", Color.Black))
self.game.checkedMove(notationToMove("c7f4", Color.White))
self.game.checkedMove(notationToMove("h1h3", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("h3h1", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("h1c1", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("f4c7", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("b4b5", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b5b6", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("b6b3", Color.White))
self.game.checkedMove(notationToMove("g2c2", Color.Black))
self.game.checkedMove(notationToMove("b3b1", Color.White))
self.game.checkedMove(notationToMove("c2c3", Color.Black))
self.game.checkedMove(notationToMove("c7e5", Color.White))
self.game.checkedMove(notationToMove("c3c2", Color.Black))
self.game.checkedMove(notationToMove("d7d6", Color.White))
self.game.checkedMove(notationToMove("c2d2", Color.Black))
self.game.checkedMove(notationToMove("d6c6", Color.White))
self.game.checkedMove(notationToMove("d2c2", Color.Black))
self.game.checkedMove(notationToMove("c6d5", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("g2g5", Color.Black))
self.game.checkedMove(notationToMove("d5c6", Color.White))
self.game.checkedMove(notationToMove("a7a6", Color.Black))
self.game.checkedMove(notationToMove("b1b8", Color.White))
self.game.checkedMove(notationToMove("g5g7", Color.Black))
self.game.checkedMove(notationToMove("b8b6", Color.White))
self.game.checkedMove(notationToMove("a6a7", Color.Black))
self.game.checkedMove(notationToMove("b6b1", Color.White))
self.game.checkedMove(notationToMove("a7a8", Color.Black))
self.game.checkedMove(notationToMove("b1e1", Color.White))
self.game.checkedMove(notationToMove("g7b7", Color.Black))
self.game.checkedMove(notationToMove("e1e8", Color.White))
self.game.checkedMove(notationToMove("a8a7", Color.Black))
self.game.checkedMove(notationToMove("d6c5", Color.White))
self.check(self.game.isDrawClaimable())
method testIsDrawClaimableFiftyMoveRuleFalseNinetyFour() =
self.game = initGame([
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, BRook,
0, 0, 0, 0, 0, 0, 0, 0,
WBishop, 0, 0, 0, 0, 0, 0, 0,
0, 0, WKing, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, WRook, 0,
0, 0, 0, BKing, 0, 0, 0, 0
], Color.Black)
self.game.checkedMove(notationToMove("a2a5", Color.Black))
self.game.checkedMove(notationToMove("f5g6", Color.White))
self.game.checkedMove(notationToMove("a5e5", Color.Black))
self.game.checkedMove(notationToMove("h4f6", Color.White))
self.game.checkedMove(notationToMove("e5e2", Color.Black))
self.game.checkedMove(notationToMove("b7a7", Color.White))
self.game.checkedMove(notationToMove("e2e1", Color.Black))
self.game.checkedMove(notationToMove("g6f5", Color.White))
self.game.checkedMove(notationToMove("e1b1", Color.Black))
self.game.checkedMove(notationToMove("f6d4", Color.White))
self.game.checkedMove(notationToMove("e8d8", Color.Black))
self.game.checkedMove(notationToMove("f5e6", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("d4e5", Color.White))
self.game.checkedMove(notationToMove("b1c1", Color.Black))
self.game.checkedMove(notationToMove("a7f7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("e6d5", Color.White))
self.game.checkedMove(notationToMove("c1a1", Color.Black))
self.game.checkedMove(notationToMove("f7h7", Color.White))
self.game.checkedMove(notationToMove("a1a2", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("a2a6", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("a6b6", Color.Black))
self.game.checkedMove(notationToMove("h7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("a7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("b6b1", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("b1e1", Color.Black))
self.game.checkedMove(notationToMove("d6e5", Color.White))
self.game.checkedMove(notationToMove("e1d1", Color.Black))
self.game.checkedMove(notationToMove("d5e6", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("a7b7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b7b3", Color.White))
self.game.checkedMove(notationToMove("c2c6", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c6c1", Color.Black))
self.game.checkedMove(notationToMove("b3h3", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("h3h8", Color.White))
self.game.checkedMove(notationToMove("c8b7", Color.Black))
self.game.checkedMove(notationToMove("h8b8", Color.White))
self.game.checkedMove(notationToMove("b7a7", Color.Black))
self.game.checkedMove(notationToMove("b8b4", Color.White))
self.game.checkedMove(notationToMove("c1d1", Color.Black))
self.game.checkedMove(notationToMove("e6d7", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("d6c7", Color.White))
self.game.checkedMove(notationToMove("c1h1", Color.Black))
self.game.checkedMove(notationToMove("c7f4", Color.White))
self.game.checkedMove(notationToMove("h1h3", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("h3h1", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("h1c1", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("f4c7", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("b4b5", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b5b6", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("b6b3", Color.White))
self.game.checkedMove(notationToMove("g2c2", Color.Black))
self.game.checkedMove(notationToMove("b3b1", Color.White))
self.game.checkedMove(notationToMove("c2c3", Color.Black))
self.game.checkedMove(notationToMove("c7e5", Color.White))
self.game.checkedMove(notationToMove("c3c2", Color.Black))
self.game.checkedMove(notationToMove("d7d6", Color.White))
self.game.checkedMove(notationToMove("c2d2", Color.Black))
self.game.checkedMove(notationToMove("d6c6", Color.White))
self.game.checkedMove(notationToMove("d2c2", Color.Black))
self.game.checkedMove(notationToMove("c6d5", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("g2g5", Color.Black))
self.game.checkedMove(notationToMove("d5c6", Color.White))
self.game.checkedMove(notationToMove("a7a6", Color.Black))
self.game.checkedMove(notationToMove("b1b8", Color.White))
self.game.checkedMove(notationToMove("g5g7", Color.Black))
self.game.checkedMove(notationToMove("b8b6", Color.White))
self.game.checkedMove(notationToMove("a6a7", Color.Black))
self.game.checkedMove(notationToMove("b6b1", Color.White))
self.game.checkedMove(notationToMove("a7a8", Color.Black))
self.game.checkedMove(notationToMove("b1e1", Color.White))
self.game.checkedMove(notationToMove("g7b7", Color.Black))
self.game.checkedMove(notationToMove("e1e8", Color.White))
self.game.checkedMove(notationToMove("a8a7", Color.Black))
self.game.checkedMove(notationToMove("d6c5", Color.White))
self.check(self.game.isDrawClaimable())
method testIsDrawClaimableFiftyMoveRuleFalseCapture() =
self.game = initGame([
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, BRook,
0, 0, 0, 0, 0, 0, 0, 0,
WBishop, 0, 0, 0, 0, 0, 0, 0,
0, 0, WKing, 0, 0, 0, 0, 0,
0, 0, BPawn, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, WRook, 0,
0, 0, 0, BKing, 0, 0, 0, 0
], Color.Black)
self.game.checkedMove(notationToMove("a2a5", Color.Black))
self.game.checkedMove(notationToMove("f5g6", Color.White))
self.game.checkedMove(notationToMove("a5e5", Color.Black))
self.game.checkedMove(notationToMove("h4f6", Color.White))
self.game.checkedMove(notationToMove("e5e2", Color.Black))
self.game.checkedMove(notationToMove("b7a7", Color.White))
self.game.checkedMove(notationToMove("e2e1", Color.Black))
self.game.checkedMove(notationToMove("g6f5", Color.White))
self.game.checkedMove(notationToMove("e1b1", Color.Black))
self.game.checkedMove(notationToMove("f6d4", Color.White))
self.game.checkedMove(notationToMove("e8d8", Color.Black))
self.game.checkedMove(notationToMove("f5e6", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("d4e5", Color.White))
self.game.checkedMove(notationToMove("b1c1", Color.Black))
self.game.checkedMove(notationToMove("a7f7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("e6d5", Color.White))
self.game.checkedMove(notationToMove("c1a1", Color.Black))
self.game.checkedMove(notationToMove("f7h7", Color.White))
self.game.checkedMove(notationToMove("a1a2", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("a2a6", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("a6b6", Color.Black))
self.game.checkedMove(notationToMove("h7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("a7c7", Color.White))
self.game.checkedMove(notationToMove("c8d8", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("b6b1", Color.Black))
self.game.checkedMove(notationToMove("c7a7", Color.White))
self.game.checkedMove(notationToMove("b1e1", Color.Black))
self.game.checkedMove(notationToMove("d6e5", Color.White))
self.game.checkedMove(notationToMove("e1d1", Color.Black))
self.game.checkedMove(notationToMove("d5e6", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("a7b7", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b7b3", Color.White))
self.game.checkedMove(notationToMove("c2c6", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("c6c1", Color.Black))
self.game.checkedMove(notationToMove("b3h3", Color.White))
self.game.checkedMove(notationToMove("d8c8", Color.Black))
self.game.checkedMove(notationToMove("h3h8", Color.White))
self.game.checkedMove(notationToMove("c8b7", Color.Black))
self.game.checkedMove(notationToMove("h8b8", Color.White))
self.game.checkedMove(notationToMove("b7a7", Color.Black))
self.game.checkedMove(notationToMove("b8b4", Color.White))
self.game.checkedMove(notationToMove("c1d1", Color.Black))
self.game.checkedMove(notationToMove("e6d7", Color.White))
self.game.checkedMove(notationToMove("d1c1", Color.Black))
self.game.checkedMove(notationToMove("d6c7", Color.White))
self.game.checkedMove(notationToMove("c1h1", Color.Black))
self.game.checkedMove(notationToMove("c7f4", Color.White))
self.game.checkedMove(notationToMove("h1h3", Color.Black))
self.game.checkedMove(notationToMove("f4e5", Color.White))
self.game.checkedMove(notationToMove("h3h1", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("h1c1", Color.Black))
self.game.checkedMove(notationToMove("d6f4", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("f4c7", Color.White))
self.game.checkedMove(notationToMove("c2c1", Color.Black))
self.game.checkedMove(notationToMove("b4b5", Color.White))
self.game.checkedMove(notationToMove("c1c2", Color.Black))
self.game.checkedMove(notationToMove("b5b6", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("b6b3", Color.White))
self.game.checkedMove(notationToMove("g2c2", Color.Black))
self.game.checkedMove(notationToMove("b3b1", Color.White))
self.game.checkedMove(notationToMove("c2c3", Color.Black))
self.game.checkedMove(notationToMove("c7e5", Color.White))
self.game.checkedMove(notationToMove("c3c2", Color.Black))
self.game.checkedMove(notationToMove("d7d6", Color.White))
self.game.checkedMove(notationToMove("c2d2", Color.Black))
self.game.checkedMove(notationToMove("d6c6", Color.White))
self.game.checkedMove(notationToMove("d2c2", Color.Black))
self.game.checkedMove(notationToMove("c6d5", Color.White))
self.game.checkedMove(notationToMove("c2g2", Color.Black))
self.game.checkedMove(notationToMove("e5d6", Color.White))
self.game.checkedMove(notationToMove("g2g5", Color.Black))
self.game.checkedMove(notationToMove("d5c6", Color.White))
self.game.checkedMove(notationToMove("a7a6", Color.Black))
self.game.checkedMove(notationToMove("b1b8", Color.White))
self.game.checkedMove(notationToMove("g5g7", Color.Black))
self.game.checkedMove(notationToMove("b8b6", Color.White))
self.game.checkedMove(notationToMove("a6a7", Color.Black))
self.game.checkedMove(notationToMove("b6b1", Color.White))
self.game.checkedMove(notationToMove("a7a8", Color.Black))
self.game.checkedMove(notationToMove("b1e1", Color.White))
self.game.checkedMove(notationToMove("g7b7", Color.Black))
self.game.checkedMove(notationToMove("e1e8", Color.White))
self.game.checkedMove(notationToMove("a8a7", Color.Black))
self.game.checkedMove(notationToMove("d6c5", Color.White))
self.check(not self.game.isDrawClaimable())
## Tests for Pawn moves ## Tests for Pawn moves
method testCheckedMovePawnSingleTrue() = method testCheckedMovePawnSingleTrue() =
self.setup() self.setup()

Loading…
Cancel
Save