HaileyStorm
commited on
Commit
•
227d565
1
Parent(s):
0a27285
Update chess-gpt-eval/main.py
Browse files- chess-gpt-eval/main.py +8 -2
chess-gpt-eval/main.py
CHANGED
@@ -190,7 +190,8 @@ def record_results(
|
|
190 |
player_two_failed_to_find_legal_move: bool,
|
191 |
total_moves: int,
|
192 |
illegal_moves: int,
|
193 |
-
opening_moves: int
|
|
|
194 |
):
|
195 |
unique_game_id = generate_unique_game_id()
|
196 |
|
@@ -249,6 +250,8 @@ def record_results(
|
|
249 |
"p1_avg_attempts_per_illegal": 0 if player_one_illegal_moves == 0 else player_one_illegal_attempts / float(player_one_illegal_moves),
|
250 |
"p1_illegal_attemtps_pct": 1.0 if played_moves == 0 else player_one_illegal_attempts / float(player_one_illegal_attempts + player_one_legal_moves),
|
251 |
"p1_illegal_moves_pct": 1.0 if played_moves == 0 else player_one_illegal_moves / float(played_moves),
|
|
|
|
|
252 |
"time_taken": total_time,
|
253 |
"total_moves": total_moves,
|
254 |
"illegal_moves": illegal_moves,
|
@@ -451,6 +454,7 @@ def play_game(
|
|
451 |
|
452 |
total_moves = 0
|
453 |
illegal_moves = 0
|
|
|
454 |
print_for_human = isinstance(player_one, HumanPlayer) or isinstance(player_two, HumanPlayer)
|
455 |
|
456 |
while not board.is_game_over():
|
@@ -482,6 +486,7 @@ def play_game(
|
|
482 |
player_one_illegal_attempts += illegal_moves_one
|
483 |
if illegal_moves_one != 0:
|
484 |
player_one_legal_moves -= 1
|
|
|
485 |
if (
|
486 |
board.is_game_over()
|
487 |
or player_one_resignation
|
@@ -533,7 +538,8 @@ def play_game(
|
|
533 |
player_two_failed_to_find_legal_move,
|
534 |
total_moves,
|
535 |
illegal_moves,
|
536 |
-
opening_moves
|
|
|
537 |
)
|
538 |
if isinstance(player_one, StockfishPlayer):
|
539 |
player_one.close()
|
|
|
190 |
player_two_failed_to_find_legal_move: bool,
|
191 |
total_moves: int,
|
192 |
illegal_moves: int,
|
193 |
+
opening_moves: int,
|
194 |
+
illegal_move_numbers: list[int]
|
195 |
):
|
196 |
unique_game_id = generate_unique_game_id()
|
197 |
|
|
|
250 |
"p1_avg_attempts_per_illegal": 0 if player_one_illegal_moves == 0 else player_one_illegal_attempts / float(player_one_illegal_moves),
|
251 |
"p1_illegal_attemtps_pct": 1.0 if played_moves == 0 else player_one_illegal_attempts / float(player_one_illegal_attempts + player_one_legal_moves),
|
252 |
"p1_illegal_moves_pct": 1.0 if played_moves == 0 else player_one_illegal_moves / float(played_moves),
|
253 |
+
"p1_first_illegal_move_num": illegal_move_numbers[0],
|
254 |
+
"p1_avg_illegal_move_num": np.average(illegal_move_numbers),
|
255 |
"time_taken": total_time,
|
256 |
"total_moves": total_moves,
|
257 |
"illegal_moves": illegal_moves,
|
|
|
454 |
|
455 |
total_moves = 0
|
456 |
illegal_moves = 0
|
457 |
+
illegal_move_numbers = []
|
458 |
print_for_human = isinstance(player_one, HumanPlayer) or isinstance(player_two, HumanPlayer)
|
459 |
|
460 |
while not board.is_game_over():
|
|
|
486 |
player_one_illegal_attempts += illegal_moves_one
|
487 |
if illegal_moves_one != 0:
|
488 |
player_one_legal_moves -= 1
|
489 |
+
illegal_move_numbers.append(board.fullmove_number)
|
490 |
if (
|
491 |
board.is_game_over()
|
492 |
or player_one_resignation
|
|
|
538 |
player_two_failed_to_find_legal_move,
|
539 |
total_moves,
|
540 |
illegal_moves,
|
541 |
+
opening_moves,
|
542 |
+
illegal_move_numbers
|
543 |
)
|
544 |
if isinstance(player_one, StockfishPlayer):
|
545 |
player_one.close()
|