forked from Mrinank-Bhowmick/python-beginner-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJogadores.py
More file actions
38 lines (30 loc) · 999 Bytes
/
Jogadores.py
File metadata and controls
38 lines (30 loc) · 999 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
26
27
28
29
30
31
32
33
34
35
36
37
38
# 1 = stone
# 2 = paper
# 3 = Scissors
from random import randint
class Jogadores:
nome: str
cartas = []
def __init__(self, nome): # Constructor
self.nome = nome
self.cartas = []
# Return a list of cards
def distribuir_cartas(self) -> list:
for i in range(3):
carta = randint(1, 3)
self.cartas.append(carta)
return self.cartas
# Translate to letters
def traduzir_cartas(self, cartas) -> list:
cartasTraduzidas = ""
for i in cartas:
if i == 1 or i == "1":
cartasTraduzidas += "Stone " # Translated letters.append("Stone")
elif i == 2 or i == "2":
cartasTraduzidas += "Paper " # Translated letters.append("Paper")
else:
cartasTraduzidas += "Scissors " # Translated letters.append("Scissors")
return cartasTraduzidas
# Clear list
def limpar_cartas(self):
return self.cartas.clear()