beginning of transition
This commit is contained in:
@@ -65,6 +65,7 @@ def run_random_games(n: int = 20, max_moves: int = 200, verbose: bool = False):
|
||||
def test_castling_kingside_both_sides():
|
||||
board = ChessBoard.init_default()
|
||||
|
||||
# rewrite with boardmove from string
|
||||
seq = [
|
||||
(BoardMove(BoardPos((7, 6)), BoardPos((5, 5))), Color.WHITE),
|
||||
(BoardMove(BoardPos((0, 1)), BoardPos((2, 2))), Color.BLACK),
|
||||
@@ -139,6 +140,32 @@ def main():
|
||||
test_castling_kingside_both_sides()
|
||||
run_random_games(verbose=False)
|
||||
|
||||
board = ChessBoard.init_default()
|
||||
# helper to create boardmove from two-square string
|
||||
def bm(s):
|
||||
return BoardMove(
|
||||
ChessBoard.algebraic_to_pos(s[0:2]),
|
||||
ChessBoard.algebraic_to_pos(s[2:4])
|
||||
)
|
||||
|
||||
# perform four cycles of the knight shuffle
|
||||
# Nf3-Nf6-Ng1-Ng8 and returns to the starting position.
|
||||
seq = []
|
||||
for _ in range(4):
|
||||
seq.extend([
|
||||
(bm("g1f3"), Color.WHITE),
|
||||
(bm("g8f6"), Color.BLACK),
|
||||
(bm("f3g1"), Color.WHITE),
|
||||
(bm("f6g8"), Color.BLACK),
|
||||
])
|
||||
for move, color in seq:
|
||||
ok = board.make_move(move, color)
|
||||
assert ok, "repetition test move failed"
|
||||
|
||||
rep = board.highest_repetiton_amount()
|
||||
assert rep >= 5, f"expected at least 5 repetitions, got {rep}"
|
||||
assert board.is_fivefold_repetition(), "board should report fivefold repetition"
|
||||
|
||||
print(f"all tests passed")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user