Beispiel #1
0
        if (gameVars.player == "scissors"):
            gameVars.player_lives -= 1
            print("you lose! gameVars.player lives: ", gameVars.player_lives)
        else:
            print("you win!")
            gameVars.computer_lives -= 1

    elif (computer == "scissors"):
        if (gameVars.player == "rock"):
            gameVars.player_lives -= 1
            print("you lose! gameVars.player lives: ", gameVars.player_lives)
        else:
            print("you win!")
            gameVars.computer_lives -= 1

    if gameVars.player_lives == 0:
        winLose.winorlose("lost")

    elif gameVars.computer_lives == 0:
        winLose.winorlose("won")

    else:
        gameVars.player = False

    print("gameVars.player has:", gameVars.player_lives, "lives left")
    print("AI has:", gameVars.computer_lives, "Lives left")

    # make the loop keep running by setting gameVars.player back to False
    # unset, so that our loop condition above will evaluate to True
    gameVars.player = False
Beispiel #2
0
    print("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_")
    print("-_-_-_-_-_-_-_-_-_-_   Let's Play   -_-_-_-_-_-_-_-_-_-_")
    print("-_-_-_-_-_-_-_-_   ROCK PAPER SCISSOR   -_-_-_-_-_-_-_-_\n")
    print("Computer Lives:", gameVars.computer_lives, "/",
          gameVars.total_lives)
    print("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n")
    print("Player Lives:", gameVars.player_lives, "/", gameVars.total_lives)
    print("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n")
    print("Choose your weapon! Or type quit to exit\n")  #\n means "new line"
    gameVars.player_choice = input("Choose rock, paper, or scissors: \n")

    if gameVars.player_choice == "quit":
        print("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-")
        print(" oh no!!!!!!  You chose to quit, come back soon :) ")
        print("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-")
        exit()

    gameVars.computer_choice = gameVars.choices[randint(0, 2)]

    print("user chose: " + gameVars.player_choice)
    print("computer chose: " + gameVars.computer_choice)

    compare.my_function()

    if gameVars.player_lives == 0:
        winLose.winorlose(" ))))))))))): lost :((((((((( ")
    elif gameVars.computer_lives == 0:
        winLose.winorlose(" (((((((((((:  won  :)))))))))")
    else:
        gameVars.player_choice = False