コード例 #1
0
def test_rook_take():
    b = Board()
    r1 = Rook("WHITE")
    r1.set_position(("B", 2))
    r2 = Rook("BLACK")
    r2.set_position(("F", 2))
    b.pieces += [r1, r2]
    r1.find_available_moves(b)
    r2.find_available_moves(b)
    assert (len(r1.available_moves) == 12)
    assert (len(r2.available_moves) == 13)
コード例 #2
0
def test_rook_on_edge():
    b = Board()
    for colour in ["WHITE", "BLACK"]:
        r = Rook(colour)
        r.set_position(("F", 1))
        r.find_available_moves(b)
        moves = r.available_moves
        assert (len(moves) == 14)
        assert (("A", 1) in moves)
        assert (("H", 1) in moves)
        assert (("F", 8) in moves)