Commit 1f7823ff authored by DUFAIX Clement's avatar DUFAIX Clement
Browse files

add game manager

parent 069b0a01
import sys
from abc import abstractmethod
import numpy as np
import PyQt5
......@@ -8,7 +10,17 @@ class Game:
0] # boardGame[0-7] : kewai, boardGame[8] : putahi, 1 : pion joueur 1, 2 : pion joueur 2, 0 : vide
actualPlayer = 1 # 1 for player 1, 2 for player 2
# def __init__(self):
def Game(self, joueur1, joueur2):
self.joueur1 = joueur1
self.joueur2 = joueur2
self.gameManager()
def gameManager(self):
self.joueur1.takeDecision()
self.actualPlayer = 2
self.joueur2.takeDecision()
self.actualPlayer = 1
@staticmethod
def movePawn(positionToMove):
positionToMove = positionToMove-1 # pour la position dans le tableau
......@@ -38,6 +50,24 @@ class Game:
if Game.boardGame[(positionToMove - 1) % 8] == 0: return (positionToMove - 1) % 8
return -1
class Player():
@abstractmethod
def takeDecision(self):
pass
class RealPlayer(Player):
def takeDecision(self):
print("Voici le plateau : ")
for x in range(9):
print("position "+(x+1)+" : "+Game.boardGame[x])
while(inputUser==0):
try:
inputUser = int(input("Ou voulez vous bouger ?"))
except ValueError:
inputUser=0
print("Mauvaise saisie, veuillez entrer un nombre numérique")
Game.takeDecision(inputUser)
if __name__ == "__main__":
print(Game.movePawn(4))
print(Game.boardGame[(0 - 1) % 8] == Game.actualPlayer)
......@@ -46,4 +76,6 @@ if __name__ == "__main__":
Game.actualPlayer = 1
print(Game.movePawn(9))
print(Game.boardGame)
\ No newline at end of file
print(Game.boardGame)
x = int(input())
print(type(x))
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment