示例#1
0
def test_new_tableau_has_moveables():
    for i in range(1000):
        tab = Tableau()
        while not tab.has_moves():
            tab = Tableau()
        moveables = tab.find_moveable()
        assert len(moveables) > 0
示例#2
0
def test_new_tableau_has_moveables():
    for i in range(1000):
        tab = Tableau()
        while not tab.has_moves():
            tab = Tableau()
        moveables = tab.find_moveable()
        assert len(moveables) > 0
示例#3
0
def test_moveables_are_moveable():
    for i in range(1000):
        tab = Tableau()
        while not tab.has_moves():
            tab = Tableau()
        moveables = tab.find_moveable()
        for m in moveables:
            card = tab.card_at(m)
            if card.rank == Ranks.TWO:
                left_gaps = [gap for gap in tab.find_gaps() if gap[1] == 0]
                assert len(left_gaps) > 0
            else:
                target_card = Card(card.suit, Ranks.lower_rank(card.rank))
                assert target_card is not None
                target_loc = tab.find_card(target_card)
                assert tab.card_at((target_loc[0], target_loc[1]+1)) is None 
示例#4
0
def test_moveables_are_moveable():
    for i in range(1000):
        tab = Tableau()
        while not tab.has_moves():
            tab = Tableau()
        moveables = tab.find_moveable()
        for m in moveables:
            card = tab.card_at(m)
            if card.rank == Ranks.TWO:
                left_gaps = [gap for gap in tab.find_gaps() if gap[1] == 0]
                assert len(left_gaps) > 0
            else:
                target_card = Card(card.suit, Ranks.lower_rank(card.rank))
                assert target_card is not None
                target_loc = tab.find_card(target_card)
                assert tab.card_at((target_loc[0], target_loc[1] + 1)) is None