예제 #1
0
def test_generate_correct_sq_piece_data():
    state_gen = ExpertStateGenerator("bogus", 'csv', 8,
                                     "yureka/tests/test.pgn", 1)
    g = next(state_gen.get_game())
    df = pd.DataFrame(state_gen.get_game_data(g))
    assert set(df.loc[0, 'white_square_piece_0'].split(',')) == set(
        ('a1-R,b1-N,c1-B,d1-Q,e1-K,f1-B,g1-N,h1-R,a2-P,b2-P,c2-P,'
         'd2-P,e2-P,f2-P,g2-P,h2-P').split(','))
    assert set(df.loc[0, 'black_square_piece_0'].split(',')) == set(
        ('a7-p,b7-p,c7-p,d7-p,e7-p,f7-p,g7-p,h7-p,a8-r,b8-n,c8-b,'
         'd8-q,e8-k,f8-b,g8-n,h8-r').split(','))
    for i in range(1, 8):
        assert df.loc[0, 'white_square_piece_%d' % i] == ''
        assert df.loc[0, 'black_square_piece_%d' % i] == ''
    assert set(df.loc[1, 'white_square_piece_0'].split(',')) == set(
        ('h8-R,g8-N,f8-B,e8-Q,d8-K,c8-B,b8-N,a8-R,h7-P,g7-P,f7-P,'
         'e7-P,c7-P,b7-P,a7-P,d5-P').split(','))
    assert set(df.loc[1, 'black_square_piece_0'].split(',')) == set(
        ('h2-p,g2-p,f2-p,e2-p,d2-p,c2-p,b2-p,a2-p,h1-r,g1-n,f1-b,'
         'e1-q,d1-k,c1-b,b1-n,a1-r').split(','))
    assert set(df.loc[1, 'white_square_piece_1'].split(',')) == set(
        ('h8-R,g8-N,f8-B,e8-Q,d8-K,c8-B,b8-N,a8-R,h7-P,g7-P,f7-P,'
         'e7-P,c7-P,b7-P,a7-P,d7-P').split(','))
    assert set(df.loc[1, 'black_square_piece_1'].split(',')) == set(
        ('h2-p,g2-p,f2-p,e2-p,d2-p,c2-p,b2-p,a2-p,h1-r,g1-n,f1-b,'
         'e1-q,d1-k,c1-b,b1-n,a1-r').split(','))
    for i in range(2, 8):
        assert df.loc[0, 'white_square_piece_%d' % i] == ''
        assert df.loc[0, 'black_square_piece_%d' % i] == ''
예제 #2
0
def test_move_count_data():
    state_gen = ExpertStateGenerator("bogus", 'csv', 8,
                                     "yureka/tests/test.pgn", 1)
    game = next(state_gen.get_game())

    df = pd.DataFrame(state_gen.get_game_data(game))
    for i, data in df.iterrows():
        assert int(i / 2) + 1 == data['move_count']
예제 #3
0
def test_expert_get_correct_num_games():
    state_gen = ExpertStateGenerator("bogus", 'csv', 8,
                                     "yureka/tests/test.pgn", 1)
    assert len(list(state_gen.get_game())) == 2