Advertisement
mmouhib

Untitled

Dec 31st, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import random
  2. import os
  3.  
  4. os.system('clear')
  5.  
  6.  
  7. class Domino:
  8. def __init__(self, a, b):
  9. self.a = a
  10. self.b = b
  11.  
  12. def affichepoints(self):
  13. print(self.a + '\n' + self.b)
  14.  
  15. def valeur(self):
  16. return self.a + self.b
  17.  
  18. def __repr__(self):
  19. return(str(self.a) + '-' + str(self.b))
  20.  
  21.  
  22. def initialiser():
  23. dominos = [Domino(0, 0)]
  24. for i in range(1, 7):
  25. for x in range(i+1):
  26. dominos.append(Domino(x, i))
  27. return dominos
  28.  
  29.  
  30. def distribuer(dominos):
  31. used = []
  32. players = []
  33. for _ in range(4):
  34. player = []
  35. for j in range(7):
  36. while 1:
  37. index = random.randint(0, len(dominos)-1)
  38. if index not in used:
  39. break
  40. used.append(index)
  41. player.append(dominos[index])
  42. players.append(player)
  43. return players
  44.  
  45.  
  46. def game():
  47. pass
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement