Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# this module implement's Tomasz Michniewski's Simplified Evaluation Function
# https://www.chessprogramming.org/Simplified_Evaluation_Function
# note that the board layouts have been flipped and the top left square is A1

# fmt: off
piece_value = {
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chess==1.4.0
chess==1.5.0
10 changes: 3 additions & 7 deletions test/test_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,24 @@ def test_end_game(self):
self.assertEqual(check_end_game(board), True)

def test_evaluate_board(self):
starting_fen = chess.Board(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
)

white_down_one_pawn = chess.Board(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPP1/RNBQKBNR w KQkq - 0 1"
)

self.assertTrue(
evaluate_board(starting_fen) > evaluate_board(white_down_one_pawn)
evaluate_board(chess.Board()) > evaluate_board(white_down_one_pawn)
)

white_played_e2e4 = chess.Board(
"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1"
)

self.assertTrue(
evaluate_board(starting_fen) < evaluate_board(white_played_e2e4)
evaluate_board(chess.Board()) < evaluate_board(white_played_e2e4)
)

black_played_b8c6 = chess.Board(
'r1bqkbnr/pppppppp/2n5/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 1 2'
"r1bqkbnr/pppppppp/2n5/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 1 2"
)

self.assertTrue(
Expand Down