forked from Matt-T977/Rock-Paper-Scissors-Lizard-Spock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayers.py
More file actions
25 lines (23 loc) · 821 Bytes
/
Copy pathplayers.py
File metadata and controls
25 lines (23 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Player: # Parent
def __init__(self, name):
self.name = name
self.score = 0
self.gestures = ("rock", "paper", "scissors", "lizard", "spock")
self.choice = ""
# *user picks gesture from gestures tuple
def pick_gesture(self):
invalid = True
while invalid:
print(f"\nRock | Paper | Scissors | Lizard | Spock\n")
self.choice = input(
f"{self.name} please pick a gesture:\n"
).lower()
if self.gesture_validation():
invalid = False
return self.choice
# *checks to see if user choice is in gestures if not re-prompts user
def gesture_validation(self):
if self.choice in self.gestures:
return True
else:
return False