Exemplo n.º 1
0
def main():
    list_choices = ["rock", "paper", "scissors"]
    valid = False
    while not valid:
        player_choice = input("Rock, Paper or Scissors:\n")
        player_choice = player_choice.lower()
        valid = rsp_lib.is_valid_choice(player_choice)

    print("Player choiced:", player_choice)

    AI_choice = choice(list_choices)

    print("Computer choiced:", AI_choice)

    result = rsp_lib.get_game_results(player_choice, AI_choice)

    return result
Exemplo n.º 2
0
def main():
    valid = False
    while not valid:
        choice = input("Rock, Paper, Scissors?")
        choice = choice.lower()
        valid = rsp_lib.is_valid_choice(choice)

    print("Human choice: ", choice)

    pc_choice = rsp_lib.random_choice()

    print("Computer choice: ", pc_choice)

    result = rsp_lib.get_game_results(choice, pc_choice)

    if result == 1:
        print("Human won!")
    elif result == -1:
        print("Human lost!")
    else:
        print("Tie")
Exemplo n.º 3
0
def test_get_game_results_when_computer_wins(human, computer):
    assert rsp_lib.get_game_results(human, computer) == -1
Exemplo n.º 4
0
def test_get_game_results_when_tie(human, computer):
    assert rsp_lib.get_game_results(human, computer) == 0
Exemplo n.º 5
0
def test_get_game_results_when_is_tie(player, computer):
    # parametricky test
    assert rsp_lib.get_game_results(player, computer) == 0
Exemplo n.º 6
0
def test_get_game_results_when_computer_wins(computer, player):
    # parametricky test pomoci @pytest.mark.parametrize
    assert rsp_lib.get_game_results(computer, player) == -1
Exemplo n.º 7
0
def test_get_game_results_when_player_wins(player, computer):
    # parametricky test @ je dekodator - spusti se pred testovaci funkci
    # a funkci rekne divej pouzij tohle co jsem vytvoril
    assert rsp_lib.get_game_results(player, computer) == 1