Compare commits
4 Commits
a8b972fe42
...
a9c90995f2
| Author | SHA1 | Date | |
|---|---|---|---|
| a9c90995f2 | |||
| 2e3ae1f537 | |||
| befea7f0d4 | |||
| aedb5393ce |
@@ -4,7 +4,7 @@ def user_move() -> int:
|
|||||||
return input("Enter your move (rock, paper, scissors): ")
|
return input("Enter your move (rock, paper, scissors): ")
|
||||||
|
|
||||||
def random_move() -> str:
|
def random_move() -> str:
|
||||||
return random.choice(['rock', 'paper', 'scissors',''])
|
return random.choice(['rock', 'paper', 'scissors']) #erreur de règle : le robot ne peux pas ne rien choisir
|
||||||
|
|
||||||
def check_choice_validity(move: str) -> str:
|
def check_choice_validity(move: str) -> str:
|
||||||
valid_moves = ['rock', 'paper', 'scissor']
|
valid_moves = ['rock', 'paper', 'scissor']
|
||||||
@@ -15,13 +15,13 @@ def check_choice_validity(move: str) -> str:
|
|||||||
|
|
||||||
def check_winner(user_move: str, computer_move: str):
|
def check_winner(user_move: str, computer_move: str):
|
||||||
if user_move == computer_move :
|
if user_move == computer_move :
|
||||||
|
print("IT'S A TIE!! You're both bad..") #print avant le return
|
||||||
return
|
return
|
||||||
print("IT'S A TIE!! You're both bad..")
|
elif user_move == "paper" and computer_move == "scissors": # problème lié aux règles du jeu de base
|
||||||
elif user_move == "paper" and computer_move == "scissors":
|
print("YOU LOSE!! You're bad..")
|
||||||
print("YOU WIN!! You're not bad..")
|
|
||||||
return
|
return
|
||||||
elif user_move == "paper" and computer_move == "rock":
|
elif user_move == "paper" and computer_move == "rock":
|
||||||
print("YOU LOSE!! You're bad..")
|
print("YOU WIN!! You're not bad..")
|
||||||
return
|
return
|
||||||
elif user_move == "rock" and computer_move == "scissors":
|
elif user_move == "rock" and computer_move == "scissors":
|
||||||
print("YOU WIN!! You're not bad..")
|
print("YOU WIN!! You're not bad..")
|
||||||
@@ -47,6 +47,6 @@ if __name__ == '__main__':
|
|||||||
print("Computer is thinking very hard....")
|
print("Computer is thinking very hard....")
|
||||||
computer_choice = random_move()
|
computer_choice = random_move()
|
||||||
|
|
||||||
print(f"Computer chose: {user_choice}")
|
print(f"Computer chose: {computer_choice}") #choix du computer pas du joueur
|
||||||
check_winner(user_choice, computer_choice)
|
check_winner(user_choice, computer_choice)
|
||||||
|
|
||||||
Reference in New Issue
Block a user