From ef415094402a264a1c2a5a42f1123230d33e0f98 Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Thu, 13 May 2021 13:28:33 +0200 Subject: [PATCH 1/8] Change chess-python API to v1.5 --- README.md | 12 +++--- main.py | 30 +++++++-------- modules/investigate/investigate.py | 24 +++++++----- modules/puzzle/analysed.py | 8 ++-- modules/puzzle/position_list.py | 60 +++++++++++++++--------------- requirements.txt | 4 +- 6 files changed, 70 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index acd5d44..d2402fd 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ It's based on the great [https://github.com/clarkerubber/Python-Puzzle-Creator] Things that I changed: - Use a local pgn file with games as a source. - Write results to a file called tactics.pgn -- Default engine depth to 8 so it's faster. Before it was nodes=3500000 this is a depth around 20. So it took several minutes to analyze a game. With depth 8 it takes seconds. +- Default engine depth to 8, so it's faster. Before it was nodes=3500000 this is a depth around 20. So it took several minutes to analyze a game. With depth 8 it takes seconds. - You can use the `depth` argument to change the depth if you want more precision. -- chess.pop_count to chess.popcount because it was failing +- chess.pop_count to chess.popcount, because it was failing ### This is too complex, give something easy. There is another option if you don't want to install and manage python scripts @@ -39,7 +39,7 @@ You can download games from a specific user using this command: `python3 download_games.py ` -By default it will download the last 60 games from blitz, rapid and classical. +By default, it will download the last 60 games from blitz, rapid and classical. **Arguments** @@ -73,9 +73,9 @@ To execute the generator execute this command. By default it will look for the ` **Arguments** - `--quiet` to reduce the screen output. -- `--depth=8` select the stockfish depth analysis. Default is `8` and will take some seconds to analyze a game, with `--depth=18` will take around 6 minutes. +- `--depth=8` select the Stockfish depth analysis. Default is `8` and will take some seconds to analyze a game, with `--depth=18` will take around 6 minutes. - `--games=ruy_lopez.pgn` to select a specific pgn file. Default is `games.pgn` -- `strict=False` Use `False` to generate more tactics but a little more ambiguous. Default is `True` +- `--strict=False` Use `False` to generate more tactics but a little more ambiguous. Default is `True` - `--threads=4` Stockfish argument, number of engine threads, default `4` - `--memory=2048` Stockfish argument, memory in MB to use for engine hashtables, default `2048` @@ -90,7 +90,7 @@ The `result header` is the tactic result and not the game result. It can be load ## Problems? #### Stockfish errors -- If you have problems building stockfish try downloading stockfish directly https://stockfishchess.org/download/ +- If you have problems building Stockfish try downloading Stockfish directly https://stockfishchess.org/download/ ## Want to see all my chess related projects? Check [My projects](http://vitomd.com/blog/projects/) for a full detailed list. diff --git a/main.py b/main.py index f509ba8..834df16 100755 --- a/main.py +++ b/main.py @@ -7,7 +7,7 @@ import sys import chess.pgn -import chess.uci +import chess.engine from modules.api.api import post_puzzle from modules.bcolors.bcolors import bcolors @@ -44,13 +44,10 @@ logging.basicConfig(format="%(message)s", level=settings.loglevel, stream=sys.stdout) logging.getLogger("requests.packages.urllib3").setLevel(logging.WARNING) -logging.getLogger("chess.uci").setLevel(logging.WARNING) +logging.getLogger("chess.engine").setLevel(logging.WARNING) -engine = chess.uci.popen_engine(stockfish_command()) -engine.setoption({'Threads': settings.threads, 'Hash': settings.memory}) -engine.uci() -info_handler = chess.uci.InfoHandler() -engine.info_handlers.append(info_handler) +engine = chess.engine.SimpleEngine.popen_uci(stockfish_command()) +engine.configure({'Threads': settings.threads, 'Hash': settings.memory}) all_games = open(settings.games, "r") tactics_file = open("tactics.pgn", "w") @@ -65,27 +62,24 @@ logging.debug(bcolors.WARNING + "Game ID: " + str(game_id) + bcolors.ENDC) logging.debug(bcolors.WARNING + "Game headers: " + str(game) + bcolors.ENDC) - prev_score = chess.uci.Score(None, None) + prev_score = chess.engine.Cp(0) puzzles = [] logging.debug(bcolors.OKGREEN + "Game Length: " + str(game.end().board().fullmove_number)) logging.debug("Analysing Game..." + bcolors.ENDC) - engine.ucinewgame() - while not node.is_end(): next_node = node.variation(0) - engine.position(next_node.board()) - engine.go(depth=settings.depth) - cur_score = info_handler.info["score"][1] + info = engine.analyse(next_node.board(), chess.engine.Limit(depth=settings.depth)) + + cur_score = info["score"].relative logging.debug(bcolors.OKGREEN + node.board().san(next_node.move) + bcolors.ENDC) - logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.cp)) - logging.debug(" Mate: " + str(cur_score.mate) + bcolors.ENDC) + logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.score())) + logging.debug(" Mate: " + str(cur_score.mate()) + bcolors.ENDC) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) - puzzles.append( - puzzle(node.board(), next_node.move, str(game_id), engine, info_handler, game, settings.strict)) + puzzles.append(puzzle(node.board(), next_node.move, str(game_id), engine, info, game, settings.strict)) prev_score = cur_score node = next_node @@ -99,3 +93,5 @@ tactics_file.write("\n\n") tactics_file.close() + +engine.quit() diff --git a/modules/investigate/investigate.py b/modules/investigate/investigate.py index 078c74e..4204720 100644 --- a/modules/investigate/investigate.py +++ b/modules/investigate/investigate.py @@ -15,19 +15,23 @@ def material_count(board): def investigate(a, b, board): - # determine if the difference between position A and B - # is worth investigating for a puzzle. - if a.cp is not None and b.cp is not None: - if (((-110 < a.cp < 850 and 200 < b.cp < 850) - or (-850 < a.cp < 110 and -200 > b.cp > -850)) + """ + determine if the difference between position A and B + is worth investigating for a puzzle. + """ + a_cp, a_mate = a.score(), a.mate() + b_cp, b_mate = b.score(), b.mate() + + if a_cp is not None and b_cp is not None: + if (((-110 < a_cp < 850 and 200 < b_cp < 850) + or (-850 < a_cp < 110 and -200 > b_cp > -850)) and material_value(board) > 3 and material_count(board) > 6): return True - elif a.cp is not None and b.mate is not None and material_value(board) > 3: - if (a.cp < 110 and sign(b.mate) == -1) or (a.cp > -110 and sign(b.mate) == 1): + elif a_cp is not None and b_mate is not None and material_value(board) > 3: + if (a_cp < 110 and sign(b_mate) == -1) or (a_cp > -110 and sign(b_mate) == 1): return True - elif (a.mate is not None - and b.mate is not None): - if sign(a.mate) == sign(b.mate): # actually means that they're opposite + elif a_mate is not None and b_mate is not None: + if sign(a_mate) == sign(b_mate): # actually means that they're opposite return True return False diff --git a/modules/puzzle/analysed.py b/modules/puzzle/analysed.py index 934c2f9..1b28b34 100644 --- a/modules/puzzle/analysed.py +++ b/modules/puzzle/analysed.py @@ -10,9 +10,9 @@ def sign(self, val): return 1 def sort_val(self): - if self.evaluation.cp is not None: - return self.evaluation.cp - elif self.evaluation.mate is not None: - return self.sign(self.evaluation.mate) * (abs(100 + self.evaluation.mate)) * 10000 + if self.evaluation.score(): + return self.evaluation.score() + elif self.evaluation.is_mate(): + return self.sign(self.evaluation.mate()) * (abs(100 + self.evaluation.mate())) * 10000 else: return 0 diff --git a/modules/puzzle/position_list.py b/modules/puzzle/position_list.py index 8f6b1d3..572f908 100644 --- a/modules/puzzle/position_list.py +++ b/modules/puzzle/position_list.py @@ -2,7 +2,7 @@ from operator import methodcaller import chess -import chess.uci +import chess.engine from modules.bcolors.bcolors import bcolors from modules.puzzle.analysed import analysed @@ -23,11 +23,11 @@ def __init__(self, position, engine, info_handler, player_turn=True, best_move=N def move_list(self): if self.next_position is None or self.next_position.ambiguous() or self.next_position.position.is_game_over(): if self.best_move is not None: - return [self.best_move.bestmove.uci()] + return [self.best_move.move.uci()] else: return [] else: - return [self.best_move.bestmove.uci()] + self.next_position.move_list() + return [self.best_move.move.uci()] + self.next_position.move_list() def category(self): if self.next_position is None: @@ -58,19 +58,20 @@ def generate(self, depth): def evaluate_best(self, depth): logging.debug(bcolors.OKGREEN + "Evaluating Best Move...") - self.engine.position(self.position) - self.best_move = self.engine.go(depth=depth) - if self.best_move.bestmove is not None: - self.evaluation = self.info_handler.info["score"][1] + + self.best_move = self.engine.play(self.position, chess.engine.Limit(depth=depth), info=chess.engine.INFO_ALL) + + if self.best_move.move is not None: + self.evaluation = self.best_move.info['score'].relative self.next_position = position_list(self.position.copy(), self.engine, self.info_handler, not self.player_turn, strict=self.strict) - self.next_position.position.push(self.best_move.bestmove) - logging.debug("Best Move: " + self.best_move.bestmove.uci() + bcolors.ENDC) - logging.debug(bcolors.OKBLUE + " CP: " + str(self.evaluation.cp)) - logging.debug(" Mate: " + str(self.evaluation.mate) + bcolors.ENDC) + self.next_position.position.push(self.best_move.move) + logging.debug("Best Move: " + self.best_move.move.uci() + bcolors.ENDC) + logging.debug(bcolors.OKBLUE + " CP: " + str(self.evaluation.score())) + logging.debug(" Mate: " + str(self.evaluation.mate()) + bcolors.ENDC) return True else: logging.debug(bcolors.FAIL + "No best move!" + bcolors.ENDC) @@ -81,14 +82,15 @@ def evaluate_legals(self, depth): for i in self.position.legal_moves: position_copy = self.position.copy() position_copy.push(i) - self.engine.position(position_copy) - self.engine.go(depth=depth) - self.analysed_legals.append(analysed(i, self.info_handler.info["score"][1])) + + info = self.engine.analyse(position_copy, chess.engine.Limit(depth=depth)) + self.analysed_legals.append(analysed(i, info["score"].relative)) + self.analysed_legals = sorted(self.analysed_legals, key=methodcaller('sort_val')) for i in self.analysed_legals[:3]: logging.debug(bcolors.OKGREEN + "Move: " + str(i.move.uci()) + bcolors.ENDC) - logging.debug(bcolors.OKBLUE + " CP: " + str(i.evaluation.cp)) - logging.debug(" Mate: " + str(i.evaluation.mate)) + logging.debug(bcolors.OKBLUE + " CP: " + str(i.evaluation.score())) + logging.debug(" Mate: " + str(i.evaluation.mate())) logging.debug("... and " + str(max(0, len(self.analysed_legals) - 3)) + " more moves" + bcolors.ENDC) def material_difference(self): @@ -109,7 +111,7 @@ def is_complete(self, category, color, first_node, first_val): if (self.material_difference() > 0.2 and abs(self.material_difference() - first_val) > 0.1 and first_val < 2 - and self.evaluation.mate is None + and self.evaluation.mate() is None and self.material_count() > 6): return True else: @@ -118,7 +120,7 @@ def is_complete(self, category, color, first_node, first_val): if (self.material_difference() < -0.2 and abs(self.material_difference() - first_val) > 0.1 and first_val > -2 - and self.evaluation.mate is None + and self.evaluation.mate() is None and self.material_count() > 6): return True else: @@ -133,19 +135,19 @@ def ambiguous(self): # If strict == False then it will generate more tactics but more ambiguous move_number = 1 if self.strict else 2 if len(self.analysed_legals) > 1: - if (self.analysed_legals[0].evaluation.cp is not None - and self.analysed_legals[1].evaluation.cp is not None): - if (self.analysed_legals[0].evaluation.cp > -210 - or self.analysed_legals[move_number].evaluation.cp < -90): + if (self.analysed_legals[0].evaluation.score() is not None + and self.analysed_legals[1].evaluation.score() is not None): + if (self.analysed_legals[0].evaluation.score() > -210 + or self.analysed_legals[move_number].evaluation.score() < -90): return True - if (self.analysed_legals[0].evaluation.mate is not None - and self.analysed_legals[1].evaluation.mate is not None): - if (self.analysed_legals[0].evaluation.mate < 1 - and self.analysed_legals[1].evaluation.mate < 1): + if (self.analysed_legals[0].evaluation.mate() is not None + and self.analysed_legals[1].evaluation.mate() is not None): + if (self.analysed_legals[0].evaluation.mate() < 1 + and self.analysed_legals[1].evaluation.mate() < 1): return True - if self.analysed_legals[0].evaluation.mate is None or self.analysed_legals[1].evaluation.cp is None: - return - if self.analysed_legals[1].evaluation.cp < -200: + if not self.analysed_legals[0].evaluation.is_mate() or self.analysed_legals[1].evaluation.is_mate(): + return True + if self.analysed_legals[1].evaluation.score() < -200: return True return False diff --git a/requirements.txt b/requirements.txt index 9d38342..280c1c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -colorama==0.3.7 -python-chess==0.24.2 +colorama==0.4.4 +chess==1.5.0 requests==2.20.0 From 62aa83acdfb02704c0eb78a2703dc9839ae9acdb Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Mon, 31 May 2021 12:50:40 +0200 Subject: [PATCH 2/8] Add positions for investigation generator --- modules/encoding.py | 62 +++++++++++++++++ positions_for_investigation.py | 120 +++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 modules/encoding.py create mode 100644 positions_for_investigation.py diff --git a/modules/encoding.py b/modules/encoding.py new file mode 100644 index 0000000..0e02714 --- /dev/null +++ b/modules/encoding.py @@ -0,0 +1,62 @@ +from chess import Move, Board +from chess.uci import BestMove, Score + +from modules.puzzle import position_list + + +def move_to_dict(m: Move) -> dict: + return m.uci() if m else None + + +def bestmove_to_dict(bm: BestMove) -> dict: + return { + 'move': move_to_dict(bm.bestmove), + 'ponder': move_to_dict(bm.ponder) + } if bm else None + + +def board_to_dict(b: Board) -> dict: + return { + 'fen': b.fen(), + 'aliases': b.aliases, + 'fullmove_number': b.fullmove_number, + 'move_stack': [m.uci() for m in b.move_stack], + 'uci_variant': b.uci_variant + } if b else None + + # return json.loads(json.dumps(b, default=lambda o: o.__dict__)) + + +def score_to_dict(score: Score): + return [score.cp, score.mate] if score else None + + +def positionlist_to_dict(pl: position_list) -> dict: + return { + 'position': board_to_dict(pl.position), + 'player_turn': pl.player_turn, + 'best_move': bestmove_to_dict(pl.best_move), + 'evaluation': score_to_dict(pl.evaluation), + 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, + 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], + 'strict': pl.strict + } if pl else None + + +def analyzed_to_dict(a): + return { + 'move': move_to_dict(a.move), + 'evaluation': a.evaluation + } + + +def puzzle_to_dict(p): + return { + 'game_id': p.game_id, + 'category': p.positions.category(), + 'last_pos': board_to_dict(p.last_pos), + 'last_move': move_to_dict(p.last_move), + 'move_list': p.positions.move_list(), + 'positions': positionlist_to_dict(p.positions) + # , 'game': p.game + } if p else None diff --git a/positions_for_investigation.py b/positions_for_investigation.py new file mode 100644 index 0000000..9048bde --- /dev/null +++ b/positions_for_investigation.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +import argparse +import json +import logging +import sys + +import chess.pgn +import chess.uci + +from modules.bcolors.bcolors import bcolors +from modules.encoding import puzzle_to_dict, board_to_dict +from modules.fishnet.fishnet import stockfish_command +from modules.investigate.investigate import investigate +from modules.puzzle.puzzle import puzzle + +# from position_list_to import PositionList + +parser = argparse.ArgumentParser(description=__doc__) + +parser.add_argument("--threads", metavar="THREADS", nargs="?", type=int, default=4, help="number of engine threads") +parser.add_argument("--memory", metavar="MEMORY", nargs="?", type=int, default=2048, + help="memory in MB to use for engine hashtables") +parser.add_argument("--depth", metavar="DEPTH", nargs="?", type=int, default=8, help="depth for stockfish analysis") +parser.add_argument("--quiet", dest="loglevel", default=logging.DEBUG, action="store_const", const=logging.INFO, + help="substantially reduce the number of logged messages") +parser.add_argument("--games", metavar="GAMES", default="games.pgn", help="A specific pgn with games") +parser.add_argument("--strict", metavar="STRICT", default=True, + help="If False then it will be generate more tactics but maybe a little ambiguous") +settings = parser.parse_args() +try: + # Optionally fix colors on Windows and in journals if the colorama module + # is available. + import colorama + + wrapper = colorama.AnsiToWin32(sys.stdout) + if wrapper.should_wrap(): + sys.stdout = wrapper.stream +except ImportError: + pass + +logging.basicConfig(format="%(message)s", level=settings.loglevel, stream=sys.stdout) +logging.getLogger("requests.packages.urllib3").setLevel(logging.WARNING) +logging.getLogger("chess.uci").setLevel(logging.WARNING) +logging.getLogger("chess._engine").setLevel(logging.WARNING) + +engine = chess.uci.popen_engine(stockfish_command()) +engine.setoption({'Threads': settings.threads, 'Hash': settings.memory}) +engine.uci() +info_handler = chess.uci.InfoHandler() +engine.info_handlers.append(info_handler) + +all_games = open(settings.games, "r") + + +def write_test_data(filename: str, payload: str): + with open(filename, "w") as f: + f.write(payload) + + +# data collection for testing investigate function +investigate_test_data = [] +complete_test_data = [] + +game_id = 0 +while True: + game = chess.pgn.read_game(all_games) + if game is None: + break + node = game + + game_id = game_id + 1 + logging.debug(bcolors.WARNING + "Game ID: " + str(game_id) + bcolors.ENDC) + logging.debug(bcolors.WARNING + "Game headers: " + str(game) + bcolors.ENDC) + + prev_score = chess.uci.Score(None, None) + puzzles = [] + + logging.debug("Analysing Game..." + bcolors.ENDC) + + engine.ucinewgame() + + # find candidates (positions) + while not node.is_end(): + next_node = node.variation(0) + engine.position(next_node.board()) + + engine.go(depth=settings.depth) + cur_score = info_handler.info["score"][1] + logging.debug(bcolors.OKGREEN + node.board().san(next_node.move) + bcolors.ENDC) + logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.cp)) + logging.debug(" Mate: " + str(cur_score.mate) + bcolors.ENDC) + + result = investigate(prev_score, cur_score, node.board()) + + if result: + logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) + puzzles.append( + puzzle(node.board(), next_node.move, str(game_id), engine, info_handler, game, settings.strict)) + + # save the data for investigate() testing + investigate_test_data.append( + {'score_a': prev_score, 'score_b': cur_score, 'board': board_to_dict(node.board()), 'result': result}) + + prev_score = cur_score + node = next_node + + # check puzzle completeness + for i in puzzles: + logging.info(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) + i.generate(settings.depth) + + is_complete = i.is_complete() + logging.info(f'{i.last_pos.fen()} -- {is_complete}') + if is_complete: + complete_test_data.append({'puzzle': puzzle_to_dict(i), 'is_complete': is_complete}) + +# dump the test data to files +write_test_data('investigate.json', json.dumps(investigate_test_data, indent=2)) +write_test_data('is_complete.json', json.dumps(complete_test_data)) From ba250292b82766d57b2720e30a23b4b444e88da5 Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Mon, 31 May 2021 14:03:03 +0200 Subject: [PATCH 3/8] Add initial test for investigate() --- modules/decoding.py | 16 + modules/encoding.py | 30 +- positions_for_investigation.py | 4 +- test/__init__.py | 0 test/data/investigate.json | 156 ++ test/data/is_complete.json | 2455 ++++++++++++++++++++++++++++++++ test/unit/regression.py | 50 + 7 files changed, 2699 insertions(+), 12 deletions(-) create mode 100644 modules/decoding.py create mode 100644 test/__init__.py create mode 100644 test/data/investigate.json create mode 100644 test/data/is_complete.json create mode 100644 test/unit/regression.py diff --git a/modules/decoding.py b/modules/decoding.py new file mode 100644 index 0000000..8d7c18f --- /dev/null +++ b/modules/decoding.py @@ -0,0 +1,16 @@ +import chess +from chess import Move, Board +from chess.uci import Score + +# +# def move_from_dict(d: dict) -> Move: +# return m.uci() if m else None + + +def score_from_dict(d) -> Score: + return Score(d[0], d[1]) if d else None + + +def board_from_dict(d: dict) -> Board: + board = chess.Board(d['fen']) + return board diff --git a/modules/encoding.py b/modules/encoding.py index 0e02714..35a74b6 100644 --- a/modules/encoding.py +++ b/modules/encoding.py @@ -15,16 +15,26 @@ def bestmove_to_dict(bm: BestMove) -> dict: } if bm else None -def board_to_dict(b: Board) -> dict: - return { - 'fen': b.fen(), - 'aliases': b.aliases, - 'fullmove_number': b.fullmove_number, - 'move_stack': [m.uci() for m in b.move_stack], - 'uci_variant': b.uci_variant - } if b else None - - # return json.loads(json.dumps(b, default=lambda o: o.__dict__)) +def board_to_dict(b: Board, position_only: bool = False) -> dict: + if not b: + return None + else: + result = { + 'fen': b.fen() + } + if not position_only: + result.update({ + 'aliases': b.aliases, + 'fullmove_number': b.fullmove_number, + 'move_stack': [m.uci() for m in b.move_stack], + 'uci_variant': b.uci_variant, + 'piece_map': piecemap_to_dict(b.piece_map()) + }) + return result + + +def piecemap_to_dict(pm) -> dict: + return {key: val.symbol() for key, val in pm.items()} def score_to_dict(score: Score): diff --git a/positions_for_investigation.py b/positions_for_investigation.py index 9048bde..48bac49 100644 --- a/positions_for_investigation.py +++ b/positions_for_investigation.py @@ -100,7 +100,7 @@ def write_test_data(filename: str, payload: str): # save the data for investigate() testing investigate_test_data.append( - {'score_a': prev_score, 'score_b': cur_score, 'board': board_to_dict(node.board()), 'result': result}) + {'score_a': prev_score, 'score_b': cur_score, 'board': board_to_dict(node.board(), True), 'result': result}) prev_score = cur_score node = next_node @@ -117,4 +117,4 @@ def write_test_data(filename: str, payload: str): # dump the test data to files write_test_data('investigate.json', json.dumps(investigate_test_data, indent=2)) -write_test_data('is_complete.json', json.dumps(complete_test_data)) +write_test_data('is_complete.json', json.dumps(complete_test_data, indent=2)) diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/data/investigate.json b/test/data/investigate.json new file mode 100644 index 0000000..cc3977c --- /dev/null +++ b/test/data/investigate.json @@ -0,0 +1,156 @@ +[ + { + "score_a": [ + 180, + null + ], + "score_b": [ + 378, + null + ], + "board": { + "fen": "r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2PB1PPP/R2Q1RK1 b kq - 2 12" + }, + "result": true + }, + { + "score_a": [ + -60, + null + ], + "score_b": [ + 212, + null + ], + "board": { + "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bB3/P1N5/2PB1PPP/R2Q1RK1 b kq - 0 13" + }, + "result": true + }, + { + "score_a": [ + 91, + null + ], + "score_b": [ + 273, + null + ], + "board": { + "fen": "r3r1k1/p1pq1ppp/2pp4/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 b - - 4 15" + }, + "result": true + }, + { + "score_a": [ + -108, + null + ], + "score_b": [ + 308, + null + ], + "board": { + "fen": "r5k1/p1p2ppp/2pp4/4b3/4P3/1P3QPq/P1P2P1P/1R2R1K1 b - - 2 19" + }, + "result": true + }, + { + "score_a": [ + 180, + null + ], + "score_b": [ + 711, + null + ], + "board": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p5/4P3/1P3QPq/2P1RP1P/R5K1 w - - 2 24" + }, + "result": true + }, + { + "score_a": [ + 711, + null + ], + "score_b": [ + 203, + null + ], + "board": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2Q2/4P3/1P4Pq/2P1RP1P/R5K1 b - - 3 24" + }, + "result": true + }, + { + "score_a": [ + 172, + null + ], + "score_b": [ + 642, + null + ], + "board": { + "fen": "4rk2/p1pQ1pp1/1b3q2/2p1pP1p/2P5/1P2R1P1/7P/3R2K1 w - - 0 32" + }, + "result": true + }, + { + "score_a": [ + -66, + null + ], + "score_b": [ + 723, + null + ], + "board": { + "fen": "2kr3r/1pp2p1p/p6q/3P1p2/8/5Q2/P4PPP/1RR3K1 b - - 1 21" + }, + "result": true + }, + { + "score_a": [ + -26, + null + ], + "score_b": [ + 203, + null + ], + "board": { + "fen": "2kr2r1/1pp2p1p/p6q/3P1p2/8/1Q6/P4PPP/1RR3K1 b - - 3 22" + }, + "result": true + }, + { + "score_a": [ + 64, + null + ], + "score_b": [ + 274, + null + ], + "board": { + "fen": "2kr2r1/2p2p1p/pp4q1/3P1p2/8/5QP1/P4P1P/1RR3K1 b - - 0 24" + }, + "result": true + }, + { + "score_a": [ + 68, + null + ], + "score_b": [ + 627, + null + ], + "board": { + "fen": "2kr2r1/2p2p2/pp4q1/3P1p1p/7P/5QP1/P4P2/1RR3K1 b - - 0 25" + }, + "result": true + } +] \ No newline at end of file diff --git a/test/data/is_complete.json b/test/data/is_complete.json new file mode 100644 index 0000000..688159d --- /dev/null +++ b/test/data/is_complete.json @@ -0,0 +1,2455 @@ +[ + { + "puzzle": { + "game_id": "1", + "category": "Material", + "last_pos": { + "fen": "r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2PB1PPP/R2Q1RK1 b kq - 2 12", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 12, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "45": "n", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "P", + "27": "b", + "25": "P", + "19": "B", + "18": "N", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "last_move": "f6e4", + "move_list": [ + "c3e4", + "c6e4", + "d3e4", + "d7d5" + ], + "positions": { + "position": { + "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bn3/P1NB4/2PB1PPP/R2Q1RK1 w kq - 0 13", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 13, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "n", + "27": "b", + "25": "P", + "19": "B", + "18": "N", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "c3e4", + "ponder": "c6e4" + }, + "evaluation": [ + 344, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bN3/P2B4/2PB1PPP/R2Q1RK1 b kq - 0 13", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 13, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "N", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "c6e4", + "ponder": "d3e4" + }, + "evaluation": [ + -204, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bb3/P2B4/2PB1PPP/R2Q1RK1 w kq - 0 14", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 14, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "41": "q", + "40": "p", + "33": "p", + "28": "b", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "d3e4", + "ponder": "d7d5" + }, + "evaluation": [ + 313, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bB3/P7/2PB1PPP/R2Q1RK1 b kq - 0 14", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 14, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "41": "q", + "40": "p", + "33": "p", + "28": "B", + "27": "b", + "25": "P", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "d7d5", + "ponder": "c2c3" + }, + "evaluation": [ + -231, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1bB3/P7/2PB1PPP/R2Q1RK1 w kq - 0 15", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 15, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4", + "d7d5" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "44": "p", + "41": "q", + "40": "p", + "35": "p", + "33": "p", + "28": "B", + "27": "b", + "25": "P", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e4d3", + "ponder": "d4a1" + }, + "evaluation": [ + 279, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1b4/P2B4/2PB1PPP/R2Q1RK1 b kq - 1 15", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 15, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4", + "d7d5", + "e4d3" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "44": "p", + "41": "q", + "40": "p", + "35": "p", + "33": "p", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": null, + "evaluation": null, + "next_position": null, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e4d3", + "evaluation": [ + -282, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + -261, + null + ] + }, + { + "move": "e4f3", + "evaluation": [ + -188, + null + ] + }, + { + "move": "e4d5", + "evaluation": [ + -138, + null + ] + }, + { + "move": "e4f5", + "evaluation": [ + -113, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 67, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 86, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + 95, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 96, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 130, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 136, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 138, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 139, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 152, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 156, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 161, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 164, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 167, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 167, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 168, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 176, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 192, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 196, + null + ] + }, + { + "move": "e4g6", + "evaluation": [ + 213, + null + ] + }, + { + "move": "e4h7", + "evaluation": [ + 222, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 245, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 270, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 288, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 290, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 328, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 351, + null + ] + }, + { + "move": "d2c3", + "evaluation": [ + 378, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "d3e4", + "evaluation": [ + -275, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 116, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 137, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 149, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + 153, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 247, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 275, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 275, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 292, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 304, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 304, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 305, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 308, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 309, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 311, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 326, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 328, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 330, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 333, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 336, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 336, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 366, + null + ] + }, + { + "move": "d2c3", + "evaluation": [ + 381, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + 390, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 415, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 584, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 664, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 780, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 944, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1148, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "c3e4", + "evaluation": [ + -216, + null + ] + }, + { + "move": "d3e4", + "evaluation": [ + -12, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 324, + null + ] + }, + { + "move": "c3e2", + "evaluation": [ + 499, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 574, + null + ] + }, + { + "move": "c3b5", + "evaluation": [ + 592, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 592, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 592, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 610, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 644, + null + ] + }, + { + "move": "c3d5", + "evaluation": [ + 667, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 680, + null + ] + }, + { + "move": "c3a4", + "evaluation": [ + 682, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 685, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 689, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 697, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 724, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 726, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 734, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 751, + null + ] + }, + { + "move": "c3a2", + "evaluation": [ + 774, + null + ] + }, + { + "move": "c3b1", + "evaluation": [ + 786, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 800, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 806, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 822, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 826, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 862, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 893, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 930, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 1009, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 1023, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1253, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 1591, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 1649, + null + ] + } + ], + "strict": true + } + }, + "is_complete": true + }, + { + "puzzle": { + "game_id": "2", + "category": "Material", + "last_pos": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p5/4P3/1P3QPq/2P1RP1P/R5K1 w - - 2 24", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 24, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "34": "p", + "28": "P", + "23": "q", + "22": "P", + "21": "Q", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "last_move": "f3f5", + "move_list": [ + "h3f5", + "e4f5", + "e8e2", + "c2c4" + ], + "positions": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2Q2/4P3/1P4Pq/2P1RP1P/R5K1 b - - 3 24", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 24, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "Q", + "34": "p", + "28": "P", + "23": "q", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "h3f5", + "ponder": "e4f5" + }, + "evaluation": [ + 633, + null + ], + "next_position": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2q2/4P3/1P4P1/2P1RP1P/R5K1 w - - 0 25", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 25, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "q", + "34": "p", + "28": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "e4f5", + "ponder": "e8e2" + }, + "evaluation": [ + -685, + null + ], + "next_position": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1RP1P/R5K1 b - - 0 25", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 25, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e8e2", + "ponder": "c2c4" + }, + "evaluation": [ + 673, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1rP1P/R5K1 w - - 0 26", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 26, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "r", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "c2c4", + "ponder": "g8f8" + }, + "evaluation": [ + -618, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/4rP1P/R5K1 b - - 0 26", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 26, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2", + "c2c4" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "26": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "r", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e2b2", + "ponder": "a1a3" + }, + "evaluation": [ + 628, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/1r3P1P/R5K1 w - - 1 27", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 27, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2", + "c2c4", + "e2b2" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "26": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "9": "r", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": null, + "evaluation": null, + "next_position": null, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e2b2", + "evaluation": [ + -616, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + -615, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + -615, + null + ] + }, + { + "move": "e2c2", + "evaluation": [ + -600, + null + ] + }, + { + "move": "e2d2", + "evaluation": [ + -594, + null + ] + }, + { + "move": "f7f6", + "evaluation": [ + -593, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + -592, + null + ] + }, + { + "move": "a7a5", + "evaluation": [ + -584, + null + ] + }, + { + "move": "c7c6", + "evaluation": [ + -576, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + -572, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + -571, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + -568, + null + ] + }, + { + "move": "e2e4", + "evaluation": [ + -568, + null + ] + }, + { + "move": "d6d5", + "evaluation": [ + -568, + null + ] + }, + { + "move": "e2e5", + "evaluation": [ + -565, + null + ] + }, + { + "move": "e2e8", + "evaluation": [ + -545, + null + ] + }, + { + "move": "a7a6", + "evaluation": [ + -542, + null + ] + }, + { + "move": "e2e7", + "evaluation": [ + -534, + null + ] + }, + { + "move": "b6a5", + "evaluation": [ + 43, + null + ] + }, + { + "move": "e2e6", + "evaluation": [ + 124, + null + ] + }, + { + "move": "e2f2", + "evaluation": [ + 157, + null + ] + }, + { + "move": "e2e3", + "evaluation": [ + 238, + null + ] + }, + { + "move": "e2a2", + "evaluation": [ + 254, + null + ] + }, + { + "move": "e2e1", + "evaluation": [ + 258, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e8e2", + "evaluation": [ + -623, + null + ] + }, + { + "move": "e8f8", + "evaluation": [ + 247, + null + ] + }, + { + "move": "e8c8", + "evaluation": [ + 258, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + 266, + null + ] + }, + { + "move": "e8d8", + "evaluation": [ + 269, + null + ] + }, + { + "move": "e8b8", + "evaluation": [ + 273, + null + ] + }, + { + "move": "e8a8", + "evaluation": [ + 291, + null + ] + }, + { + "move": "e8e5", + "evaluation": [ + 328, + null + ] + }, + { + "move": "e8e4", + "evaluation": [ + 782, + null + ] + }, + { + "move": "e8e6", + "evaluation": [ + 795, + null + ] + }, + { + "move": "e8e3", + "evaluation": [ + 800, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + 801, + null + ] + }, + { + "move": "e8e7", + "evaluation": [ + 812, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + 852, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + 856, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + 881, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "b6a5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "c7c6", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "a7a6", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "d6d5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "c5c4", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "a7a5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "f7f6", + "evaluation": [ + null, + 3 + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "h3f5", + "evaluation": [ + -642, + null + ] + }, + { + "move": "h3h6", + "evaluation": [ + 203, + null + ] + }, + { + "move": "h3g3", + "evaluation": [ + 1327, + null + ] + }, + { + "move": "h3h2", + "evaluation": [ + 1335, + null + ] + }, + { + "move": "h3h4", + "evaluation": [ + 1393, + null + ] + }, + { + "move": "c5c4", + "evaluation": [ + 1403, + null + ] + }, + { + "move": "e8e6", + "evaluation": [ + 1421, + null + ] + }, + { + "move": "e8e7", + "evaluation": [ + 1424, + null + ] + }, + { + "move": "h3g4", + "evaluation": [ + 1424, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h3h5", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h3f1", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "e8e5", + "evaluation": [ + 1432, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + 1432, + null + ] + }, + { + "move": "e8a8", + "evaluation": [ + 1439, + null + ] + }, + { + "move": "e8f8", + "evaluation": [ + 1440, + null + ] + }, + { + "move": "a7a5", + "evaluation": [ + 1442, + null + ] + }, + { + "move": "b6a5", + "evaluation": [ + 1444, + null + ] + }, + { + "move": "e8b8", + "evaluation": [ + 1445, + null + ] + }, + { + "move": "h3g2", + "evaluation": [ + 1447, + null + ] + }, + { + "move": "d6d5", + "evaluation": [ + 1453, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + 1460, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + 1501, + null + ] + }, + { + "move": "a7a6", + "evaluation": [ + 1511, + null + ] + }, + { + "move": "f7f6", + "evaluation": [ + 1516, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + 1530, + null + ] + }, + { + "move": "c7c6", + "evaluation": [ + 1776, + null + ] + }, + { + "move": "e8d8", + "evaluation": [ + 1794, + null + ] + }, + { + "move": "e8e4", + "evaluation": [ + 1958, + null + ] + }, + { + "move": "e8c8", + "evaluation": [ + 2108, + null + ] + } + ], + "strict": true + } + }, + "is_complete": true + } +] \ No newline at end of file diff --git a/test/unit/regression.py b/test/unit/regression.py new file mode 100644 index 0000000..89f1e70 --- /dev/null +++ b/test/unit/regression.py @@ -0,0 +1,50 @@ +import json +import logging +import sys +import unittest + +from modules.decoding import score_from_dict, board_from_dict +from modules.investigate.investigate import investigate + +INVESTIGATE_FILE = '../data/investigate.json' +IS_COMPLETE_FILE = '../data/is_complete.json' + + +def configure_logger(): + logging.basicConfig(format="%(message)s", level="DEBUG", stream=sys.stdout) + logging.getLogger("chess.uci").setLevel(logging.WARNING) + logging.getLogger("chess._engine").setLevel(logging.WARNING) + + +configure_logger() + + +class TestRegression(unittest.TestCase): + engine = None + investigate_test_data = [] + complete_test_data = [] + + @classmethod + def setUpClass(cls): + with open(INVESTIGATE_FILE, 'r') as f: + content = f.read() + TestRegression.investigate_test_data = json.loads(content) + + with open(IS_COMPLETE_FILE, 'r') as f: + content = f.read() + TestRegression.complete_test_data = json.loads(content) + + def test_investigate(self): + """ + Go through known investigate arguments and results and see if the actual result is the same. + :return: + """ + for definition in TestRegression.investigate_test_data: + score_a, score_b = score_from_dict(definition["score_a"]), score_from_dict(definition["score_b"]) + expected_result = definition["result"] + board = board_from_dict(definition["board"]) + logging.debug(f"Testing position {board.fen()} with scores {score_a} and {score_b}") + + result = investigate(score_a, score_b, board) + + self.assertEqual(expected_result, result) From d91cb527c06a74da850f56e8c20cda19d958d89c Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Mon, 31 May 2021 17:29:34 +0200 Subject: [PATCH 4/8] Switch decoding/encoding to v1.5 of API --- main.py | 2 +- modules/decoding.py | 39 ++++++++++++++-- modules/encoding.py | 4 +- positions_for_investigation.py | 83 ++++++++++++++++++++-------------- 4 files changed, 88 insertions(+), 40 deletions(-) diff --git a/main.py b/main.py index b00f1fd..0e718ef 100755 --- a/main.py +++ b/main.py @@ -63,7 +63,6 @@ def prepare_settings(): pass logging.basicConfig(format="%(message)s", level=settings.loglevel, stream=sys.stdout) -logging.getLogger("requests.packages.urllib3").setLevel(logging.WARNING) logging.getLogger("chess.engine").setLevel(logging.WARNING) engine = chess.engine.SimpleEngine.popen_uci(stockfish_command()) @@ -96,6 +95,7 @@ def prepare_settings(): logging.debug(bcolors.OKGREEN + node.board().san(next_node.move) + bcolors.ENDC) logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.score())) logging.debug(" Mate: " + str(cur_score.mate()) + bcolors.ENDC) + if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append(puzzle(node.board(), next_node.move, str(game_id), engine, info, game, settings.strict)) diff --git a/modules/decoding.py b/modules/decoding.py index e3104bc..75980ed 100644 --- a/modules/decoding.py +++ b/modules/decoding.py @@ -1,11 +1,9 @@ import chess from chess import Move, Board -from chess.engine import Cp, Mate +from chess.engine import Cp, Mate, BestMove from chess.uci import Score -# -# def move_from_dict(d: dict) -> Move: -# return m.uci() if m else None +from modules.puzzle.position_list import position_list def score_from_dict(d) -> Score: @@ -21,3 +19,36 @@ def score_from_dict(d) -> Score: def board_from_dict(d: dict) -> Board: board = chess.Board(d['fen']) return board + + +def move_from_str(s: str) -> Move: + return Move.from_uci(s) if s else None + + +def bestmove_from_dict(d: dict) -> BestMove: + return BestMove(move_from_str(d['move']), move_from_str(d['ponder'])) if d else None + + +def positionlist_from_dict(d: dict) -> position_list: + """ + 'position': board_to_dict(pl.position), + 'player_turn': pl.player_turn, + 'best_move': bestmove_to_dict(pl.best_move), + 'evaluation': score_to_dict(pl.evaluation), + 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, + 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], + 'strict': pl.strict + + """ + result = position_list(position=board_from_dict(d['position']), + engine=None, + info_handler=None, + player_turn=d['player_turn'], + best_move=bestmove_from_dict(d['best_move']), + evaluation=score_from_dict(d['evaluation']), + strict=d['strict']) + + # 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, + # 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], + + return result diff --git a/modules/encoding.py b/modules/encoding.py index 35a74b6..698c693 100644 --- a/modules/encoding.py +++ b/modules/encoding.py @@ -10,7 +10,7 @@ def move_to_dict(m: Move) -> dict: def bestmove_to_dict(bm: BestMove) -> dict: return { - 'move': move_to_dict(bm.bestmove), + 'move': move_to_dict(bm.move), 'ponder': move_to_dict(bm.ponder) } if bm else None @@ -38,7 +38,7 @@ def piecemap_to_dict(pm) -> dict: def score_to_dict(score: Score): - return [score.cp, score.mate] if score else None + return [score.score(), score.mate()] if score else None def positionlist_to_dict(pl: position_list) -> dict: diff --git a/positions_for_investigation.py b/positions_for_investigation.py index 48bac49..1e280e4 100644 --- a/positions_for_investigation.py +++ b/positions_for_investigation.py @@ -5,29 +5,51 @@ import logging import sys +import chess.engine import chess.pgn -import chess.uci from modules.bcolors.bcolors import bcolors -from modules.encoding import puzzle_to_dict, board_to_dict +from modules.encoding import puzzle_to_dict, board_to_dict, score_to_dict from modules.fishnet.fishnet import stockfish_command from modules.investigate.investigate import investigate from modules.puzzle.puzzle import puzzle -# from position_list_to import PositionList -parser = argparse.ArgumentParser(description=__doc__) - -parser.add_argument("--threads", metavar="THREADS", nargs="?", type=int, default=4, help="number of engine threads") -parser.add_argument("--memory", metavar="MEMORY", nargs="?", type=int, default=2048, - help="memory in MB to use for engine hashtables") -parser.add_argument("--depth", metavar="DEPTH", nargs="?", type=int, default=8, help="depth for stockfish analysis") -parser.add_argument("--quiet", dest="loglevel", default=logging.DEBUG, action="store_const", const=logging.INFO, - help="substantially reduce the number of logged messages") -parser.add_argument("--games", metavar="GAMES", default="games.pgn", help="A specific pgn with games") -parser.add_argument("--strict", metavar="STRICT", default=True, - help="If False then it will be generate more tactics but maybe a little ambiguous") -settings = parser.parse_args() +def str2bool(v): + if isinstance(v, bool): + return v + if v.lower() in ('yes', 'true', 't', 'y', '1'): + return True + elif v.lower() in ('no', 'false', 'f', 'n', '0'): + return False + else: + raise argparse.ArgumentTypeError('Boolean value expected.') + + +def prepare_settings(): + parser = argparse.ArgumentParser(description=__doc__) + + parser.add_argument("--threads", metavar="THREADS", nargs="?", type=int, default=4, + help="number of engine threads") + parser.add_argument("--memory", metavar="MEMORY", nargs="?", type=int, default=2048, + help="memory in MB to use for engine hashtables") + parser.add_argument("--depth", metavar="DEPTH", nargs="?", type=int, default=8, + help="depth for stockfish analysis") + parser.add_argument("--quiet", dest="loglevel", + default=logging.DEBUG, action="store_const", const=logging.INFO, + help="substantially reduce the number of logged messages") + parser.add_argument("--games", metavar="GAMES", default="games.pgn", + help="A specific pgn with games") + parser.add_argument("--strict", metavar="STRICT", default=True, + help="If False then it will be generate more tactics but maybe a little ambiguous") + parser.add_argument("--includeBlunder", metavar="INCLUDE_BLUNDER", default=True, + type=str2bool, const=True, dest="include_blunder", nargs="?", + help="If False then generated puzzles won't include initial blunder move") + + return parser.parse_args() + + +settings = prepare_settings() try: # Optionally fix colors on Windows and in journals if the colorama module # is available. @@ -40,15 +62,10 @@ pass logging.basicConfig(format="%(message)s", level=settings.loglevel, stream=sys.stdout) -logging.getLogger("requests.packages.urllib3").setLevel(logging.WARNING) -logging.getLogger("chess.uci").setLevel(logging.WARNING) -logging.getLogger("chess._engine").setLevel(logging.WARNING) +logging.getLogger("chess.engine").setLevel(logging.WARNING) -engine = chess.uci.popen_engine(stockfish_command()) -engine.setoption({'Threads': settings.threads, 'Hash': settings.memory}) -engine.uci() -info_handler = chess.uci.InfoHandler() -engine.info_handlers.append(info_handler) +engine = chess.engine.SimpleEngine.popen_uci(stockfish_command()) +engine.configure({'Threads': settings.threads, 'Hash': settings.memory}) all_games = open(settings.games, "r") @@ -73,34 +90,32 @@ def write_test_data(filename: str, payload: str): logging.debug(bcolors.WARNING + "Game ID: " + str(game_id) + bcolors.ENDC) logging.debug(bcolors.WARNING + "Game headers: " + str(game) + bcolors.ENDC) - prev_score = chess.uci.Score(None, None) + prev_score = chess.engine.Cp(0) puzzles = [] logging.debug("Analysing Game..." + bcolors.ENDC) - engine.ucinewgame() - # find candidates (positions) while not node.is_end(): next_node = node.variation(0) - engine.position(next_node.board()) + info = engine.analyse(next_node.board(), chess.engine.Limit(depth=settings.depth)) - engine.go(depth=settings.depth) - cur_score = info_handler.info["score"][1] + cur_score = info["score"].relative logging.debug(bcolors.OKGREEN + node.board().san(next_node.move) + bcolors.ENDC) - logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.cp)) - logging.debug(" Mate: " + str(cur_score.mate) + bcolors.ENDC) + logging.debug(bcolors.OKBLUE + " CP: " + str(cur_score.score())) + logging.debug(" Mate: " + str(cur_score.mate()) + bcolors.ENDC) result = investigate(prev_score, cur_score, node.board()) if result: logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append( - puzzle(node.board(), next_node.move, str(game_id), engine, info_handler, game, settings.strict)) + puzzle(node.board(), next_node.move, str(game_id), engine, None, game, settings.strict)) # save the data for investigate() testing investigate_test_data.append( - {'score_a': prev_score, 'score_b': cur_score, 'board': board_to_dict(node.board(), True), 'result': result}) + {'score_a': score_to_dict(prev_score), 'score_b': score_to_dict(cur_score), + 'board': board_to_dict(node.board(), True), 'result': result}) prev_score = cur_score node = next_node @@ -118,3 +133,5 @@ def write_test_data(filename: str, payload: str): # dump the test data to files write_test_data('investigate.json', json.dumps(investigate_test_data, indent=2)) write_test_data('is_complete.json', json.dumps(complete_test_data, indent=2)) + +engine.quit() \ No newline at end of file From 139fef6269fde33109f7eafcabfc8dba83648e62 Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Mon, 31 May 2021 19:20:05 +0200 Subject: [PATCH 5/8] Add initial version of ambiguous() test --- modules/decoding.py | 35 +++++++++++++------- modules/encoding.py | 4 +-- positions_for_investigation.py | 3 +- test/unit/regression.py | 58 +++++++++++++++++++++++++++++++++- 4 files changed, 84 insertions(+), 16 deletions(-) diff --git a/modules/decoding.py b/modules/decoding.py index 75980ed..05d1d21 100644 --- a/modules/decoding.py +++ b/modules/decoding.py @@ -3,7 +3,9 @@ from chess.engine import Cp, Mate, BestMove from chess.uci import Score +from modules.puzzle.analysed import analysed from modules.puzzle.position_list import position_list +from modules.puzzle.puzzle import puzzle def score_from_dict(d) -> Score: @@ -29,17 +31,11 @@ def bestmove_from_dict(d: dict) -> BestMove: return BestMove(move_from_str(d['move']), move_from_str(d['ponder'])) if d else None +def analyzed_from_dict(d: dict) -> analysed: + return analysed(move_from_str(d['move']), score_from_dict(d['evaluation'])) + + def positionlist_from_dict(d: dict) -> position_list: - """ - 'position': board_to_dict(pl.position), - 'player_turn': pl.player_turn, - 'best_move': bestmove_to_dict(pl.best_move), - 'evaluation': score_to_dict(pl.evaluation), - 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, - 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], - 'strict': pl.strict - - """ result = position_list(position=board_from_dict(d['position']), engine=None, info_handler=None, @@ -48,7 +44,22 @@ def positionlist_from_dict(d: dict) -> position_list: evaluation=score_from_dict(d['evaluation']), strict=d['strict']) - # 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, - # 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], + result.next_position = positionlist_from_dict(d['next_position']) if d['next_position'] else None + result.analysed_legals = [analyzed_from_dict(al) for al in d['analysed_legals']] + + return result + + +def puzzle_from_dict(d: dict) -> puzzle: + result = puzzle( + last_pos=board_from_dict(d['last_pos']), + last_move=move_from_str(d['last_move']), + game_id=d['last_move'], + engine=None, + info_handler=None, + game=None, + strict=True + ) + result.positions = positionlist_from_dict(d['positions']) return result diff --git a/modules/encoding.py b/modules/encoding.py index 698c693..f941ecf 100644 --- a/modules/encoding.py +++ b/modules/encoding.py @@ -1,7 +1,7 @@ from chess import Move, Board from chess.uci import BestMove, Score -from modules.puzzle import position_list +from modules.puzzle import position_list, puzzle def move_to_dict(m: Move) -> dict: @@ -60,7 +60,7 @@ def analyzed_to_dict(a): } -def puzzle_to_dict(p): +def puzzle_to_dict(p: puzzle): return { 'game_id': p.game_id, 'category': p.positions.category(), diff --git a/positions_for_investigation.py b/positions_for_investigation.py index 1e280e4..eee3e43 100644 --- a/positions_for_investigation.py +++ b/positions_for_investigation.py @@ -126,7 +126,8 @@ def write_test_data(filename: str, payload: str): i.generate(settings.depth) is_complete = i.is_complete() - logging.info(f'{i.last_pos.fen()} -- {is_complete}') + is_ambiguous = i.positions.ambiguous() + logging.info(f'{i.last_pos.fen()} -- {is_complete}, {is_ambiguous}') if is_complete: complete_test_data.append({'puzzle': puzzle_to_dict(i), 'is_complete': is_complete}) diff --git a/test/unit/regression.py b/test/unit/regression.py index 45c5f31..40dabab 100644 --- a/test/unit/regression.py +++ b/test/unit/regression.py @@ -3,7 +3,7 @@ import sys import unittest -from modules.decoding import score_from_dict, board_from_dict +from modules.decoding import score_from_dict, board_from_dict, puzzle_from_dict from modules.investigate.investigate import investigate INVESTIGATE_FILE = '../data/investigate.json' @@ -49,3 +49,59 @@ def test_investigate(self): logging.debug(f'{expected_result} vs {result}') self.assertEqual(expected_result, result) + + def test_mambigos(self): + """ + Go through known ambigous() arguments (position_list class) + and results and see if the actual result is the same. + :return: + """ + for definition in TestRegression.complete_test_data: + logging.debug(f"Testing puzzle {definition}") + + expected_result = definition['is_complete'] + + pd = definition['puzzle'] + puzzle = puzzle_from_dict(pd) + result = puzzle.positions.ambiguous() + + logging.debug(f'{expected_result} vs {result}') + self.assertEqual(expected_result, result) + + def test_positions_move_list(self): + """ + Go through known move_list() results (position_list class) + if the actual result is the same. + :return: + """ + for definition in TestRegression.complete_test_data: + logging.debug(f"Testing puzzle {definition}") + + pd = definition['puzzle'] + puzzle = puzzle_from_dict(pd) + result = puzzle.positions.move_list() + + expected_result = pd['move_list'] + + logging.debug(f'{expected_result} vs {result}') + self.assertEqual(expected_result, result) + # KZL XXX TODO: + # the following move_list() returns ['c3e4', 'c6e4', 'd3e4', 'd7d5', 'e4d3'] + # while 'original' values are ['c3e4', 'c6e4', 'd3e4', 'd7d5'] + # verify if is_game_over() is returned properly; or ambigous + + def test_is_complete(self): + """ + :return: + """ + for definition in TestRegression.complete_test_data: + logging.debug(f"Testing puzzle {definition}") + + expected_result = definition['is_complete'] + + pd = definition['puzzle'] + puzzle = puzzle_from_dict(pd) + result = puzzle.is_complete() + + logging.debug(f'{expected_result} vs {result}') + self.assertEqual(expected_result, result) From afd3e45dff65416637a2d14a17eb522bdaf12f4f Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Tue, 1 Jun 2021 13:44:38 +0200 Subject: [PATCH 6/8] Restructure to allow running the test from the commandline --- .gitignore | 2 + test/data/is_complete.0.1.json | 2455 +++++++++++++++++ test/data/is_complete.json | 1930 ++++++++++--- test/unit/test.log | 13 - test/unit/test_investigate.py | 148 - .../{regression.py => test_regression.py} | 9 +- 6 files changed, 4056 insertions(+), 501 deletions(-) create mode 100644 test/data/is_complete.0.1.json delete mode 100644 test/unit/test.log delete mode 100644 test/unit/test_investigate.py rename test/unit/{regression.py => test_regression.py} (94%) diff --git a/.gitignore b/.gitignore index 9e8b7fa..8725a78 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ venv .idea/ .venv .DS_Store +*.priv +*.priv.* diff --git a/test/data/is_complete.0.1.json b/test/data/is_complete.0.1.json new file mode 100644 index 0000000..688159d --- /dev/null +++ b/test/data/is_complete.0.1.json @@ -0,0 +1,2455 @@ +[ + { + "puzzle": { + "game_id": "1", + "category": "Material", + "last_pos": { + "fen": "r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2PB1PPP/R2Q1RK1 b kq - 2 12", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 12, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "45": "n", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "P", + "27": "b", + "25": "P", + "19": "B", + "18": "N", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "last_move": "f6e4", + "move_list": [ + "c3e4", + "c6e4", + "d3e4", + "d7d5" + ], + "positions": { + "position": { + "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bn3/P1NB4/2PB1PPP/R2Q1RK1 w kq - 0 13", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 13, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "n", + "27": "b", + "25": "P", + "19": "B", + "18": "N", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "c3e4", + "ponder": "c6e4" + }, + "evaluation": [ + 344, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bN3/P2B4/2PB1PPP/R2Q1RK1 b kq - 0 13", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 13, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "42": "b", + "41": "q", + "40": "p", + "33": "p", + "28": "N", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "c6e4", + "ponder": "d3e4" + }, + "evaluation": [ + -204, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bb3/P2B4/2PB1PPP/R2Q1RK1 w kq - 0 14", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 14, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "41": "q", + "40": "p", + "33": "p", + "28": "b", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "d3e4", + "ponder": "d7d5" + }, + "evaluation": [ + 313, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bB3/P7/2PB1PPP/R2Q1RK1 b kq - 0 14", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 14, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "p", + "44": "p", + "41": "q", + "40": "p", + "33": "p", + "28": "B", + "27": "b", + "25": "P", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "d7d5", + "ponder": "c2c3" + }, + "evaluation": [ + -231, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1bB3/P7/2PB1PPP/R2Q1RK1 w kq - 0 15", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 15, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4", + "d7d5" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "44": "p", + "41": "q", + "40": "p", + "35": "p", + "33": "p", + "28": "B", + "27": "b", + "25": "P", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e4d3", + "ponder": "d4a1" + }, + "evaluation": [ + 279, + null + ], + "next_position": { + "position": { + "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1b4/P2B4/2PB1PPP/R2Q1RK1 b kq - 1 15", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 15, + "move_stack": [ + "e2e4", + "c7c5", + "g1f3", + "e7e6", + "b1c3", + "a7a6", + "d2d4", + "b7b5", + "d4c5", + "f8c5", + "f1d3", + "d8b6", + "e1g1", + "c8b7", + "f3e5", + "g8f6", + "a2a3", + "b8c6", + "e5c6", + "b7c6", + "b2b4", + "c5d4", + "c1d2", + "f6e4", + "c3e4", + "c6e4", + "d3e4", + "d7d5", + "e4d3" + ], + "uci_variant": "chess", + "piece_map": { + "63": "r", + "60": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "44": "p", + "41": "q", + "40": "p", + "35": "p", + "33": "p", + "27": "b", + "25": "P", + "19": "B", + "16": "P", + "15": "P", + "14": "P", + "13": "P", + "11": "B", + "10": "P", + "6": "K", + "5": "R", + "3": "Q", + "0": "R" + } + }, + "player_turn": false, + "best_move": null, + "evaluation": null, + "next_position": null, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e4d3", + "evaluation": [ + -282, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + -261, + null + ] + }, + { + "move": "e4f3", + "evaluation": [ + -188, + null + ] + }, + { + "move": "e4d5", + "evaluation": [ + -138, + null + ] + }, + { + "move": "e4f5", + "evaluation": [ + -113, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 67, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 86, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + 95, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 96, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 130, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 136, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 138, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 139, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 152, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 156, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 161, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 164, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 167, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 167, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 168, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 176, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 192, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 196, + null + ] + }, + { + "move": "e4g6", + "evaluation": [ + 213, + null + ] + }, + { + "move": "e4h7", + "evaluation": [ + 222, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 245, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 270, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 288, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 290, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 328, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 351, + null + ] + }, + { + "move": "d2c3", + "evaluation": [ + 378, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "d3e4", + "evaluation": [ + -275, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 116, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 137, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 149, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + 153, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 247, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 275, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 275, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 292, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 304, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 304, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 305, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 308, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 309, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 311, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 326, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 328, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 330, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 333, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 336, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 336, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 366, + null + ] + }, + { + "move": "d2c3", + "evaluation": [ + 381, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + 390, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 415, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 584, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 664, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 780, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 944, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1148, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "c3e4", + "evaluation": [ + -216, + null + ] + }, + { + "move": "d3e4", + "evaluation": [ + -12, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 324, + null + ] + }, + { + "move": "c3e2", + "evaluation": [ + 499, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 574, + null + ] + }, + { + "move": "c3b5", + "evaluation": [ + 592, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 592, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 592, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 610, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 644, + null + ] + }, + { + "move": "c3d5", + "evaluation": [ + 667, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 680, + null + ] + }, + { + "move": "c3a4", + "evaluation": [ + 682, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 685, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 689, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 697, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 724, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 726, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 734, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 751, + null + ] + }, + { + "move": "c3a2", + "evaluation": [ + 774, + null + ] + }, + { + "move": "c3b1", + "evaluation": [ + 786, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 800, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 806, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 822, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 826, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 862, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 893, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 930, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 1009, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 1023, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1253, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 1591, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 1649, + null + ] + } + ], + "strict": true + } + }, + "is_complete": true + }, + { + "puzzle": { + "game_id": "2", + "category": "Material", + "last_pos": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p5/4P3/1P3QPq/2P1RP1P/R5K1 w - - 2 24", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 24, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "34": "p", + "28": "P", + "23": "q", + "22": "P", + "21": "Q", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "last_move": "f3f5", + "move_list": [ + "h3f5", + "e4f5", + "e8e2", + "c2c4" + ], + "positions": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2Q2/4P3/1P4Pq/2P1RP1P/R5K1 b - - 3 24", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 24, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "Q", + "34": "p", + "28": "P", + "23": "q", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "h3f5", + "ponder": "e4f5" + }, + "evaluation": [ + 633, + null + ], + "next_position": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2q2/4P3/1P4P1/2P1RP1P/R5K1 w - - 0 25", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 25, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "q", + "34": "p", + "28": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "e4f5", + "ponder": "e8e2" + }, + "evaluation": [ + -685, + null + ], + "next_position": { + "position": { + "fen": "4r1k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1RP1P/R5K1 b - - 0 25", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 25, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "R", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e8e2", + "ponder": "c2c4" + }, + "evaluation": [ + 673, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1rP1P/R5K1 w - - 0 26", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 26, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "r", + "10": "P", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "c2c4", + "ponder": "g8f8" + }, + "evaluation": [ + -618, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/4rP1P/R5K1 b - - 0 26", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 26, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2", + "c2c4" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "26": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "12": "r", + "6": "K", + "0": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "e2b2", + "ponder": "a1a3" + }, + "evaluation": [ + 628, + null + ], + "next_position": { + "position": { + "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/1r3P1P/R5K1 w - - 1 27", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 27, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "b2b3", + "e6h3", + "d1f3", + "a8e8", + "a2a4", + "c6c5", + "a4a5", + "e5c3", + "e1e2", + "c3a5", + "b1a1", + "a5b6", + "f3f5", + "h3f5", + "e4f5", + "e8e2", + "c2c4", + "e2b2" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "43": "p", + "41": "b", + "37": "P", + "34": "p", + "26": "P", + "22": "P", + "17": "P", + "15": "P", + "13": "P", + "9": "r", + "6": "K", + "0": "R" + } + }, + "player_turn": false, + "best_move": null, + "evaluation": null, + "next_position": null, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e2b2", + "evaluation": [ + -616, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + -615, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + -615, + null + ] + }, + { + "move": "e2c2", + "evaluation": [ + -600, + null + ] + }, + { + "move": "e2d2", + "evaluation": [ + -594, + null + ] + }, + { + "move": "f7f6", + "evaluation": [ + -593, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + -592, + null + ] + }, + { + "move": "a7a5", + "evaluation": [ + -584, + null + ] + }, + { + "move": "c7c6", + "evaluation": [ + -576, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + -572, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + -571, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + -568, + null + ] + }, + { + "move": "e2e4", + "evaluation": [ + -568, + null + ] + }, + { + "move": "d6d5", + "evaluation": [ + -568, + null + ] + }, + { + "move": "e2e5", + "evaluation": [ + -565, + null + ] + }, + { + "move": "e2e8", + "evaluation": [ + -545, + null + ] + }, + { + "move": "a7a6", + "evaluation": [ + -542, + null + ] + }, + { + "move": "e2e7", + "evaluation": [ + -534, + null + ] + }, + { + "move": "b6a5", + "evaluation": [ + 43, + null + ] + }, + { + "move": "e2e6", + "evaluation": [ + 124, + null + ] + }, + { + "move": "e2f2", + "evaluation": [ + 157, + null + ] + }, + { + "move": "e2e3", + "evaluation": [ + 238, + null + ] + }, + { + "move": "e2a2", + "evaluation": [ + 254, + null + ] + }, + { + "move": "e2e1", + "evaluation": [ + 258, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "e8e2", + "evaluation": [ + -623, + null + ] + }, + { + "move": "e8f8", + "evaluation": [ + 247, + null + ] + }, + { + "move": "e8c8", + "evaluation": [ + 258, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + 266, + null + ] + }, + { + "move": "e8d8", + "evaluation": [ + 269, + null + ] + }, + { + "move": "e8b8", + "evaluation": [ + 273, + null + ] + }, + { + "move": "e8a8", + "evaluation": [ + 291, + null + ] + }, + { + "move": "e8e5", + "evaluation": [ + 328, + null + ] + }, + { + "move": "e8e4", + "evaluation": [ + 782, + null + ] + }, + { + "move": "e8e6", + "evaluation": [ + 795, + null + ] + }, + { + "move": "e8e3", + "evaluation": [ + 800, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + 801, + null + ] + }, + { + "move": "e8e7", + "evaluation": [ + 812, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + 852, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + 856, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + 881, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "b6a5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "c7c6", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "a7a6", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "d6d5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "c5c4", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "a7a5", + "evaluation": [ + null, + 1 + ] + }, + { + "move": "f7f6", + "evaluation": [ + null, + 3 + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "h3f5", + "evaluation": [ + -642, + null + ] + }, + { + "move": "h3h6", + "evaluation": [ + 203, + null + ] + }, + { + "move": "h3g3", + "evaluation": [ + 1327, + null + ] + }, + { + "move": "h3h2", + "evaluation": [ + 1335, + null + ] + }, + { + "move": "h3h4", + "evaluation": [ + 1393, + null + ] + }, + { + "move": "c5c4", + "evaluation": [ + 1403, + null + ] + }, + { + "move": "e8e6", + "evaluation": [ + 1421, + null + ] + }, + { + "move": "e8e7", + "evaluation": [ + 1424, + null + ] + }, + { + "move": "h3g4", + "evaluation": [ + 1424, + null + ] + }, + { + "move": "g8h8", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h3h5", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h3f1", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "h7h6", + "evaluation": [ + 1431, + null + ] + }, + { + "move": "e8e5", + "evaluation": [ + 1432, + null + ] + }, + { + "move": "g7g6", + "evaluation": [ + 1432, + null + ] + }, + { + "move": "e8a8", + "evaluation": [ + 1439, + null + ] + }, + { + "move": "e8f8", + "evaluation": [ + 1440, + null + ] + }, + { + "move": "a7a5", + "evaluation": [ + 1442, + null + ] + }, + { + "move": "b6a5", + "evaluation": [ + 1444, + null + ] + }, + { + "move": "e8b8", + "evaluation": [ + 1445, + null + ] + }, + { + "move": "h3g2", + "evaluation": [ + 1447, + null + ] + }, + { + "move": "d6d5", + "evaluation": [ + 1453, + null + ] + }, + { + "move": "g7g5", + "evaluation": [ + 1460, + null + ] + }, + { + "move": "h7h5", + "evaluation": [ + 1501, + null + ] + }, + { + "move": "a7a6", + "evaluation": [ + 1511, + null + ] + }, + { + "move": "f7f6", + "evaluation": [ + 1516, + null + ] + }, + { + "move": "g8f8", + "evaluation": [ + 1530, + null + ] + }, + { + "move": "c7c6", + "evaluation": [ + 1776, + null + ] + }, + { + "move": "e8d8", + "evaluation": [ + 1794, + null + ] + }, + { + "move": "e8e4", + "evaluation": [ + 1958, + null + ] + }, + { + "move": "e8c8", + "evaluation": [ + 2108, + null + ] + } + ], + "strict": true + } + }, + "is_complete": true + } +] \ No newline at end of file diff --git a/test/data/is_complete.json b/test/data/is_complete.json index 688159d..fd26a0b 100644 --- a/test/data/is_complete.json +++ b/test/data/is_complete.json @@ -146,10 +146,10 @@ "player_turn": true, "best_move": { "move": "c3e4", - "ponder": "c6e4" + "ponder": "e8g8" }, "evaluation": [ - 344, + 328, null ], "next_position": { @@ -225,7 +225,7 @@ "ponder": "d3e4" }, "evaluation": [ - -204, + -283, null ], "next_position": { @@ -301,7 +301,7 @@ "ponder": "d7d5" }, "evaluation": [ - 313, + 283, null ], "next_position": { @@ -374,10 +374,10 @@ "player_turn": false, "best_move": { "move": "d7d5", - "ponder": "c2c3" + "ponder": "e4d3" }, "evaluation": [ - -231, + -251, null ], "next_position": { @@ -454,7 +454,7 @@ "ponder": "d4a1" }, "evaluation": [ - 279, + 255, null ], "next_position": { @@ -535,217 +535,217 @@ }, "analysed_legals": [ { - "move": "e4d3", + "move": "c2c3", "evaluation": [ - -282, + -277, null ] }, { - "move": "c2c3", + "move": "e4d3", "evaluation": [ - -261, + -200, null ] }, { "move": "e4f3", "evaluation": [ - -188, + -197, null ] }, { "move": "e4d5", "evaluation": [ - -138, + -118, null ] }, { "move": "e4f5", "evaluation": [ - -113, + 1, null ] }, { - "move": "d1f3", + "move": "a3a4", "evaluation": [ - 67, + 39, null ] }, { - "move": "a3a4", + "move": "d2e3", "evaluation": [ - 86, + 44, null ] }, { - "move": "c2c4", + "move": "a1c1", "evaluation": [ - 95, + 44, null ] }, { "move": "d1e1", "evaluation": [ - 96, + 56, null ] }, { - "move": "a1c1", + "move": "a1a2", "evaluation": [ - 130, + 118, null ] }, { - "move": "d2e3", + "move": "c2c4", "evaluation": [ - 136, + 119, null ] }, { - "move": "h2h3", + "move": "d1e2", "evaluation": [ - 138, + 133, null ] }, { - "move": "d2g5", + "move": "h2h3", "evaluation": [ - 139, + 134, null ] }, { - "move": "d2f4", + "move": "h2h4", "evaluation": [ - 152, + 134, null ] }, { - "move": "h2h4", + "move": "d1f3", "evaluation": [ - 156, + 137, null ] }, { "move": "d1g4", "evaluation": [ - 161, + 138, null ] }, { - "move": "d1e2", + "move": "d2f4", "evaluation": [ - 164, + 153, null ] }, { - "move": "g1h1", + "move": "d2c1", "evaluation": [ - 167, + 157, null ] }, { "move": "d1c1", "evaluation": [ - 167, + 172, null ] }, { - "move": "d2e1", + "move": "a1b1", "evaluation": [ - 168, + 174, null ] }, { - "move": "g2g3", + "move": "g1h1", "evaluation": [ - 176, + 178, null ] }, { - "move": "g2g4", + "move": "e4h7", "evaluation": [ - 192, + 180, null ] }, { - "move": "a1b1", + "move": "e4g6", "evaluation": [ - 196, + 195, null ] }, { - "move": "e4g6", + "move": "d2h6", "evaluation": [ - 213, + 200, null ] }, { - "move": "e4h7", + "move": "d2e1", "evaluation": [ - 222, + 205, null ] }, { - "move": "d1h5", + "move": "g2g3", "evaluation": [ - 245, + 227, null ] }, { - "move": "a1a2", + "move": "d2g5", "evaluation": [ - 270, + 232, null ] }, { - "move": "d1b1", + "move": "d1h5", "evaluation": [ - 288, + 250, null ] }, { - "move": "d2h6", + "move": "g2g4", "evaluation": [ - 290, + 316, null ] }, { - "move": "f1e1", + "move": "d1b1", "evaluation": [ - 328, + 320, null ] }, { - "move": "d2c1", + "move": "f1e1", "evaluation": [ 351, null @@ -754,224 +754,1499 @@ { "move": "d2c3", "evaluation": [ - 378, + 439, null ] } ], "strict": true }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "d3e4", + "evaluation": [ + -298, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 118, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 147, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + 151, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 180, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 196, + null + ] + }, + { + "move": "d2c3", + "evaluation": [ + 229, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 249, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 258, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 268, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 269, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 274, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 276, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 285, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 291, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 306, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 308, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 314, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 319, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 325, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + 325, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 343, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 347, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 397, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 405, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 633, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 658, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 916, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1150, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 1462, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "c3e4", + "evaluation": [ + -290, + null + ] + }, + { + "move": "d3e4", + "evaluation": [ + -24, + null + ] + }, + { + "move": "d1e1", + "evaluation": [ + 266, + null + ] + }, + { + "move": "c3e2", + "evaluation": [ + 555, + null + ] + }, + { + "move": "c3b5", + "evaluation": [ + 568, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + 578, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + 599, + null + ] + }, + { + "move": "c3a2", + "evaluation": [ + 600, + null + ] + }, + { + "move": "a1c1", + "evaluation": [ + 603, + null + ] + }, + { + "move": "c3b1", + "evaluation": [ + 608, + null + ] + }, + { + "move": "c3a4", + "evaluation": [ + 609, + null + ] + }, + { + "move": "c3d5", + "evaluation": [ + 611, + null + ] + }, + { + "move": "a3a4", + "evaluation": [ + 611, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + 613, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 641, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + 654, + null + ] + }, + { + "move": "d3b5", + "evaluation": [ + 668, + null + ] + }, + { + "move": "d3e2", + "evaluation": [ + 671, + null + ] + }, + { + "move": "d2c1", + "evaluation": [ + 689, + null + ] + }, + { + "move": "a1b1", + "evaluation": [ + 689, + null + ] + }, + { + "move": "a1a2", + "evaluation": [ + 693, + null + ] + }, + { + "move": "d2f4", + "evaluation": [ + 699, + null + ] + }, + { + "move": "d2e1", + "evaluation": [ + 728, + null + ] + }, + { + "move": "d3c4", + "evaluation": [ + 769, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 810, + null + ] + }, + { + "move": "d2g5", + "evaluation": [ + 839, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + 893, + null + ] + }, + { + "move": "d2h6", + "evaluation": [ + 1018, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + 1047, + null + ] + }, + { + "move": "d1b1", + "evaluation": [ + 1094, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + 1151, + null + ] + }, + { + "move": "f1e1", + "evaluation": [ + 1207, + null + ] + }, + { + "move": "g2g3", + "evaluation": [ + 1545, + null + ] + }, + { + "move": "g2g4", + "evaluation": [ + 1678, + null + ] + } + ], + "strict": true + } + }, + "is_complete": true + }, + { + "puzzle": { + "game_id": "2", + "category": "Material", + "last_pos": { + "fen": "r3r1k1/p1pq1ppp/2pp4/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 b - - 4 15", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 15, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "60": "r", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "q", + "50": "p", + "48": "p", + "43": "p", + "42": "p", + "36": "b", + "28": "P", + "24": "N", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "last_move": "e8e6", + "move_list": [ + "a4c5", + "d7e7", + "c5e6", + "e7e6" + ], + "positions": { + "position": { + "fen": "r5k1/p1pq1ppp/2ppr3/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 w - - 5 16", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 16, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "q", + "50": "p", + "48": "p", + "44": "r", + "43": "p", + "42": "p", + "36": "b", + "28": "P", + "24": "N", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "a4c5", + "ponder": "d7e8" + }, + "evaluation": [ + 253, + null + ], + "next_position": { + "position": { + "fen": "r5k1/p1pq1ppp/2ppr3/2N1b3/4P3/6P1/PPP2P1P/1R1QR1K1 b - - 6 16", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 16, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "51": "q", + "50": "p", + "48": "p", + "44": "r", + "43": "p", + "42": "p", + "36": "b", + "34": "N", + "28": "P", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "d7e7", + "ponder": "c5e6" + }, + "evaluation": [ + -234, + null + ], + "next_position": { + "position": { + "fen": "r5k1/p1p1qppp/2ppr3/2N1b3/4P3/6P1/PPP2P1P/1R1QR1K1 w - - 7 17", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 17, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "52": "q", + "50": "p", + "48": "p", + "44": "r", + "43": "p", + "42": "p", + "36": "b", + "34": "N", + "28": "P", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "c5e6", + "ponder": "e7e6" + }, + "evaluation": [ + 255, + null + ], + "next_position": { + "position": { + "fen": "r5k1/p1p1qppp/2ppN3/4b3/4P3/6P1/PPP2P1P/1R1QR1K1 b - - 0 17", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 17, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "52": "q", + "50": "p", + "48": "p", + "44": "N", + "43": "p", + "42": "p", + "36": "b", + "28": "P", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": false, + "best_move": { + "move": "e7e6", + "ponder": "a2a3" + }, + "evaluation": [ + -238, + null + ], + "next_position": { + "position": { + "fen": "r5k1/p1p2ppp/2ppq3/4b3/4P3/6P1/PPP2P1P/1R1QR1K1 w - - 0 18", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 18, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "44": "q", + "43": "p", + "42": "p", + "36": "b", + "28": "P", + "22": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "8": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": true, + "best_move": { + "move": "a2a3", + "ponder": "g7g6" + }, + "evaluation": [ + 270, + null + ], + "next_position": { + "position": { + "fen": "r5k1/p1p2ppp/2ppq3/4b3/4P3/P5P1/1PP2P1P/1R1QR1K1 b - - 0 18", + "aliases": [ + "Standard", + "Chess", + "Classical", + "Normal" + ], + "fullmove_number": 18, + "move_stack": [ + "e2e4", + "e7e5", + "g1f3", + "d7d6", + "d2d4", + "e5d4", + "f3d4", + "b8c6", + "f1b5", + "c8d7", + "b5c6", + "d7c6", + "b1c3", + "g8f6", + "c1g5", + "f8e7", + "g5f6", + "e7f6", + "d4c6", + "b7c6", + "e1g1", + "e8g8", + "f1e1", + "f6e5", + "g2g3", + "d8d7", + "a1b1", + "f8e8", + "c3a4", + "e8e6", + "a4c5", + "d7e7", + "c5e6", + "e7e6", + "a2a3" + ], + "uci_variant": "chess", + "piece_map": { + "62": "k", + "56": "r", + "55": "p", + "54": "p", + "53": "p", + "50": "p", + "48": "p", + "44": "q", + "43": "p", + "42": "p", + "36": "b", + "28": "P", + "22": "P", + "16": "P", + "15": "P", + "13": "P", + "10": "P", + "9": "P", + "6": "K", + "4": "R", + "3": "Q", + "1": "R" + } + }, + "player_turn": false, + "best_move": null, + "evaluation": null, + "next_position": null, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "a2a3", + "evaluation": [ + -236, + null + ] + }, + { + "move": "a2a4", + "evaluation": [ + -228, + null + ] + }, + { + "move": "f2f4", + "evaluation": [ + -227, + null + ] + }, + { + "move": "b2b3", + "evaluation": [ + -207, + null + ] + }, + { + "move": "d1f3", + "evaluation": [ + -184, + null + ] + }, + { + "move": "d1e2", + "evaluation": [ + -183, + null + ] + }, + { + "move": "d1d2", + "evaluation": [ + -172, + null + ] + }, + { + "move": "e1e2", + "evaluation": [ + -168, + null + ] + }, + { + "move": "h2h4", + "evaluation": [ + -166, + null + ] + }, + { + "move": "c2c3", + "evaluation": [ + -157, + null + ] + }, + { + "move": "e1e3", + "evaluation": [ + -148, + null + ] + }, + { + "move": "b2b4", + "evaluation": [ + -146, + null + ] + }, + { + "move": "c2c4", + "evaluation": [ + -140, + null + ] + }, + { + "move": "f2f3", + "evaluation": [ + -133, + null + ] + }, + { + "move": "d1h5", + "evaluation": [ + -130, + null + ] + }, + { + "move": "g1f1", + "evaluation": [ + -128, + null + ] + }, + { + "move": "e1f1", + "evaluation": [ + -123, + null + ] + }, + { + "move": "g1g2", + "evaluation": [ + -118, + null + ] + }, + { + "move": "g1h1", + "evaluation": [ + -113, + null + ] + }, + { + "move": "d1c1", + "evaluation": [ + -106, + null + ] + }, + { + "move": "h2h3", + "evaluation": [ + -100, + null + ] + }, + { + "move": "d1d3", + "evaluation": [ + -97, + null + ] + }, + { + "move": "b1a1", + "evaluation": [ + -56, + null + ] + }, + { + "move": "b1c1", + "evaluation": [ + -40, + null + ] + }, + { + "move": "g3g4", + "evaluation": [ + -40, + null + ] + }, + { + "move": "d1d6", + "evaluation": [ + 1144, + null + ] + }, + { + "move": "d1g4", + "evaluation": [ + 1165, + null + ] + }, + { + "move": "d1d5", + "evaluation": [ + 1197, + null + ] + }, + { + "move": "d1d4", + "evaluation": [ + 1243, + null + ] + } + ], + "strict": true + }, + "analysed_legals": [], + "strict": true + }, + "analysed_legals": [ + { + "move": "c5e6", + "evaluation": [ + -223, + null + ] + }, { - "move": "d3e4", + "move": "c5b3", "evaluation": [ - -275, + 80, null ] }, { - "move": "d2e3", + "move": "c5d3", "evaluation": [ - 116, + 90, null ] }, { - "move": "a1c1", + "move": "c5a4", "evaluation": [ - 137, + 110, null ] }, { - "move": "a1b1", + "move": "c5a6", "evaluation": [ - 149, + 130, null ] }, { - "move": "c2c3", + "move": "c5b7", "evaluation": [ - 153, + 134, null ] }, { - "move": "d1g4", + "move": "f2f4", "evaluation": [ - 247, + 172, null ] }, { - "move": "d2g5", + "move": "g1f1", "evaluation": [ - 275, + 281, null ] }, { - "move": "d2f4", + "move": "g1h1", "evaluation": [ - 275, + 351, null ] }, { "move": "d1e2", "evaluation": [ - 292, + 359, null ] }, { - "move": "a3a4", + "move": "c5d7", "evaluation": [ - 304, + 385, null ] }, { - "move": "h2h4", + "move": "g1g2", "evaluation": [ - 304, + 389, null ] }, { - "move": "d2h6", + "move": "c2c3", "evaluation": [ - 305, + 393, null ] }, { - "move": "d2c1", + "move": "b1a1", "evaluation": [ - 308, + 405, null ] }, { - "move": "h2h3", + "move": "d1d3", "evaluation": [ - 309, + 412, null ] }, { - "move": "d1b1", + "move": "e1f1", "evaluation": [ - 311, + 420, null ] }, { - "move": "g1h1", + "move": "a2a4", "evaluation": [ - 326, + 425, null ] }, { - "move": "d1c1", + "move": "e1e3", "evaluation": [ - 328, + 429, null ] }, { - "move": "d1e1", + "move": "b1c1", "evaluation": [ - 330, + 429, null ] }, { - "move": "d3e2", + "move": "d1g4", "evaluation": [ - 333, + 433, null ] }, { - "move": "d2e1", + "move": "f2f3", "evaluation": [ - 336, + 443, null ] }, { - "move": "d1h5", + "move": "d1f3", "evaluation": [ - 336, + 448, null ] }, { - "move": "a1a2", + "move": "e1e2", "evaluation": [ - 366, + 450, null ] }, { - "move": "d2c3", + "move": "d1c1", "evaluation": [ - 381, + 456, + null + ] + }, + { + "move": "d1d2", + "evaluation": [ + 459, null ] }, { "move": "c2c4", "evaluation": [ - 390, + 460, null ] }, { - "move": "f1e1", + "move": "a2a3", "evaluation": [ - 415, + 464, null ] }, { - "move": "d3b5", + "move": "h2h4", "evaluation": [ - 584, + 475, null ] }, { - "move": "d3c4", + "move": "h2h3", "evaluation": [ - 664, + 478, null ] }, { - "move": "g2g4", + "move": "d1h5", "evaluation": [ - 780, + 486, null ] }, { - "move": "g2g3", + "move": "b2b3", "evaluation": [ - 944, + 506, null ] }, { - "move": "d1f3", + "move": "b2b4", + "evaluation": [ + 553, + null + ] + }, + { + "move": "g3g4", + "evaluation": [ + 646, + null + ] + }, + { + "move": "d1d5", + "evaluation": [ + 1166, + null + ] + }, + { + "move": "d1d4", + "evaluation": [ + 1193, + null + ] + }, + { + "move": "d1d6", "evaluation": [ - 1148, + 1210, null ] } @@ -983,240 +2258,219 @@ }, "analysed_legals": [ { - "move": "c3e4", - "evaluation": [ - -216, - null - ] - }, - { - "move": "d3e4", - "evaluation": [ - -12, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 324, - null - ] - }, - { - "move": "c3e2", + "move": "a4c5", "evaluation": [ - 499, + -225, null ] }, { - "move": "a1c1", + "move": "f2f4", "evaluation": [ - 574, + -33, null ] }, { - "move": "c3b5", + "move": "d1d2", "evaluation": [ - 592, + 68, null ] }, { - "move": "g1h1", + "move": "a4c3", "evaluation": [ - 592, + 75, null ] }, { - "move": "d1e2", + "move": "h2h3", "evaluation": [ - 592, + 78, null ] }, { - "move": "a3a4", + "move": "g1g2", "evaluation": [ - 610, + 82, null ] }, { - "move": "d2e3", + "move": "h2h4", "evaluation": [ - 644, + 89, null ] }, { - "move": "c3d5", + "move": "e1e3", "evaluation": [ - 667, + 92, null ] }, { - "move": "d2f4", + "move": "a2a3", "evaluation": [ - 680, + 107, null ] }, { - "move": "c3a4", + "move": "e1e2", "evaluation": [ - 682, + 109, null ] }, { - "move": "a1b1", + "move": "d1e2", "evaluation": [ - 685, + 113, null ] }, { - "move": "d1c1", + "move": "c2c3", "evaluation": [ - 689, + 115, null ] }, { - "move": "d3e2", + "move": "d1h5", "evaluation": [ - 697, + 122, null ] }, { - "move": "a1a2", + "move": "d1g4", "evaluation": [ - 724, + 133, null ] }, { - "move": "h2h3", + "move": "b2b4", "evaluation": [ - 726, + 135, null ] }, { - "move": "d2c1", + "move": "e1f1", "evaluation": [ - 734, + 136, null ] }, { - "move": "d2e1", + "move": "b2b3", "evaluation": [ - 751, + 136, null ] }, { - "move": "c3a2", + "move": "c2c4", "evaluation": [ - 774, + 145, null ] }, { - "move": "c3b1", + "move": "d1d3", "evaluation": [ - 786, + 195, null ] }, { - "move": "d2g5", + "move": "b1c1", "evaluation": [ - 800, + 203, null ] }, { - "move": "d1g4", + "move": "b1a1", "evaluation": [ - 806, + 224, null ] }, { - "move": "d3c4", + "move": "d1f3", "evaluation": [ - 822, + 232, null ] }, { - "move": "d3b5", + "move": "d1c1", "evaluation": [ - 826, + 253, null ] }, { - "move": "d1h5", + "move": "f2f3", "evaluation": [ - 862, + 283, null ] }, { - "move": "f1e1", + "move": "g1f1", "evaluation": [ - 893, + 325, null ] }, { - "move": "d1b1", + "move": "g3g4", "evaluation": [ - 930, + 439, null ] }, { - "move": "h2h4", + "move": "a4b6", "evaluation": [ - 1009, + 465, null ] }, { - "move": "d2h6", + "move": "g1h1", "evaluation": [ - 1023, + 600, null ] }, { - "move": "d1f3", + "move": "d1d6", "evaluation": [ - 1253, + 1270, null ] }, { - "move": "g2g3", + "move": "d1d5", "evaluation": [ - 1591, + 1354, null ] }, { - "move": "g2g4", + "move": "d1d4", "evaluation": [ - 1649, + 1378, null ] } @@ -1409,7 +2663,7 @@ "ponder": "e4f5" }, "evaluation": [ - 633, + 653, null ], "next_position": { @@ -1502,7 +2756,7 @@ "ponder": "e8e2" }, "evaluation": [ - -685, + -623, null ], "next_position": { @@ -1595,7 +2849,7 @@ "ponder": "c2c4" }, "evaluation": [ - 673, + 690, null ], "next_position": { @@ -1688,7 +2942,7 @@ "ponder": "g8f8" }, "evaluation": [ - -618, + -607, null ], "next_position": { @@ -1778,16 +3032,16 @@ }, "player_turn": true, "best_move": { - "move": "e2b2", - "ponder": "a1a3" + "move": "h7h5", + "ponder": "h2h3" }, "evaluation": [ - 628, + 631, null ], "next_position": { "position": { - "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/1r3P1P/R5K1 w - - 1 27", + "fen": "6k1/p1p2pp1/1b1p4/2p2P1p/2P5/1P4P1/4rP1P/R5K1 w - - 0 27", "aliases": [ "Standard", "Chess", @@ -1847,18 +3101,18 @@ "e4f5", "e8e2", "c2c4", - "e2b2" + "h7h5" ], "uci_variant": "chess", "piece_map": { "62": "k", - "55": "p", "54": "p", "53": "p", "50": "p", "48": "p", "43": "p", "41": "b", + "39": "p", "37": "P", "34": "p", "26": "P", @@ -1866,7 +3120,7 @@ "17": "P", "15": "P", "13": "P", - "9": "r", + "12": "r", "6": "K", "0": "R" } @@ -1882,168 +3136,168 @@ { "move": "e2b2", "evaluation": [ - -616, + -625, null ] }, { - "move": "g8f8", + "move": "e2d2", "evaluation": [ -615, null ] }, { - "move": "h7h5", + "move": "g8f8", "evaluation": [ - -615, + -613, null ] }, { "move": "e2c2", "evaluation": [ - -600, + -592, null ] }, { - "move": "e2d2", + "move": "g7g5", "evaluation": [ - -594, + -592, null ] }, { - "move": "f7f6", + "move": "a7a5", "evaluation": [ - -593, + -592, null ] }, { - "move": "g7g5", + "move": "d6d5", "evaluation": [ - -592, + -589, null ] }, { - "move": "a7a5", + "move": "e2e5", "evaluation": [ -584, null ] }, { - "move": "c7c6", + "move": "h7h5", "evaluation": [ - -576, + -584, null ] }, { "move": "h7h6", "evaluation": [ - -572, + -582, null ] }, { - "move": "g7g6", + "move": "c7c6", "evaluation": [ - -571, + -582, null ] }, { - "move": "g8h8", + "move": "f7f6", "evaluation": [ - -568, + -578, null ] }, { - "move": "e2e4", + "move": "g7g6", "evaluation": [ - -568, + -565, null ] }, { - "move": "d6d5", + "move": "g8h8", "evaluation": [ - -568, + -557, null ] }, { - "move": "e2e5", + "move": "e2e4", "evaluation": [ - -565, + -549, null ] }, { "move": "e2e8", "evaluation": [ - -545, + -538, null ] }, { - "move": "a7a6", + "move": "e2e7", "evaluation": [ - -542, + -533, null ] }, { - "move": "e2e7", + "move": "a7a6", "evaluation": [ - -534, + -533, null ] }, { "move": "b6a5", "evaluation": [ - 43, + 25, null ] }, { "move": "e2e6", "evaluation": [ - 124, + 123, null ] }, { "move": "e2f2", "evaluation": [ - 157, + 188, null ] }, { "move": "e2e3", "evaluation": [ - 238, + 246, null ] }, { "move": "e2a2", "evaluation": [ - 254, + 250, null ] }, { "move": "e2e1", "evaluation": [ - 258, + 297, null ] } @@ -2057,112 +3311,112 @@ { "move": "e8e2", "evaluation": [ - -623, + -646, null ] }, { - "move": "e8f8", + "move": "g8f8", "evaluation": [ - 247, + 254, null ] }, { - "move": "e8c8", + "move": "e8b8", "evaluation": [ - 258, + 259, null ] }, { - "move": "g8f8", + "move": "e8a8", "evaluation": [ - 266, + 265, null ] }, { - "move": "e8d8", + "move": "e8c8", "evaluation": [ - 269, + 266, null ] }, { - "move": "e8b8", + "move": "e8d8", "evaluation": [ - 273, + 267, null ] }, { - "move": "e8a8", + "move": "e8e5", "evaluation": [ - 291, + 312, null ] }, { - "move": "e8e5", + "move": "e8f8", "evaluation": [ - 328, + 320, null ] }, { - "move": "e8e4", + "move": "g7g5", "evaluation": [ - 782, + 775, null ] }, { - "move": "e8e6", + "move": "g7g6", "evaluation": [ - 795, + 781, null ] }, { - "move": "e8e3", + "move": "e8e7", "evaluation": [ - 800, + 792, null ] }, { - "move": "g7g5", + "move": "e8e6", "evaluation": [ - 801, + 829, null ] }, { - "move": "e8e7", + "move": "e8e3", "evaluation": [ - 812, + 836, null ] }, { - "move": "g7g6", + "move": "e8e4", "evaluation": [ - 852, + 869, null ] }, { "move": "h7h6", "evaluation": [ - 856, + 895, null ] }, { "move": "h7h5", "evaluation": [ - 881, + 895, null ] }, @@ -2232,217 +3486,217 @@ { "move": "h3f5", "evaluation": [ - -642, + -609, null ] }, { "move": "h3h6", "evaluation": [ - 203, + 223, null ] }, { - "move": "h3g3", + "move": "h3h2", "evaluation": [ - 1327, + 1331, null ] }, { - "move": "h3h2", + "move": "h3g3", "evaluation": [ - 1335, + 1340, null ] }, { "move": "h3h4", "evaluation": [ - 1393, + 1397, null ] }, { "move": "c5c4", "evaluation": [ - 1403, + 1414, null ] }, { - "move": "e8e6", + "move": "g7g6", "evaluation": [ 1421, null ] }, { - "move": "e8e7", + "move": "h7h6", "evaluation": [ - 1424, + 1423, null ] }, { - "move": "h3g4", + "move": "h3h5", "evaluation": [ - 1424, + 1426, null ] }, { - "move": "g8h8", + "move": "h3g4", "evaluation": [ - 1431, + 1426, null ] }, { - "move": "h3h5", + "move": "e8e7", "evaluation": [ - 1431, + 1427, null ] }, { - "move": "h3f1", + "move": "f7f6", "evaluation": [ - 1431, + 1428, null ] }, { - "move": "h7h6", + "move": "e8d8", "evaluation": [ - 1431, + 1429, null ] }, { "move": "e8e5", "evaluation": [ - 1432, + 1429, null ] }, { - "move": "g7g6", + "move": "e8e6", "evaluation": [ - 1432, + 1430, null ] }, { - "move": "e8a8", + "move": "a7a5", "evaluation": [ - 1439, + 1430, null ] }, { "move": "e8f8", "evaluation": [ - 1440, + 1431, null ] }, { - "move": "a7a5", + "move": "h3f1", "evaluation": [ - 1442, + 1431, null ] }, { - "move": "b6a5", + "move": "g8h8", "evaluation": [ - 1444, + 1432, null ] }, { - "move": "e8b8", + "move": "h7h5", "evaluation": [ - 1445, + 1432, null ] }, { - "move": "h3g2", + "move": "g8f8", "evaluation": [ - 1447, + 1435, null ] }, { "move": "d6d5", "evaluation": [ - 1453, + 1435, null ] }, { - "move": "g7g5", + "move": "e8a8", "evaluation": [ - 1460, + 1437, null ] }, { - "move": "h7h5", + "move": "c7c6", "evaluation": [ - 1501, + 1437, null ] }, { - "move": "a7a6", + "move": "b6a5", "evaluation": [ - 1511, + 1438, null ] }, { - "move": "f7f6", + "move": "h3g2", "evaluation": [ - 1516, + 1441, null ] }, { - "move": "g8f8", + "move": "e8b8", "evaluation": [ - 1530, + 1445, null ] }, { - "move": "c7c6", + "move": "e8c8", "evaluation": [ - 1776, + 1448, null ] }, { - "move": "e8d8", + "move": "a7a6", "evaluation": [ - 1794, + 1495, null ] }, { - "move": "e8e4", + "move": "g7g5", "evaluation": [ - 1958, + 1536, null ] }, { - "move": "e8c8", + "move": "e8e4", "evaluation": [ - 2108, + 1962, null ] } diff --git a/test/unit/test.log b/test/unit/test.log deleted file mode 100644 index 818b791..0000000 --- a/test/unit/test.log +++ /dev/null @@ -1,13 +0,0 @@ -INFO:root:dzei -INFO:root:going for definition {'score_a': [-64, None], 'score_b': [247, None], 'board': {'fen': 'rnbqk1nr/3p1ppp/p3p3/1pb5/4P3/2NB1N2/PPP2PPP/R1BQK2R b KQkq - 1 6', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 6, 'move_stack': ['e2e4', 'c7c5', 'g1f3', 'e7e6', 'b1c3', 'a7a6', 'd2d4', 'b7b5', 'd4c5', 'f8c5', 'f1d3'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [-106, None], 'score_b': [206, None], 'board': {'fen': 'r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2P2PPP/R1BQ1RK1 w kq - 1 12', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 12, 'move_stack': ['e2e4', 'c7c5', 'g1f3', 'e7e6', 'b1c3', 'a7a6', 'd2d4', 'b7b5', 'd4c5', 'f8c5', 'f1d3', 'd8b6', 'e1g1', 'c8b7', 'f3e5', 'g8f6', 'a2a3', 'b8c6', 'e5c6', 'b7c6', 'b2b4', 'c5d4'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [206, None], 'score_b': [262, None], 'board': {'fen': 'r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2PB1PPP/R2Q1RK1 b kq - 2 12', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 12, 'move_stack': ['e2e4', 'c7c5', 'g1f3', 'e7e6', 'b1c3', 'a7a6', 'd2d4', 'b7b5', 'd4c5', 'f8c5', 'f1d3', 'd8b6', 'e1g1', 'c8b7', 'f3e5', 'g8f6', 'a2a3', 'b8c6', 'e5c6', 'b7c6', 'b2b4', 'c5d4', 'c1d2'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [109, None], 'score_b': [283, None], 'board': {'fen': 'r3r1k1/p1pq1ppp/2pp4/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 b - - 4 15', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 15, 'move_stack': ['e2e4', 'e7e5', 'g1f3', 'd7d6', 'd2d4', 'e5d4', 'f3d4', 'b8c6', 'f1b5', 'c8d7', 'b5c6', 'd7c6', 'b1c3', 'g8f6', 'c1g5', 'f8e7', 'g5f6', 'e7f6', 'd4c6', 'b7c6', 'e1g1', 'e8g8', 'f1e1', 'f6e5', 'g2g3', 'd8d7', 'a1b1', 'f8e8', 'c3a4'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [176, None], 'score_b': [693, None], 'board': {'fen': '4r1k1/p1p2ppp/1b1p4/2p5/4P3/1P3QPq/2P1RP1P/R5K1 w - - 2 24', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 24, 'move_stack': ['e2e4', 'e7e5', 'g1f3', 'd7d6', 'd2d4', 'e5d4', 'f3d4', 'b8c6', 'f1b5', 'c8d7', 'b5c6', 'd7c6', 'b1c3', 'g8f6', 'c1g5', 'f8e7', 'g5f6', 'e7f6', 'd4c6', 'b7c6', 'e1g1', 'e8g8', 'f1e1', 'f6e5', 'g2g3', 'd8d7', 'a1b1', 'f8e8', 'c3a4', 'e8e6', 'a4c5', 'd7e7', 'c5e6', 'e7e6', 'b2b3', 'e6h3', 'd1f3', 'a8e8', 'a2a4', 'c6c5', 'a4a5', 'e5c3', 'e1e2', 'c3a5', 'b1a1', 'a5b6'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [693, None], 'score_b': [207, None], 'board': {'fen': '4r1k1/p1p2ppp/1b1p4/2p2Q2/4P3/1P4Pq/2P1RP1P/R5K1 b - - 3 24', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 24, 'move_stack': ['e2e4', 'e7e5', 'g1f3', 'd7d6', 'd2d4', 'e5d4', 'f3d4', 'b8c6', 'f1b5', 'c8d7', 'b5c6', 'd7c6', 'b1c3', 'g8f6', 'c1g5', 'f8e7', 'g5f6', 'e7f6', 'd4c6', 'b7c6', 'e1g1', 'e8g8', 'f1e1', 'f6e5', 'g2g3', 'd8d7', 'a1b1', 'f8e8', 'c3a4', 'e8e6', 'a4c5', 'd7e7', 'c5e6', 'e7e6', 'b2b3', 'e6h3', 'd1f3', 'a8e8', 'a2a4', 'c6c5', 'a4a5', 'e5c3', 'e1e2', 'c3a5', 'b1a1', 'a5b6', 'f3f5'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [143, None], 'score_b': [646, None], 'board': {'fen': '4rk2/p1pQ1pp1/1b3q2/2p1pP1p/2P5/1P2R1P1/7P/3R2K1 w - - 0 32', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 32, 'move_stack': ['e2e4', 'e7e5', 'g1f3', 'd7d6', 'd2d4', 'e5d4', 'f3d4', 'b8c6', 'f1b5', 'c8d7', 'b5c6', 'd7c6', 'b1c3', 'g8f6', 'c1g5', 'f8e7', 'g5f6', 'e7f6', 'd4c6', 'b7c6', 'e1g1', 'e8g8', 'f1e1', 'f6e5', 'g2g3', 'd8d7', 'a1b1', 'f8e8', 'c3a4', 'e8e6', 'a4c5', 'd7e7', 'c5e6', 'e7e6', 'b2b3', 'e6h3', 'd1f3', 'a8e8', 'a2a4', 'c6c5', 'a4a5', 'e5c3', 'e1e2', 'c3a5', 'b1a1', 'a5b6', 'f3f5', 'h3h6', 'f5d7', 'g8f8', 'c2c4', 'h6h5', 'e2e3', 'h5e5', 'a1d1', 'h7h5', 'f2f4', 'e5b2', 'f4f5', 'b2f6', 'e4e5', 'd6e5'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [-48, None], 'score_b': [220, None], 'board': {'fen': 'r1bqk1nr/pppp1ppp/2n5/8/1b1PP3/2N5/PP3PPP/R1BQKBNR b KQkq - 2 5', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 5, 'move_stack': ['e2e4', 'e7e5', 'd2d4', 'e5d4', 'c2c3', 'b8c6', 'c3d4', 'f8b4', 'b1c3'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [-97, None], 'score_b': [767, None], 'board': {'fen': '2kr3r/1pp2p1p/p6q/3P1p2/8/5Q2/P4PPP/1RR3K1 b - - 1 21', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 21, 'move_stack': ['e2e4', 'e7e5', 'd2d4', 'e5d4', 'c2c3', 'b8c6', 'c3d4', 'f8b4', 'b1c3', 'b4c3', 'b2c3', 'd7d5', 'e4e5', 'c8e6', 'g1f3', 'g8f6', 'e5f6', 'g7f6', 'c1h6', 'd8e7', 'f1e2', 'e6g4', 'e1g1', 'g4f3', 'e2f3', 'e8c8', 'a1b1', 'e7d6', 'd1a4', 'a7a6', 'c3c4', 'd5c4', 'a4c4', 'f6f5', 'd4d5', 'c6e5', 'c4f4', 'e5f3', 'f4f3', 'd6h6', 'f1c1'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [-40, None], 'score_b': [203, None], 'board': {'fen': '2kr2r1/1pp2p1p/p6q/3P1p2/8/1Q6/P4PPP/1RR3K1 b - - 3 22', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 22, 'move_stack': ['e2e4', 'e7e5', 'd2d4', 'e5d4', 'c2c3', 'b8c6', 'c3d4', 'f8b4', 'b1c3', 'b4c3', 'b2c3', 'd7d5', 'e4e5', 'c8e6', 'g1f3', 'g8f6', 'e5f6', 'g7f6', 'c1h6', 'd8e7', 'f1e2', 'e6g4', 'e1g1', 'g4f3', 'e2f3', 'e8c8', 'a1b1', 'e7d6', 'd1a4', 'a7a6', 'c3c4', 'd5c4', 'a4c4', 'f6f5', 'd4d5', 'c6e5', 'c4f4', 'e5f3', 'f4f3', 'd6h6', 'f1c1', 'h8g8', 'f3b3'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [74, None], 'score_b': [230, None], 'board': {'fen': '2kr2r1/2p2p1p/pp4q1/3P1p2/8/5QP1/P4P1P/1RR3K1 b - - 0 24', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 24, 'move_stack': ['e2e4', 'e7e5', 'd2d4', 'e5d4', 'c2c3', 'b8c6', 'c3d4', 'f8b4', 'b1c3', 'b4c3', 'b2c3', 'd7d5', 'e4e5', 'c8e6', 'g1f3', 'g8f6', 'e5f6', 'g7f6', 'c1h6', 'd8e7', 'f1e2', 'e6g4', 'e1g1', 'g4f3', 'e2f3', 'e8c8', 'a1b1', 'e7d6', 'd1a4', 'a7a6', 'c3c4', 'd5c4', 'a4c4', 'f6f5', 'd4d5', 'c6e5', 'c4f4', 'e5f3', 'f4f3', 'd6h6', 'f1c1', 'h8g8', 'f3b3', 'b7b6', 'b3f3', 'h6g6', 'g2g3'], 'uci_variant': 'chess'}, 'result': True} -INFO:root:going for definition {'score_a': [9, None], 'score_b': [756, None], 'board': {'fen': '2kr2r1/2p2p2/pp4q1/3P1p1p/7P/5QP1/P4P2/1RR3K1 b - - 0 25', 'aliases': ['Standard', 'Chess', 'Classical', 'Normal'], 'fullmove_number': 25, 'move_stack': ['e2e4', 'e7e5', 'd2d4', 'e5d4', 'c2c3', 'b8c6', 'c3d4', 'f8b4', 'b1c3', 'b4c3', 'b2c3', 'd7d5', 'e4e5', 'c8e6', 'g1f3', 'g8f6', 'e5f6', 'g7f6', 'c1h6', 'd8e7', 'f1e2', 'e6g4', 'e1g1', 'g4f3', 'e2f3', 'e8c8', 'a1b1', 'e7d6', 'd1a4', 'a7a6', 'c3c4', 'd5c4', 'a4c4', 'f6f5', 'd4d5', 'c6e5', 'c4f4', 'e5f3', 'f4f3', 'd6h6', 'f1c1', 'h8g8', 'f3b3', 'b7b6', 'b3f3', 'h6g6', 'g2g3', 'h7h5', 'h2h4'], 'uci_variant': 'chess'}, 'result': True} diff --git a/test/unit/test_investigate.py b/test/unit/test_investigate.py deleted file mode 100644 index 47e86d2..0000000 --- a/test/unit/test_investigate.py +++ /dev/null @@ -1,148 +0,0 @@ -import unittest - -from chess import Board -from chess.uci import Score - -from modules.investigate.investigate import investigate - -board = Board() - - -class TestShouldInvestigate(unittest.TestCase): - - def test_investigating_moderate_score_changes(self): - score_changes = [ - [0, 200], - [50, 200], - [-50, 200], - ] - for a, b in score_changes: - a = Score(a, None) - b = Score(b, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_major_score_changes(self): - score_changes = [ - [0, 500], - [100, 500], - [100, -100], - ] - for a, b in score_changes: - a = Score(a, None) - b = Score(b, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_even_position_to_mate(self): - a = Score(0, None) - b = Score(None, 5) - - self.assertTrue(investigate(a, b, board)) - - a = Score(0, None) - b = Score(None, -5) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_minor_advantage_to_mate(self): - a = Score(100, None) - b = Score(None, 5) - self.assertTrue(investigate(a, b, board)) - - a = Score(-100, None) - b = Score(None, -5) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_major_advantage_to_getting_mated(self): - a = Score(700, None) - b = Score(None, -5) - self.assertTrue(investigate(a, b, board)) - - a = Score(-700, None) - b = Score(None, 5) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_major_advantage_to_major_disadvantage(self): - a = Score(700, None) - b = Score(-700, None) - self.assertTrue(investigate(a, b, board)) - - a = Score(-700, None) - b = Score(700, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_major_advantage_to_even_position(self): - a = Score(700, None) - b = Score(0, None) - self.assertTrue(investigate(a, b, board)) - - a = Score(-700, None) - b = Score(0, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_mate_threat_to_major_disadvantage(self): - a = Score(None, 5) - b = Score(-700, None) - self.assertTrue(investigate(a, b, board)) - - a = Score(None, -5) - b = Score(700, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_mate_threat_to_even_position(self): - a = Score(None, 5) - b = Score(0, None) - self.assertTrue(investigate(a, b, board)) - - a = Score(None, -5) - b = Score(0, None) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_mate_threat_to_getting_mated(self): - a = Score(None, 1) - b = Score(None, -1) - self.assertTrue(investigate(a, b, board)) - - a = Score(None, -1) - b = Score(None, 1) - self.assertTrue(investigate(a, b, board)) - - def test_investigating_mate_threat_to_checkmate(self): - a = Score(None, 1) - b = Score(None, 0) - self.assertFalse(investigate(a, b, board)) - - def test_not_investigating_insignificant_score_changes(self): - score_changes = [ - [0, 0], - [-50, 50], - [50, -50], - [-70, -70], - [70, 70], - ] - for a, b in score_changes: - a = Score(a, None) - b = Score(b, None) - self.assertFalse(investigate(a, b, board)) - - def test_not_investigating_major_advantage_to_mate_threat(self): - a = Score(900, None) - b = Score(None, 5) - self.assertFalse(investigate(a, b, board)) - - a = Score(-900, None) - b = Score(None, -5) - self.assertFalse(investigate(a, b, board)) - - def test_not_investigating_even_position(self): - board = Board("4k3/8/3n4/3N4/8/8/4K3/8 w - - 0 1") - - a = Score(0, None) - b = Score(0, None) - self.assertFalse(investigate(a, b, board)) - - a = Score(9, None) - b = Score(9, None) - self.assertFalse(investigate(a, b, board)) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/regression.py b/test/unit/test_regression.py similarity index 94% rename from test/unit/regression.py rename to test/unit/test_regression.py index 40dabab..1b9c62b 100644 --- a/test/unit/regression.py +++ b/test/unit/test_regression.py @@ -1,13 +1,15 @@ import json import logging +import os import sys import unittest from modules.decoding import score_from_dict, board_from_dict, puzzle_from_dict from modules.investigate.investigate import investigate -INVESTIGATE_FILE = '../data/investigate.json' -IS_COMPLETE_FILE = '../data/is_complete.json' +TEST_DIR = os.path.dirname(os.path.abspath(__file__)) +INVESTIGATE_FILE = f'{TEST_DIR}/../data/investigate.json' +IS_COMPLETE_FILE = f'{TEST_DIR}/../data/is_complete.json' def configure_logger(): @@ -105,3 +107,6 @@ def test_is_complete(self): logging.debug(f'{expected_result} vs {result}') self.assertEqual(expected_result, result) + +if __name__ == '__main__': + unittest.main() From 3b06511e3e1782de37155f38a970f5201461e7f2 Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Wed, 2 Jun 2021 17:00:39 +0200 Subject: [PATCH 7/8] Fix broken ambiguous() condition --- modules/puzzle/position_list.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/puzzle/position_list.py b/modules/puzzle/position_list.py index 572f908..df6074f 100644 --- a/modules/puzzle/position_list.py +++ b/modules/puzzle/position_list.py @@ -145,10 +145,9 @@ def ambiguous(self): if (self.analysed_legals[0].evaluation.mate() < 1 and self.analysed_legals[1].evaluation.mate() < 1): return True - if not self.analysed_legals[0].evaluation.is_mate() or self.analysed_legals[1].evaluation.is_mate(): - return True - if self.analysed_legals[1].evaluation.score() < -200: - return True + if self.analysed_legals[0].evaluation.is_mate() and not self.analysed_legals[1].evaluation.is_mate(): + if self.analysed_legals[1].evaluation.score() < -200: + return True return False def game_over(self): From 0b4003e4813f4ec7460b870425ffb2fdf5c8ed1d Mon Sep 17 00:00:00 2001 From: Karol Brejna Date: Thu, 3 Jun 2021 08:49:57 +0200 Subject: [PATCH 8/8] Improve test_ambiguous --- modules/encoding.py | 3 +- test/data/is_complete.0.1.json | 2455 -------------------------------- test/data/is_complete.json | 2046 ++++++-------------------- test/unit/test_regression.py | 3 +- 4 files changed, 419 insertions(+), 4088 deletions(-) delete mode 100644 test/data/is_complete.0.1.json diff --git a/modules/encoding.py b/modules/encoding.py index f941ecf..a9df317 100644 --- a/modules/encoding.py +++ b/modules/encoding.py @@ -49,7 +49,8 @@ def positionlist_to_dict(pl: position_list) -> dict: 'evaluation': score_to_dict(pl.evaluation), 'next_position': positionlist_to_dict(pl.next_position) if pl.next_position else None, 'analysed_legals': [analyzed_to_dict(al) for al in pl.analysed_legals], - 'strict': pl.strict + 'strict': pl.strict, + 'is_ambiguous': pl.ambiguous() } if pl else None diff --git a/test/data/is_complete.0.1.json b/test/data/is_complete.0.1.json deleted file mode 100644 index 688159d..0000000 --- a/test/data/is_complete.0.1.json +++ /dev/null @@ -1,2455 +0,0 @@ -[ - { - "puzzle": { - "game_id": "1", - "category": "Material", - "last_pos": { - "fen": "r3k2r/3p1ppp/pqb1pn2/1p6/1P1bP3/P1NB4/2PB1PPP/R2Q1RK1 b kq - 2 12", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 12, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "p", - "45": "n", - "44": "p", - "42": "b", - "41": "q", - "40": "p", - "33": "p", - "28": "P", - "27": "b", - "25": "P", - "19": "B", - "18": "N", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "last_move": "f6e4", - "move_list": [ - "c3e4", - "c6e4", - "d3e4", - "d7d5" - ], - "positions": { - "position": { - "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bn3/P1NB4/2PB1PPP/R2Q1RK1 w kq - 0 13", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 13, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "p", - "44": "p", - "42": "b", - "41": "q", - "40": "p", - "33": "p", - "28": "n", - "27": "b", - "25": "P", - "19": "B", - "18": "N", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "c3e4", - "ponder": "c6e4" - }, - "evaluation": [ - 344, - null - ], - "next_position": { - "position": { - "fen": "r3k2r/3p1ppp/pqb1p3/1p6/1P1bN3/P2B4/2PB1PPP/R2Q1RK1 b kq - 0 13", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 13, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4", - "c3e4" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "p", - "44": "p", - "42": "b", - "41": "q", - "40": "p", - "33": "p", - "28": "N", - "27": "b", - "25": "P", - "19": "B", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "c6e4", - "ponder": "d3e4" - }, - "evaluation": [ - -204, - null - ], - "next_position": { - "position": { - "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bb3/P2B4/2PB1PPP/R2Q1RK1 w kq - 0 14", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 14, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4", - "c3e4", - "c6e4" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "p", - "44": "p", - "41": "q", - "40": "p", - "33": "p", - "28": "b", - "27": "b", - "25": "P", - "19": "B", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "d3e4", - "ponder": "d7d5" - }, - "evaluation": [ - 313, - null - ], - "next_position": { - "position": { - "fen": "r3k2r/3p1ppp/pq2p3/1p6/1P1bB3/P7/2PB1PPP/R2Q1RK1 b kq - 0 14", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 14, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4", - "c3e4", - "c6e4", - "d3e4" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "p", - "44": "p", - "41": "q", - "40": "p", - "33": "p", - "28": "B", - "27": "b", - "25": "P", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "d7d5", - "ponder": "c2c3" - }, - "evaluation": [ - -231, - null - ], - "next_position": { - "position": { - "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1bB3/P7/2PB1PPP/R2Q1RK1 w kq - 0 15", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 15, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4", - "c3e4", - "c6e4", - "d3e4", - "d7d5" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "44": "p", - "41": "q", - "40": "p", - "35": "p", - "33": "p", - "28": "B", - "27": "b", - "25": "P", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "e4d3", - "ponder": "d4a1" - }, - "evaluation": [ - 279, - null - ], - "next_position": { - "position": { - "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1b4/P2B4/2PB1PPP/R2Q1RK1 b kq - 1 15", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 15, - "move_stack": [ - "e2e4", - "c7c5", - "g1f3", - "e7e6", - "b1c3", - "a7a6", - "d2d4", - "b7b5", - "d4c5", - "f8c5", - "f1d3", - "d8b6", - "e1g1", - "c8b7", - "f3e5", - "g8f6", - "a2a3", - "b8c6", - "e5c6", - "b7c6", - "b2b4", - "c5d4", - "c1d2", - "f6e4", - "c3e4", - "c6e4", - "d3e4", - "d7d5", - "e4d3" - ], - "uci_variant": "chess", - "piece_map": { - "63": "r", - "60": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "44": "p", - "41": "q", - "40": "p", - "35": "p", - "33": "p", - "27": "b", - "25": "P", - "19": "B", - "16": "P", - "15": "P", - "14": "P", - "13": "P", - "11": "B", - "10": "P", - "6": "K", - "5": "R", - "3": "Q", - "0": "R" - } - }, - "player_turn": false, - "best_move": null, - "evaluation": null, - "next_position": null, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "e4d3", - "evaluation": [ - -282, - null - ] - }, - { - "move": "c2c3", - "evaluation": [ - -261, - null - ] - }, - { - "move": "e4f3", - "evaluation": [ - -188, - null - ] - }, - { - "move": "e4d5", - "evaluation": [ - -138, - null - ] - }, - { - "move": "e4f5", - "evaluation": [ - -113, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - 67, - null - ] - }, - { - "move": "a3a4", - "evaluation": [ - 86, - null - ] - }, - { - "move": "c2c4", - "evaluation": [ - 95, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 96, - null - ] - }, - { - "move": "a1c1", - "evaluation": [ - 130, - null - ] - }, - { - "move": "d2e3", - "evaluation": [ - 136, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - 138, - null - ] - }, - { - "move": "d2g5", - "evaluation": [ - 139, - null - ] - }, - { - "move": "d2f4", - "evaluation": [ - 152, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - 156, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 161, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - 164, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - 167, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - 167, - null - ] - }, - { - "move": "d2e1", - "evaluation": [ - 168, - null - ] - }, - { - "move": "g2g3", - "evaluation": [ - 176, - null - ] - }, - { - "move": "g2g4", - "evaluation": [ - 192, - null - ] - }, - { - "move": "a1b1", - "evaluation": [ - 196, - null - ] - }, - { - "move": "e4g6", - "evaluation": [ - 213, - null - ] - }, - { - "move": "e4h7", - "evaluation": [ - 222, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - 245, - null - ] - }, - { - "move": "a1a2", - "evaluation": [ - 270, - null - ] - }, - { - "move": "d1b1", - "evaluation": [ - 288, - null - ] - }, - { - "move": "d2h6", - "evaluation": [ - 290, - null - ] - }, - { - "move": "f1e1", - "evaluation": [ - 328, - null - ] - }, - { - "move": "d2c1", - "evaluation": [ - 351, - null - ] - }, - { - "move": "d2c3", - "evaluation": [ - 378, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "d3e4", - "evaluation": [ - -275, - null - ] - }, - { - "move": "d2e3", - "evaluation": [ - 116, - null - ] - }, - { - "move": "a1c1", - "evaluation": [ - 137, - null - ] - }, - { - "move": "a1b1", - "evaluation": [ - 149, - null - ] - }, - { - "move": "c2c3", - "evaluation": [ - 153, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 247, - null - ] - }, - { - "move": "d2g5", - "evaluation": [ - 275, - null - ] - }, - { - "move": "d2f4", - "evaluation": [ - 275, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - 292, - null - ] - }, - { - "move": "a3a4", - "evaluation": [ - 304, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - 304, - null - ] - }, - { - "move": "d2h6", - "evaluation": [ - 305, - null - ] - }, - { - "move": "d2c1", - "evaluation": [ - 308, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - 309, - null - ] - }, - { - "move": "d1b1", - "evaluation": [ - 311, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - 326, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - 328, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 330, - null - ] - }, - { - "move": "d3e2", - "evaluation": [ - 333, - null - ] - }, - { - "move": "d2e1", - "evaluation": [ - 336, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - 336, - null - ] - }, - { - "move": "a1a2", - "evaluation": [ - 366, - null - ] - }, - { - "move": "d2c3", - "evaluation": [ - 381, - null - ] - }, - { - "move": "c2c4", - "evaluation": [ - 390, - null - ] - }, - { - "move": "f1e1", - "evaluation": [ - 415, - null - ] - }, - { - "move": "d3b5", - "evaluation": [ - 584, - null - ] - }, - { - "move": "d3c4", - "evaluation": [ - 664, - null - ] - }, - { - "move": "g2g4", - "evaluation": [ - 780, - null - ] - }, - { - "move": "g2g3", - "evaluation": [ - 944, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - 1148, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "c3e4", - "evaluation": [ - -216, - null - ] - }, - { - "move": "d3e4", - "evaluation": [ - -12, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 324, - null - ] - }, - { - "move": "c3e2", - "evaluation": [ - 499, - null - ] - }, - { - "move": "a1c1", - "evaluation": [ - 574, - null - ] - }, - { - "move": "c3b5", - "evaluation": [ - 592, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - 592, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - 592, - null - ] - }, - { - "move": "a3a4", - "evaluation": [ - 610, - null - ] - }, - { - "move": "d2e3", - "evaluation": [ - 644, - null - ] - }, - { - "move": "c3d5", - "evaluation": [ - 667, - null - ] - }, - { - "move": "d2f4", - "evaluation": [ - 680, - null - ] - }, - { - "move": "c3a4", - "evaluation": [ - 682, - null - ] - }, - { - "move": "a1b1", - "evaluation": [ - 685, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - 689, - null - ] - }, - { - "move": "d3e2", - "evaluation": [ - 697, - null - ] - }, - { - "move": "a1a2", - "evaluation": [ - 724, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - 726, - null - ] - }, - { - "move": "d2c1", - "evaluation": [ - 734, - null - ] - }, - { - "move": "d2e1", - "evaluation": [ - 751, - null - ] - }, - { - "move": "c3a2", - "evaluation": [ - 774, - null - ] - }, - { - "move": "c3b1", - "evaluation": [ - 786, - null - ] - }, - { - "move": "d2g5", - "evaluation": [ - 800, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 806, - null - ] - }, - { - "move": "d3c4", - "evaluation": [ - 822, - null - ] - }, - { - "move": "d3b5", - "evaluation": [ - 826, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - 862, - null - ] - }, - { - "move": "f1e1", - "evaluation": [ - 893, - null - ] - }, - { - "move": "d1b1", - "evaluation": [ - 930, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - 1009, - null - ] - }, - { - "move": "d2h6", - "evaluation": [ - 1023, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - 1253, - null - ] - }, - { - "move": "g2g3", - "evaluation": [ - 1591, - null - ] - }, - { - "move": "g2g4", - "evaluation": [ - 1649, - null - ] - } - ], - "strict": true - } - }, - "is_complete": true - }, - { - "puzzle": { - "game_id": "2", - "category": "Material", - "last_pos": { - "fen": "4r1k1/p1p2ppp/1b1p4/2p5/4P3/1P3QPq/2P1RP1P/R5K1 w - - 2 24", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 24, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "60": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "34": "p", - "28": "P", - "23": "q", - "22": "P", - "21": "Q", - "17": "P", - "15": "P", - "13": "P", - "12": "R", - "10": "P", - "6": "K", - "0": "R" - } - }, - "last_move": "f3f5", - "move_list": [ - "h3f5", - "e4f5", - "e8e2", - "c2c4" - ], - "positions": { - "position": { - "fen": "4r1k1/p1p2ppp/1b1p4/2p2Q2/4P3/1P4Pq/2P1RP1P/R5K1 b - - 3 24", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 24, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "60": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "Q", - "34": "p", - "28": "P", - "23": "q", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "12": "R", - "10": "P", - "6": "K", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "h3f5", - "ponder": "e4f5" - }, - "evaluation": [ - 633, - null - ], - "next_position": { - "position": { - "fen": "4r1k1/p1p2ppp/1b1p4/2p2q2/4P3/1P4P1/2P1RP1P/R5K1 w - - 0 25", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 25, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5", - "h3f5" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "60": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "q", - "34": "p", - "28": "P", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "12": "R", - "10": "P", - "6": "K", - "0": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "e4f5", - "ponder": "e8e2" - }, - "evaluation": [ - -685, - null - ], - "next_position": { - "position": { - "fen": "4r1k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1RP1P/R5K1 b - - 0 25", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 25, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5", - "h3f5", - "e4f5" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "60": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "P", - "34": "p", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "12": "R", - "10": "P", - "6": "K", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "e8e2", - "ponder": "c2c4" - }, - "evaluation": [ - 673, - null - ], - "next_position": { - "position": { - "fen": "6k1/p1p2ppp/1b1p4/2p2P2/8/1P4P1/2P1rP1P/R5K1 w - - 0 26", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 26, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5", - "h3f5", - "e4f5", - "e8e2" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "P", - "34": "p", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "12": "r", - "10": "P", - "6": "K", - "0": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "c2c4", - "ponder": "g8f8" - }, - "evaluation": [ - -618, - null - ], - "next_position": { - "position": { - "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/4rP1P/R5K1 b - - 0 26", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 26, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5", - "h3f5", - "e4f5", - "e8e2", - "c2c4" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "P", - "34": "p", - "26": "P", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "12": "r", - "6": "K", - "0": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "e2b2", - "ponder": "a1a3" - }, - "evaluation": [ - 628, - null - ], - "next_position": { - "position": { - "fen": "6k1/p1p2ppp/1b1p4/2p2P2/2P5/1P4P1/1r3P1P/R5K1 w - - 1 27", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 27, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "b2b3", - "e6h3", - "d1f3", - "a8e8", - "a2a4", - "c6c5", - "a4a5", - "e5c3", - "e1e2", - "c3a5", - "b1a1", - "a5b6", - "f3f5", - "h3f5", - "e4f5", - "e8e2", - "c2c4", - "e2b2" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "43": "p", - "41": "b", - "37": "P", - "34": "p", - "26": "P", - "22": "P", - "17": "P", - "15": "P", - "13": "P", - "9": "r", - "6": "K", - "0": "R" - } - }, - "player_turn": false, - "best_move": null, - "evaluation": null, - "next_position": null, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "e2b2", - "evaluation": [ - -616, - null - ] - }, - { - "move": "g8f8", - "evaluation": [ - -615, - null - ] - }, - { - "move": "h7h5", - "evaluation": [ - -615, - null - ] - }, - { - "move": "e2c2", - "evaluation": [ - -600, - null - ] - }, - { - "move": "e2d2", - "evaluation": [ - -594, - null - ] - }, - { - "move": "f7f6", - "evaluation": [ - -593, - null - ] - }, - { - "move": "g7g5", - "evaluation": [ - -592, - null - ] - }, - { - "move": "a7a5", - "evaluation": [ - -584, - null - ] - }, - { - "move": "c7c6", - "evaluation": [ - -576, - null - ] - }, - { - "move": "h7h6", - "evaluation": [ - -572, - null - ] - }, - { - "move": "g7g6", - "evaluation": [ - -571, - null - ] - }, - { - "move": "g8h8", - "evaluation": [ - -568, - null - ] - }, - { - "move": "e2e4", - "evaluation": [ - -568, - null - ] - }, - { - "move": "d6d5", - "evaluation": [ - -568, - null - ] - }, - { - "move": "e2e5", - "evaluation": [ - -565, - null - ] - }, - { - "move": "e2e8", - "evaluation": [ - -545, - null - ] - }, - { - "move": "a7a6", - "evaluation": [ - -542, - null - ] - }, - { - "move": "e2e7", - "evaluation": [ - -534, - null - ] - }, - { - "move": "b6a5", - "evaluation": [ - 43, - null - ] - }, - { - "move": "e2e6", - "evaluation": [ - 124, - null - ] - }, - { - "move": "e2f2", - "evaluation": [ - 157, - null - ] - }, - { - "move": "e2e3", - "evaluation": [ - 238, - null - ] - }, - { - "move": "e2a2", - "evaluation": [ - 254, - null - ] - }, - { - "move": "e2e1", - "evaluation": [ - 258, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "e8e2", - "evaluation": [ - -623, - null - ] - }, - { - "move": "e8f8", - "evaluation": [ - 247, - null - ] - }, - { - "move": "e8c8", - "evaluation": [ - 258, - null - ] - }, - { - "move": "g8f8", - "evaluation": [ - 266, - null - ] - }, - { - "move": "e8d8", - "evaluation": [ - 269, - null - ] - }, - { - "move": "e8b8", - "evaluation": [ - 273, - null - ] - }, - { - "move": "e8a8", - "evaluation": [ - 291, - null - ] - }, - { - "move": "e8e5", - "evaluation": [ - 328, - null - ] - }, - { - "move": "e8e4", - "evaluation": [ - 782, - null - ] - }, - { - "move": "e8e6", - "evaluation": [ - 795, - null - ] - }, - { - "move": "e8e3", - "evaluation": [ - 800, - null - ] - }, - { - "move": "g7g5", - "evaluation": [ - 801, - null - ] - }, - { - "move": "e8e7", - "evaluation": [ - 812, - null - ] - }, - { - "move": "g7g6", - "evaluation": [ - 852, - null - ] - }, - { - "move": "h7h6", - "evaluation": [ - 856, - null - ] - }, - { - "move": "h7h5", - "evaluation": [ - 881, - null - ] - }, - { - "move": "g8h8", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "b6a5", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "c7c6", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "a7a6", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "d6d5", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "c5c4", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "a7a5", - "evaluation": [ - null, - 1 - ] - }, - { - "move": "f7f6", - "evaluation": [ - null, - 3 - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "h3f5", - "evaluation": [ - -642, - null - ] - }, - { - "move": "h3h6", - "evaluation": [ - 203, - null - ] - }, - { - "move": "h3g3", - "evaluation": [ - 1327, - null - ] - }, - { - "move": "h3h2", - "evaluation": [ - 1335, - null - ] - }, - { - "move": "h3h4", - "evaluation": [ - 1393, - null - ] - }, - { - "move": "c5c4", - "evaluation": [ - 1403, - null - ] - }, - { - "move": "e8e6", - "evaluation": [ - 1421, - null - ] - }, - { - "move": "e8e7", - "evaluation": [ - 1424, - null - ] - }, - { - "move": "h3g4", - "evaluation": [ - 1424, - null - ] - }, - { - "move": "g8h8", - "evaluation": [ - 1431, - null - ] - }, - { - "move": "h3h5", - "evaluation": [ - 1431, - null - ] - }, - { - "move": "h3f1", - "evaluation": [ - 1431, - null - ] - }, - { - "move": "h7h6", - "evaluation": [ - 1431, - null - ] - }, - { - "move": "e8e5", - "evaluation": [ - 1432, - null - ] - }, - { - "move": "g7g6", - "evaluation": [ - 1432, - null - ] - }, - { - "move": "e8a8", - "evaluation": [ - 1439, - null - ] - }, - { - "move": "e8f8", - "evaluation": [ - 1440, - null - ] - }, - { - "move": "a7a5", - "evaluation": [ - 1442, - null - ] - }, - { - "move": "b6a5", - "evaluation": [ - 1444, - null - ] - }, - { - "move": "e8b8", - "evaluation": [ - 1445, - null - ] - }, - { - "move": "h3g2", - "evaluation": [ - 1447, - null - ] - }, - { - "move": "d6d5", - "evaluation": [ - 1453, - null - ] - }, - { - "move": "g7g5", - "evaluation": [ - 1460, - null - ] - }, - { - "move": "h7h5", - "evaluation": [ - 1501, - null - ] - }, - { - "move": "a7a6", - "evaluation": [ - 1511, - null - ] - }, - { - "move": "f7f6", - "evaluation": [ - 1516, - null - ] - }, - { - "move": "g8f8", - "evaluation": [ - 1530, - null - ] - }, - { - "move": "c7c6", - "evaluation": [ - 1776, - null - ] - }, - { - "move": "e8d8", - "evaluation": [ - 1794, - null - ] - }, - { - "move": "e8e4", - "evaluation": [ - 1958, - null - ] - }, - { - "move": "e8c8", - "evaluation": [ - 2108, - null - ] - } - ], - "strict": true - } - }, - "is_complete": true - } -] \ No newline at end of file diff --git a/test/data/is_complete.json b/test/data/is_complete.json index fd26a0b..8e6868d 100644 --- a/test/data/is_complete.json +++ b/test/data/is_complete.json @@ -9,7 +9,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 12, "move_stack": [ @@ -83,7 +85,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 13, "move_stack": [ @@ -146,10 +150,10 @@ "player_turn": true, "best_move": { "move": "c3e4", - "ponder": "e8g8" + "ponder": "c6e4" }, "evaluation": [ - 328, + 274, null ], "next_position": { @@ -159,7 +163,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 13, "move_stack": [ @@ -225,7 +231,7 @@ "ponder": "d3e4" }, "evaluation": [ - -283, + -296, null ], "next_position": { @@ -235,7 +241,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 14, "move_stack": [ @@ -301,7 +309,7 @@ "ponder": "d7d5" }, "evaluation": [ - 283, + 300, null ], "next_position": { @@ -311,7 +319,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 14, "move_stack": [ @@ -374,10 +384,10 @@ "player_turn": false, "best_move": { "move": "d7d5", - "ponder": "e4d3" + "ponder": "c2c3" }, "evaluation": [ - -251, + -283, null ], "next_position": { @@ -387,7 +397,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 15, "move_stack": [ @@ -450,21 +462,23 @@ }, "player_turn": true, "best_move": { - "move": "e4d3", - "ponder": "d4a1" + "move": "c2c3", + "ponder": "d4f2" }, "evaluation": [ - 255, + 316, null ], "next_position": { "position": { - "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1b4/P2B4/2PB1PPP/R2Q1RK1 b kq - 1 15", + "fen": "r3k2r/5ppp/pq2p3/1p1p4/1P1bB3/P1P5/3B1PPP/R2Q1RK1 b kq - 0 15", "aliases": [ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 15, "move_stack": [ @@ -496,7 +510,7 @@ "c6e4", "d3e4", "d7d5", - "e4d3" + "c2c3" ], "uci_variant": "chess", "piece_map": { @@ -511,15 +525,15 @@ "40": "p", "35": "p", "33": "p", + "28": "B", "27": "b", "25": "P", - "19": "B", + "18": "P", "16": "P", "15": "P", "14": "P", "13": "P", "11": "B", - "10": "P", "6": "K", "5": "R", "3": "Q", @@ -531,1951 +545,703 @@ "evaluation": null, "next_position": null, "analysed_legals": [], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [ { "move": "c2c3", "evaluation": [ - -277, + -272, null ] }, { "move": "e4d3", "evaluation": [ - -200, + -201, null ] }, { "move": "e4f3", "evaluation": [ - -197, + -180, null ] }, { "move": "e4d5", "evaluation": [ - -118, + -128, null ] }, { "move": "e4f5", "evaluation": [ - 1, + -87, null ] }, { "move": "a3a4", "evaluation": [ - 39, + 1, null ] }, { - "move": "d2e3", + "move": "d1e1", "evaluation": [ - 44, + 17, null ] }, { - "move": "a1c1", + "move": "d2e3", "evaluation": [ - 44, + 36, null ] }, { - "move": "d1e1", + "move": "a1c1", "evaluation": [ 56, null ] }, { - "move": "a1a2", + "move": "d2f4", "evaluation": [ - 118, + 102, null ] }, { - "move": "c2c4", + "move": "h2h3", "evaluation": [ - 119, + 105, null ] }, { - "move": "d1e2", + "move": "c2c4", "evaluation": [ - 133, + 106, null ] }, { - "move": "h2h3", + "move": "a1b1", "evaluation": [ - 134, + 112, null ] }, { - "move": "h2h4", + "move": "d1g4", "evaluation": [ - 134, + 114, null ] }, { - "move": "d1f3", + "move": "d1e2", "evaluation": [ - 137, + 120, null ] }, { - "move": "d1g4", + "move": "a1a2", "evaluation": [ - 138, + 132, null ] }, { - "move": "d2f4", + "move": "g1h1", "evaluation": [ - 153, + 133, null ] }, { - "move": "d2c1", + "move": "g2g3", "evaluation": [ - 157, + 140, null ] }, { - "move": "d1c1", + "move": "d2g5", "evaluation": [ - 172, + 148, null ] }, { - "move": "a1b1", + "move": "h2h4", "evaluation": [ - 174, + 153, null ] }, { - "move": "g1h1", + "move": "d2h6", "evaluation": [ - 178, + 158, null ] }, { - "move": "e4h7", + "move": "d1c1", "evaluation": [ - 180, + 158, null ] }, { - "move": "e4g6", + "move": "d1b1", "evaluation": [ - 195, + 166, null ] }, { - "move": "d2h6", + "move": "d1f3", "evaluation": [ - 200, + 176, null ] }, { "move": "d2e1", "evaluation": [ - 205, + 184, null ] }, { - "move": "g2g3", + "move": "d2c1", "evaluation": [ - 227, + 184, null ] }, { - "move": "d2g5", + "move": "e4h7", "evaluation": [ - 232, + 218, null ] }, { - "move": "d1h5", + "move": "g2g4", "evaluation": [ - 250, + 223, null ] }, { - "move": "g2g4", + "move": "e4g6", "evaluation": [ - 316, + 238, null ] }, { - "move": "d1b1", + "move": "d1h5", "evaluation": [ - 320, + 259, null ] }, { "move": "f1e1", "evaluation": [ - 351, + 330, null ] }, { "move": "d2c3", "evaluation": [ - 439, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "d3e4", - "evaluation": [ - -298, - null - ] - }, - { - "move": "a1c1", - "evaluation": [ - 118, - null - ] - }, - { - "move": "d2e3", - "evaluation": [ - 147, - null - ] - }, - { - "move": "c2c3", - "evaluation": [ - 151, - null - ] - }, - { - "move": "a1b1", - "evaluation": [ - 180, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - 196, - null - ] - }, - { - "move": "d2c3", - "evaluation": [ - 229, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 249, - null - ] - }, - { - "move": "d2f4", - "evaluation": [ - 258, - null - ] - }, - { - "move": "a1a2", - "evaluation": [ - 268, - null - ] - }, - { - "move": "a3a4", - "evaluation": [ - 269, - null - ] - }, - { - "move": "d2g5", - "evaluation": [ - 274, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - 276, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 285, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - 291, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - 306, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - 308, - null - ] - }, - { - "move": "d1b1", - "evaluation": [ - 314, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - 319, - null - ] - }, - { - "move": "d3e2", - "evaluation": [ - 325, - null - ] - }, - { - "move": "c2c4", - "evaluation": [ - 325, - null - ] - }, - { - "move": "d2e1", - "evaluation": [ - 343, - null - ] - }, - { - "move": "d2h6", - "evaluation": [ - 347, - null - ] - }, - { - "move": "d2c1", - "evaluation": [ - 397, - null - ] - }, - { - "move": "f1e1", - "evaluation": [ - 405, - null - ] - }, - { - "move": "d3c4", - "evaluation": [ - 633, - null - ] - }, - { - "move": "d3b5", - "evaluation": [ - 658, - null - ] - }, - { - "move": "g2g3", - "evaluation": [ - 916, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - 1150, - null - ] - }, - { - "move": "g2g4", - "evaluation": [ - 1462, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "c3e4", - "evaluation": [ - -290, - null - ] - }, - { - "move": "d3e4", - "evaluation": [ - -24, - null - ] - }, - { - "move": "d1e1", - "evaluation": [ - 266, - null - ] - }, - { - "move": "c3e2", - "evaluation": [ - 555, - null - ] - }, - { - "move": "c3b5", - "evaluation": [ - 568, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - 578, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - 599, - null - ] - }, - { - "move": "c3a2", - "evaluation": [ - 600, - null - ] - }, - { - "move": "a1c1", - "evaluation": [ - 603, - null - ] - }, - { - "move": "c3b1", - "evaluation": [ - 608, - null - ] - }, - { - "move": "c3a4", - "evaluation": [ - 609, - null - ] - }, - { - "move": "c3d5", - "evaluation": [ - 611, - null - ] - }, - { - "move": "a3a4", - "evaluation": [ - 611, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - 613, - null - ] - }, - { - "move": "d2e3", - "evaluation": [ - 641, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - 654, - null - ] - }, - { - "move": "d3b5", - "evaluation": [ - 668, - null - ] - }, - { - "move": "d3e2", - "evaluation": [ - 671, - null - ] - }, - { - "move": "d2c1", - "evaluation": [ - 689, - null - ] - }, - { - "move": "a1b1", - "evaluation": [ - 689, - null - ] - }, - { - "move": "a1a2", - "evaluation": [ - 693, - null - ] - }, - { - "move": "d2f4", - "evaluation": [ - 699, - null - ] - }, - { - "move": "d2e1", - "evaluation": [ - 728, - null - ] - }, - { - "move": "d3c4", - "evaluation": [ - 769, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 810, - null - ] - }, - { - "move": "d2g5", - "evaluation": [ - 839, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - 893, - null - ] - }, - { - "move": "d2h6", - "evaluation": [ - 1018, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - 1047, - null - ] - }, - { - "move": "d1b1", - "evaluation": [ - 1094, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - 1151, - null - ] - }, - { - "move": "f1e1", - "evaluation": [ - 1207, - null - ] - }, - { - "move": "g2g3", - "evaluation": [ - 1545, - null - ] - }, - { - "move": "g2g4", - "evaluation": [ - 1678, - null - ] - } - ], - "strict": true - } - }, - "is_complete": true - }, - { - "puzzle": { - "game_id": "2", - "category": "Material", - "last_pos": { - "fen": "r3r1k1/p1pq1ppp/2pp4/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 b - - 4 15", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 15, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "60": "r", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "q", - "50": "p", - "48": "p", - "43": "p", - "42": "p", - "36": "b", - "28": "P", - "24": "N", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "last_move": "e8e6", - "move_list": [ - "a4c5", - "d7e7", - "c5e6", - "e7e6" - ], - "positions": { - "position": { - "fen": "r5k1/p1pq1ppp/2ppr3/4b3/N3P3/6P1/PPP2P1P/1R1QR1K1 w - - 5 16", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 16, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "q", - "50": "p", - "48": "p", - "44": "r", - "43": "p", - "42": "p", - "36": "b", - "28": "P", - "24": "N", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "a4c5", - "ponder": "d7e8" - }, - "evaluation": [ - 253, - null - ], - "next_position": { - "position": { - "fen": "r5k1/p1pq1ppp/2ppr3/2N1b3/4P3/6P1/PPP2P1P/1R1QR1K1 b - - 6 16", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 16, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "51": "q", - "50": "p", - "48": "p", - "44": "r", - "43": "p", - "42": "p", - "36": "b", - "34": "N", - "28": "P", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "d7e7", - "ponder": "c5e6" - }, - "evaluation": [ - -234, - null - ], - "next_position": { - "position": { - "fen": "r5k1/p1p1qppp/2ppr3/2N1b3/4P3/6P1/PPP2P1P/1R1QR1K1 w - - 7 17", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 17, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "52": "q", - "50": "p", - "48": "p", - "44": "r", - "43": "p", - "42": "p", - "36": "b", - "34": "N", - "28": "P", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "c5e6", - "ponder": "e7e6" - }, - "evaluation": [ - 255, - null - ], - "next_position": { - "position": { - "fen": "r5k1/p1p1qppp/2ppN3/4b3/4P3/6P1/PPP2P1P/1R1QR1K1 b - - 0 17", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 17, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "52": "q", - "50": "p", - "48": "p", - "44": "N", - "43": "p", - "42": "p", - "36": "b", - "28": "P", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": false, - "best_move": { - "move": "e7e6", - "ponder": "a2a3" - }, - "evaluation": [ - -238, - null - ], - "next_position": { - "position": { - "fen": "r5k1/p1p2ppp/2ppq3/4b3/4P3/6P1/PPP2P1P/1R1QR1K1 w - - 0 18", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 18, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "44": "q", - "43": "p", - "42": "p", - "36": "b", - "28": "P", - "22": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "8": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": true, - "best_move": { - "move": "a2a3", - "ponder": "g7g6" - }, - "evaluation": [ - 270, - null - ], - "next_position": { - "position": { - "fen": "r5k1/p1p2ppp/2ppq3/4b3/4P3/P5P1/1PP2P1P/1R1QR1K1 b - - 0 18", - "aliases": [ - "Standard", - "Chess", - "Classical", - "Normal" - ], - "fullmove_number": 18, - "move_stack": [ - "e2e4", - "e7e5", - "g1f3", - "d7d6", - "d2d4", - "e5d4", - "f3d4", - "b8c6", - "f1b5", - "c8d7", - "b5c6", - "d7c6", - "b1c3", - "g8f6", - "c1g5", - "f8e7", - "g5f6", - "e7f6", - "d4c6", - "b7c6", - "e1g1", - "e8g8", - "f1e1", - "f6e5", - "g2g3", - "d8d7", - "a1b1", - "f8e8", - "c3a4", - "e8e6", - "a4c5", - "d7e7", - "c5e6", - "e7e6", - "a2a3" - ], - "uci_variant": "chess", - "piece_map": { - "62": "k", - "56": "r", - "55": "p", - "54": "p", - "53": "p", - "50": "p", - "48": "p", - "44": "q", - "43": "p", - "42": "p", - "36": "b", - "28": "P", - "22": "P", - "16": "P", - "15": "P", - "13": "P", - "10": "P", - "9": "P", - "6": "K", - "4": "R", - "3": "Q", - "1": "R" - } - }, - "player_turn": false, - "best_move": null, - "evaluation": null, - "next_position": null, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "a2a3", - "evaluation": [ - -236, - null - ] - }, - { - "move": "a2a4", - "evaluation": [ - -228, - null - ] - }, - { - "move": "f2f4", - "evaluation": [ - -227, - null - ] - }, - { - "move": "b2b3", - "evaluation": [ - -207, - null - ] - }, - { - "move": "d1f3", - "evaluation": [ - -184, - null - ] - }, - { - "move": "d1e2", - "evaluation": [ - -183, - null - ] - }, - { - "move": "d1d2", - "evaluation": [ - -172, - null - ] - }, - { - "move": "e1e2", - "evaluation": [ - -168, - null - ] - }, - { - "move": "h2h4", - "evaluation": [ - -166, - null - ] - }, - { - "move": "c2c3", - "evaluation": [ - -157, - null - ] - }, - { - "move": "e1e3", - "evaluation": [ - -148, - null - ] - }, - { - "move": "b2b4", - "evaluation": [ - -146, - null - ] - }, - { - "move": "c2c4", - "evaluation": [ - -140, - null - ] - }, - { - "move": "f2f3", - "evaluation": [ - -133, - null - ] - }, - { - "move": "d1h5", - "evaluation": [ - -130, - null - ] - }, - { - "move": "g1f1", - "evaluation": [ - -128, - null - ] - }, - { - "move": "e1f1", - "evaluation": [ - -123, - null - ] - }, - { - "move": "g1g2", - "evaluation": [ - -118, - null - ] - }, - { - "move": "g1h1", - "evaluation": [ - -113, - null - ] - }, - { - "move": "d1c1", - "evaluation": [ - -106, - null - ] - }, - { - "move": "h2h3", - "evaluation": [ - -100, - null - ] - }, - { - "move": "d1d3", - "evaluation": [ - -97, - null - ] - }, - { - "move": "b1a1", - "evaluation": [ - -56, - null - ] - }, - { - "move": "b1c1", - "evaluation": [ - -40, - null - ] - }, - { - "move": "g3g4", - "evaluation": [ - -40, - null - ] - }, - { - "move": "d1d6", - "evaluation": [ - 1144, - null - ] - }, - { - "move": "d1g4", - "evaluation": [ - 1165, - null - ] - }, - { - "move": "d1d5", - "evaluation": [ - 1197, - null - ] - }, - { - "move": "d1d4", - "evaluation": [ - 1243, - null - ] - } - ], - "strict": true - }, - "analysed_legals": [], - "strict": true - }, - "analysed_legals": [ - { - "move": "c5e6", - "evaluation": [ - -223, - null - ] - }, - { - "move": "c5b3", - "evaluation": [ - 80, - null - ] - }, - { - "move": "c5d3", - "evaluation": [ - 90, - null - ] - }, - { - "move": "c5a4", - "evaluation": [ - 110, - null - ] - }, - { - "move": "c5a6", - "evaluation": [ - 130, - null - ] - }, - { - "move": "c5b7", - "evaluation": [ - 134, - null - ] + 428, + null + ] + } + ], + "strict": true, + "is_ambiguous": true }, + "analysed_legals": [], + "strict": true, + "is_ambiguous": false + }, + "analysed_legals": [ { - "move": "f2f4", + "move": "d3e4", "evaluation": [ - 172, + -326, null ] }, { - "move": "g1f1", + "move": "c2c3", "evaluation": [ - 281, + 102, null ] }, { - "move": "g1h1", + "move": "d2e3", "evaluation": [ - 351, + 149, null ] }, { - "move": "d1e2", + "move": "a1c1", "evaluation": [ - 359, + 165, null ] }, { - "move": "c5d7", + "move": "a1b1", "evaluation": [ - 385, + 200, null ] }, { - "move": "g1g2", + "move": "d1g4", "evaluation": [ - 389, + 266, null ] }, { - "move": "c2c3", + "move": "d1e2", "evaluation": [ - 393, + 281, null ] }, { - "move": "b1a1", + "move": "d2g5", "evaluation": [ - 405, + 285, null ] }, { - "move": "d1d3", + "move": "a3a4", "evaluation": [ - 412, + 293, null ] }, { - "move": "e1f1", + "move": "d1e1", "evaluation": [ - 420, + 297, null ] }, { - "move": "a2a4", + "move": "h2h4", "evaluation": [ - 425, + 300, null ] }, { - "move": "e1e3", + "move": "g1h1", "evaluation": [ - 429, + 305, null ] }, { - "move": "b1c1", + "move": "a1a2", "evaluation": [ - 429, + 308, null ] }, { - "move": "d1g4", + "move": "d3e2", "evaluation": [ - 433, + 312, null ] }, { - "move": "f2f3", + "move": "d2f4", "evaluation": [ - 443, + 314, null ] }, { - "move": "d1f3", + "move": "h2h3", "evaluation": [ - 448, + 316, null ] }, { - "move": "e1e2", + "move": "d1b1", "evaluation": [ - 450, + 324, null ] }, { "move": "d1c1", "evaluation": [ - 456, + 326, null ] }, { - "move": "d1d2", + "move": "d2e1", "evaluation": [ - 459, + 351, null ] }, { "move": "c2c4", "evaluation": [ - 460, + 374, null ] }, { - "move": "a2a3", + "move": "d2c1", "evaluation": [ - 464, + 378, null ] }, { - "move": "h2h4", + "move": "d1h5", "evaluation": [ - 475, + 393, null ] }, { - "move": "h2h3", + "move": "d2h6", "evaluation": [ - 478, + 404, null ] }, { - "move": "d1h5", + "move": "f1e1", "evaluation": [ - 486, + 407, null ] }, { - "move": "b2b3", + "move": "d2c3", "evaluation": [ - 506, + 433, null ] }, { - "move": "b2b4", + "move": "d3b5", "evaluation": [ - 553, + 587, null ] }, { - "move": "g3g4", + "move": "d3c4", "evaluation": [ - 646, + 640, null ] }, { - "move": "d1d5", + "move": "g2g4", "evaluation": [ - 1166, + 806, null ] }, { - "move": "d1d4", + "move": "g2g3", "evaluation": [ - 1193, + 1005, null ] }, { - "move": "d1d6", + "move": "d1f3", "evaluation": [ - 1210, + 1155, null ] } ], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [ { - "move": "a4c5", + "move": "c3e4", "evaluation": [ - -225, + -283, null ] }, { - "move": "f2f4", + "move": "d3e4", "evaluation": [ - -33, + -18, null ] }, { - "move": "d1d2", + "move": "d1e1", "evaluation": [ - 68, + 281, null ] }, { - "move": "a4c3", + "move": "c3e2", "evaluation": [ - 75, + 496, null ] }, { - "move": "h2h3", + "move": "c3b1", "evaluation": [ - 78, + 559, null ] }, { - "move": "g1g2", + "move": "c3b5", "evaluation": [ - 82, + 587, null ] }, { - "move": "h2h4", + "move": "a3a4", + "evaluation": [ + 602, + null + ] + }, + { + "move": "c3a4", + "evaluation": [ + 620, + null + ] + }, + { + "move": "d2e3", + "evaluation": [ + 623, + null + ] + }, + { + "move": "d2f4", "evaluation": [ - 89, + 666, null ] }, { - "move": "e1e3", + "move": "a1b1", "evaluation": [ - 92, + 673, null ] }, { - "move": "a2a3", + "move": "d2e1", "evaluation": [ - 107, + 680, null ] }, { - "move": "e1e2", + "move": "c3d5", "evaluation": [ - 109, + 683, null ] }, { "move": "d1e2", "evaluation": [ - 113, + 683, null ] }, { - "move": "c2c3", + "move": "d3e2", "evaluation": [ - 115, + 685, null ] }, { - "move": "d1h5", + "move": "a1c1", "evaluation": [ - 122, + 685, null ] }, { - "move": "d1g4", + "move": "g1h1", "evaluation": [ - 133, + 697, null ] }, { - "move": "b2b4", + "move": "h2h3", "evaluation": [ - 135, + 716, null ] }, { - "move": "e1f1", + "move": "c3a2", "evaluation": [ - 136, + 720, null ] }, { - "move": "b2b3", + "move": "a1a2", "evaluation": [ - 136, + 720, null ] }, { - "move": "c2c4", + "move": "d2c1", "evaluation": [ - 145, + 747, null ] }, { - "move": "d1d3", + "move": "d1c1", "evaluation": [ - 195, + 760, null ] }, { - "move": "b1c1", + "move": "d1g4", "evaluation": [ - 203, + 782, null ] }, { - "move": "b1a1", + "move": "d2g5", "evaluation": [ - 224, + 803, null ] }, { - "move": "d1f3", + "move": "d3b5", "evaluation": [ - 232, + 828, null ] }, { - "move": "d1c1", + "move": "d3c4", "evaluation": [ - 253, + 860, null ] }, { - "move": "f2f3", + "move": "h2h4", "evaluation": [ - 283, + 885, null ] }, { - "move": "g1f1", + "move": "d1h5", "evaluation": [ - 325, + 891, null ] }, { - "move": "g3g4", + "move": "f1e1", "evaluation": [ - 439, + 916, null ] }, { - "move": "a4b6", + "move": "d1b1", "evaluation": [ - 465, + 956, null ] }, { - "move": "g1h1", + "move": "d2h6", "evaluation": [ - 600, + 1107, null ] }, { - "move": "d1d6", + "move": "d1f3", "evaluation": [ - 1270, + 1235, null ] }, { - "move": "d1d5", + "move": "g2g3", "evaluation": [ - 1354, + 1559, null ] }, { - "move": "d1d4", + "move": "g2g4", "evaluation": [ - 1378, + 1568, null ] } ], - "strict": true + "strict": true, + "is_ambiguous": false } }, "is_complete": true @@ -2490,7 +1256,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 24, "move_stack": [ @@ -2580,7 +1348,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 24, "move_stack": [ @@ -2663,7 +1433,7 @@ "ponder": "e4f5" }, "evaluation": [ - 653, + 713, null ], "next_position": { @@ -2673,7 +1443,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 25, "move_stack": [ @@ -2756,7 +1528,7 @@ "ponder": "e8e2" }, "evaluation": [ - -623, + -631, null ], "next_position": { @@ -2766,7 +1538,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 25, "move_stack": [ @@ -2849,7 +1623,7 @@ "ponder": "c2c4" }, "evaluation": [ - 690, + 650, null ], "next_position": { @@ -2859,7 +1633,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 26, "move_stack": [ @@ -2939,10 +1715,10 @@ "player_turn": false, "best_move": { "move": "c2c4", - "ponder": "g8f8" + "ponder": "a7a5" }, "evaluation": [ - -607, + -619, null ], "next_position": { @@ -2952,7 +1728,9 @@ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 26, "move_stack": [ @@ -3032,21 +1810,23 @@ }, "player_turn": true, "best_move": { - "move": "h7h5", - "ponder": "h2h3" + "move": "a7a5", + "ponder": "g1g2" }, "evaluation": [ - 631, + 633, null ], "next_position": { "position": { - "fen": "6k1/p1p2pp1/1b1p4/2p2P1p/2P5/1P4P1/4rP1P/R5K1 w - - 0 27", + "fen": "6k1/2p2ppp/1b1p4/p1p2P2/2P5/1P4P1/4rP1P/R5K1 w - - 0 27", "aliases": [ "Standard", "Chess", "Classical", - "Normal" + "Normal", + "Illegal", + "From Position" ], "fullmove_number": 27, "move_stack": [ @@ -3101,20 +1881,20 @@ "e4f5", "e8e2", "c2c4", - "h7h5" + "a7a5" ], "uci_variant": "chess", "piece_map": { "62": "k", + "55": "p", "54": "p", "53": "p", "50": "p", - "48": "p", "43": "p", "41": "b", - "39": "p", "37": "P", "34": "p", + "32": "p", "26": "P", "22": "P", "17": "P", @@ -3130,293 +1910,296 @@ "evaluation": null, "next_position": null, "analysed_legals": [], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [ { "move": "e2b2", "evaluation": [ - -625, + -652, null ] }, { - "move": "e2d2", + "move": "a7a5", "evaluation": [ - -615, + -628, null ] }, { - "move": "g8f8", + "move": "e2c2", "evaluation": [ - -613, + -623, null ] }, { - "move": "e2c2", + "move": "f7f6", "evaluation": [ - -592, + -614, null ] }, { - "move": "g7g5", + "move": "g8f8", "evaluation": [ - -592, + -607, null ] }, { - "move": "a7a5", + "move": "g7g5", "evaluation": [ - -592, + -594, null ] }, { - "move": "d6d5", + "move": "h7h5", "evaluation": [ - -589, + -592, null ] }, { - "move": "e2e5", + "move": "e2e7", "evaluation": [ - -584, + -591, null ] }, { - "move": "h7h5", + "move": "h7h6", "evaluation": [ - -584, + -590, null ] }, { - "move": "h7h6", + "move": "g7g6", "evaluation": [ - -582, + -586, null ] }, { "move": "c7c6", "evaluation": [ - -582, + -583, null ] }, { - "move": "f7f6", + "move": "e2d2", "evaluation": [ -578, null ] }, { - "move": "g7g6", + "move": "e2e5", "evaluation": [ - -565, + -571, null ] }, { "move": "g8h8", "evaluation": [ - -557, + -566, null ] }, { - "move": "e2e4", + "move": "e2e8", "evaluation": [ - -549, + -553, null ] }, { - "move": "e2e8", + "move": "d6d5", "evaluation": [ - -538, + -551, null ] }, { - "move": "e2e7", + "move": "e2e4", "evaluation": [ - -533, + -540, null ] }, { "move": "a7a6", "evaluation": [ - -533, + -501, null ] }, { "move": "b6a5", "evaluation": [ - 25, + -1, null ] }, { "move": "e2e6", "evaluation": [ - 123, + 118, null ] }, { "move": "e2f2", "evaluation": [ - 188, + 155, null ] }, { - "move": "e2e3", + "move": "e2e1", "evaluation": [ - 246, + 237, null ] }, { - "move": "e2a2", + "move": "e2e3", "evaluation": [ - 250, + 246, null ] }, { - "move": "e2e1", + "move": "e2a2", "evaluation": [ - 297, + 254, null ] } ], - "strict": true + "strict": true, + "is_ambiguous": true }, "analysed_legals": [], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [ { "move": "e8e2", "evaluation": [ - -646, + -627, null ] }, { - "move": "g8f8", + "move": "e8a8", "evaluation": [ - 254, + 259, null ] }, { - "move": "e8b8", + "move": "e8d8", "evaluation": [ - 259, + 263, null ] }, { - "move": "e8a8", + "move": "e8c8", "evaluation": [ - 265, + 269, null ] }, { - "move": "e8c8", + "move": "e8b8", "evaluation": [ - 266, + 269, null ] }, { - "move": "e8d8", + "move": "g8f8", "evaluation": [ - 267, + 271, null ] }, { - "move": "e8e5", + "move": "e8f8", "evaluation": [ - 312, + 285, null ] }, { - "move": "e8f8", + "move": "e8e5", "evaluation": [ - 320, + 305, null ] }, { - "move": "g7g5", + "move": "e8e7", "evaluation": [ - 775, + 783, null ] }, { - "move": "g7g6", + "move": "e8e6", "evaluation": [ - 781, + 797, null ] }, { - "move": "e8e7", + "move": "e8e4", "evaluation": [ - 792, + 814, null ] }, { - "move": "e8e6", + "move": "g7g5", "evaluation": [ - 829, + 832, null ] }, { - "move": "e8e3", + "move": "g7g6", "evaluation": [ - 836, + 855, null ] }, { - "move": "e8e4", + "move": "e8e3", "evaluation": [ - 869, + 877, null ] }, { - "move": "h7h6", + "move": "h7h5", "evaluation": [ - 895, + 883, null ] }, { - "move": "h7h5", + "move": "h7h6", "evaluation": [ - 895, + 916, null ] }, @@ -3477,37 +2260,39 @@ ] } ], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [], - "strict": true + "strict": true, + "is_ambiguous": false }, "analysed_legals": [ { "move": "h3f5", "evaluation": [ - -609, + -750, null ] }, { "move": "h3h6", "evaluation": [ - 223, + 262, null ] }, { "move": "h3h2", "evaluation": [ - 1331, + 1325, null ] }, { "move": "h3g3", "evaluation": [ - 1340, + 1327, null ] }, @@ -3521,187 +2306,188 @@ { "move": "c5c4", "evaluation": [ - 1414, + 1410, null ] }, { - "move": "g7g6", + "move": "c7c6", "evaluation": [ - 1421, + 1413, null ] }, { - "move": "h7h6", + "move": "e8c8", "evaluation": [ - 1423, + 1422, null ] }, { - "move": "h3h5", + "move": "e8e7", "evaluation": [ - 1426, + 1423, null ] }, { - "move": "h3g4", + "move": "e8e6", "evaluation": [ - 1426, + 1425, null ] }, { - "move": "e8e7", + "move": "e8e5", "evaluation": [ - 1427, + 1430, null ] }, { - "move": "f7f6", + "move": "h3h5", "evaluation": [ - 1428, + 1430, null ] }, { - "move": "e8d8", + "move": "h3g4", "evaluation": [ - 1429, + 1432, null ] }, { - "move": "e8e5", + "move": "g7g5", "evaluation": [ - 1429, + 1433, null ] }, { - "move": "e8e6", + "move": "g7g6", "evaluation": [ - 1430, + 1435, null ] }, { - "move": "a7a5", + "move": "g8f8", "evaluation": [ - 1430, + 1436, null ] }, { - "move": "e8f8", + "move": "h3f1", "evaluation": [ - 1431, + 1437, null ] }, { - "move": "h3f1", + "move": "a7a5", "evaluation": [ - 1431, + 1437, null ] }, { - "move": "g8h8", + "move": "e8b8", "evaluation": [ - 1432, + 1440, null ] }, { - "move": "h7h5", + "move": "h7h6", "evaluation": [ - 1432, + 1440, null ] }, { - "move": "g8f8", + "move": "e8a8", "evaluation": [ - 1435, + 1441, null ] }, { - "move": "d6d5", + "move": "e8f8", "evaluation": [ - 1435, + 1442, null ] }, { - "move": "e8a8", + "move": "e8d8", "evaluation": [ - 1437, + 1442, null ] }, { - "move": "c7c6", + "move": "b6a5", "evaluation": [ - 1437, + 1446, null ] }, { - "move": "b6a5", + "move": "d6d5", "evaluation": [ - 1438, + 1446, null ] }, { "move": "h3g2", "evaluation": [ - 1441, + 1456, null ] }, { - "move": "e8b8", + "move": "g8h8", "evaluation": [ - 1445, + 1466, null ] }, { - "move": "e8c8", + "move": "a7a6", "evaluation": [ - 1448, + 1501, null ] }, { - "move": "a7a6", + "move": "h7h5", "evaluation": [ - 1495, + 1511, null ] }, { - "move": "g7g5", + "move": "f7f6", "evaluation": [ - 1536, + 1529, null ] }, { "move": "e8e4", "evaluation": [ - 1962, + 2036, null ] } ], - "strict": true + "strict": true, + "is_ambiguous": false } }, "is_complete": true diff --git a/test/unit/test_regression.py b/test/unit/test_regression.py index 1b9c62b..f57d66a 100644 --- a/test/unit/test_regression.py +++ b/test/unit/test_regression.py @@ -61,9 +61,8 @@ def test_mambigos(self): for definition in TestRegression.complete_test_data: logging.debug(f"Testing puzzle {definition}") - expected_result = definition['is_complete'] - pd = definition['puzzle'] + expected_result = pd['positions']['is_ambiguous'] puzzle = puzzle_from_dict(pd) result = puzzle.positions.ambiguous()