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] 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) 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)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate(settings.depth) if i.is_complete(): puzzle_pgn = post_puzzle(i, settings.include_blunder) tactics_file.write(puzzle_pgn) tactics_file.write("\n\n") tactics_file.close()
prev_score = chess.uci.Score(None, None) 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(nodes=3500000) 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) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append(puzzle(node.board(), next_node.move, game_id, engine, info_handler)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate() if i.is_complete(): post_puzzle(settings.token, i, settings.name)
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) if True: logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append( puzzle(node.board(), next_node.move, str(game_id), engine, info_handler, game, settings.strict)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate(settings.depth) if i.is_complete(): games += 1 print(games) puzzle_pgn = post_puzzle(i) tactics_file.write(puzzle_pgn) tactics_file.write("\n\n") tactics_file.close()
prev_score = chess.uci.Score(None, None) 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(nodes=3500000) 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) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append(puzzle(node.board(), next_node.move, game_id, engine, info_handler)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate() if i.is_complete(): post_puzzle(settings.token, i)
prev_score = chess.uci.Score(None, None, False, False) 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(nodes=3500000) 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) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append(puzzle(node.board(), next_node.move, game_id, engine, info_handler)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate() if i.is_complete(): post_puzzle(settings.token, i, slack_key, settings.name)
prev_score = chess.uci.Score(None, None) 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] 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) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) currentPuzzle = puzzle(node.board(), next_node.move, str(game_id), engine, info_handler, game, settings.strict) currentPuzzle.generate(settings.depth) if currentPuzzle.is_complete(): puzzle_pgn = post_puzzle(currentPuzzle, settings.include_blunder) puzzle_json = currentPuzzle.to_json(settings.user, puzzle_pgn) insertPuzzle(puzzle_json) prev_score = cur_score node = next_node updateGame(game_id) except Exception as err: print(err)
logging.info("Analysing Game..." + bcolors.ENDC) engine.ucinewgame() while not node.is_end(): next_node = node.variation(0) engine.position(next_node.board()) engine.go(nodes=3500000) 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) if investigate(prev_score, cur_score, node.board()): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append( puzzle(node.board(), next_node.move, game_id, engine, info_handler)) prev_score = cur_score node = next_node for i in puzzles: logging.info(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate() if i.is_complete(): post_puzzle(i)
engine.ucinewgame() engine.setoption({'UCI_Variant': board.uci_variant}) while not node.is_end(): next_node = node.variation(0) b = next_node.board() engine.position(b) engine.go(nodes=3500000) 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) if investigate(prev_score, cur_score, node.board(), variant): logging.debug(bcolors.WARNING + " Investigate!" + bcolors.ENDC) puzzles.append( puzzle(node.board(), next_node.move, variant, engine, info_handler)) prev_score = cur_score node = next_node for i in puzzles: logging.debug(bcolors.WARNING + "Generating new puzzle..." + bcolors.ENDC) i.generate() if i.is_complete(): post_puzzle(cvt_cookies, i)