|
@@ -0,0 +1,47 @@
|
|
1
|
+from player import get_player_move
|
|
2
|
+
|
|
3
|
+drug = [3, 5, 7]
|
|
4
|
+
|
|
5
|
+playerType = {
|
|
6
|
+ "human": get_player_move
|
|
7
|
+}
|
|
8
|
+
|
|
9
|
+players = [
|
|
10
|
+ {
|
|
11
|
+ "name": "Joueur 1",
|
|
12
|
+ "type": "human"
|
|
13
|
+ },
|
|
14
|
+ {
|
|
15
|
+ "name": "Joueur 2",
|
|
16
|
+ "type": "human"
|
|
17
|
+ }
|
|
18
|
+]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+def show_current_game():
|
|
22
|
+ print("=============")
|
|
23
|
+ for index, val in enumerate(drug):
|
|
24
|
+ print(f"L{index + 1}: {'o' * val}")
|
|
25
|
+ print("=============")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+def execute_move(row, value, name):
|
|
29
|
+ drug[row] -= value
|
|
30
|
+ print(f"{name} à enlever {value} pièce sur la ligne L{row + 1}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+def play(name, type):
|
|
34
|
+ show_current_game()
|
|
35
|
+ execute_move(*playerType[type](name, drug), name)
|
|
36
|
+ if sum(drug) == 0:
|
|
37
|
+ show_current_game()
|
|
38
|
+ print(f"{name} à gangné !!")
|
|
39
|
+ return True
|
|
40
|
+ else:
|
|
41
|
+ return False
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+while True:
|
|
45
|
+ for player in players:
|
|
46
|
+ if play(player["name"], player["type"]):
|
|
47
|
+ exit(0)
|