Last active
April 16, 2020 16:34
-
-
Save CoutinhoElias/15e22f7fb1fcb924caff1f545da55e16 to your computer and use it in GitHub Desktop.
Jogo de cartas (Buraco/Biriba)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Traco: | |
def __init__(self, ): | |
self.cartas = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
self.nipes = ['C', 'E', 'O', 'P'] | |
def cria_baralho(self): | |
self.baralho = [(carta, nipe) for nipe in self.nipes for carta in self.cartas] | |
self.baralho = [(carta, nipe) for nipe in self.nipes for carta in self.cartas] | |
print('Na classe Traco na função "baralho" o baralho está com ', len(self.baralho)) | |
def deleta(self, pos): | |
print(pos) | |
if pos >= 0: | |
del(self.baralho[pos]) | |
print('Na classe Traco depois da função "deleta" o baralho está com ', len(self.baralho)) | |
# Um arquivo chamado main.py | |
def main(): | |
gamer1 = Traco() | |
gamer1.baralho() # Distribui o baralho aleatoriamente (desordenado depropósito) | |
gamer1.deleta(6) # Quero deletar um registro do objeto baralho da posição que eu escolher. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment