Ejemplo n.º 1
0
def get_computer_letter(unguessed_consonants, unguessed_vowels, move_type,
        difficulty):
    """(str, str, str, str) -> str

    Return the letter the computer selects from unguessed_consonants based on
    difficulty, which is one of pf.EASY and pf.HARD. unguessed_vowels and
    move_type are ignored; they are supplied only because this function must
    have the same type contract as get_player_letter.

    This function must have the same type contract as get_player_letter. 
    """

    return pf.guess_letter(unguessed_consonants, difficulty)
Ejemplo n.º 2
0
result = pf.update_score(2, 3, 4, pf.PLAYER_ONE)
assert isinstance(result, tuple)  \
       and isinstance(result[0], int) \
       and isinstance(result[1], int), \
       """pf.update_score should return a tuple of (int, int),
but returned {0}.""" \
       .format(type(result))

# Type check pf.next_player
result = pf.next_player(pf.PLAYER_ONE, 2)
assert isinstance(result, str), \
       """pf.next_player should return a str, but returned {0}.""" \
       .format(type(result))

# Type check pf.guess_letter
result = pf.guess_letter('bcd', pf.HARD)
assert isinstance(result, str), \
       """pf.guess_letter should return a str, but returned {0}.""" \
       .format(type(result))

# Type check pf.half_revealed
result = pf.half_revealed('a^^l^')
assert isinstance(result, bool), \
       """pf.half_revealed should return a bool, but returned {0}.""" \
       .format(type(result))

# Type check pf.is_match
result = pf.is_match('apple', 'a^^l^')
assert isinstance(result, bool), \
       """pf.is_match should return a bool, but returned {0}.""" \
       .format(type(result))