<jupyter_start><jupyter_text>Usar combinação do std/kmeans para gerar lista de jogadas abaixo<jupyter_code>array_jogadas_0 = np.load("Jogos/0/array_jogadas_0.npy")
array_geral_0 = np.load("Jogos/0/array_geral_0.npy")

array_geral_0.shape, array_jogadas_0.shape
def push_board(board, move):
    board.push_uci(move)
def jogo_ate_i(array_de_jogadas, i = 9999):
    board = chess.Board()
    for jogada in array_de_jogadas[:i]:
        push_board(board, jogada)
    return board
def converte_notacao_xadrez_afonso(square_number):
    return (63 - square_number)//8, 7 - (63 - square_number)%8
def generate_matrix_board(array_jogadas, i):
    board = jogo_ate_i(array_jogadas, i)
    tabuleiro = np.array([(converte_notacao_xadrez_afonso(i), x.symbol()) for i, x in board.piece_map().items()])
    matrix = np.chararray((8, 8))
    matrix[:] = "_"

    for i, x in tabuleiro:
        matrix[i[0], i[1]] = x
    return matrix
generate_matrix_board(array_jogadas_0, i = 5)
print(jogo_ate_i(array_jogadas_0, 3))
def save_labels(n_jogo, n_jogada, matrix, array_geral):
    for i in range(8):
        for j in range(8):
            peca = matrix[i, j].decode("utf-8")
            cv2.imwrite("Labels/{}/{}_{}_{}{}.png".format(peca, n_jogo, n_jogada, i, j), array_geral[n_jogada][i][j])
    return
def save_all_labels_in_game(n_jogo):
    array_jogadas = np.load("Jogos/{}/array_jogadas_{}.npy".format(n_jogo, n_jogo))
    array_geral = np.load("Jogos/{}/array_geral_{}.npy".format(n_jogo, n_jogo))
    for i in range(len(array_jogadas)):
        n_jogada = i
        matrix = generate_matrix_board(array_jogadas, i = n_jogada)
        save_labels(0, n_jogada, matrix, array_geral)
#save_all_labels_in_game(0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13880855986119145, 'fraction_numerical': 0.019086176980913822, 'mean_word_length': 4.440251572327044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '284062', 'license': 'MIT', 'n_tokens_mistral': 733, 'n_tokens_neox': 719, 'n_words': 120, 'path': '17-04.ipynb', 'repo_name': 'rafaelmcam/cChess', 'size': '1729'}