Commit 0d713366 authored by Rémi PORÉE's avatar Rémi PORÉE
Browse files

initial commit

parent 08b53aac
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../:\Users\yvon\PycharmProjects\projet-info-s2\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/projet-info-s2.iml" filepath="$PROJECT_DIR$/.idea/projet-info-s2.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
import Case
import Joueur
\ No newline at end of file
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
class Case :
def __init__ (self,num) :
self.num = num
self.cont = 4
def appartient (self) :
if self.num <= 5 :
return 1
if self.num > 5 :
return 2
import numpy as np
import matplotlib.pyplot as plt
from plateau import Plateau
from case import Case
class Joueur :
def __init__ (self,nb) :
self.nb = nb
def egrene (self,case,plateau) :
print("hey !")
n = case.num
while case.cont != 0 :
if n == 11 :
n = 0
else :
n+=1
if n != case.num :
print(n,case.cont)
case.cont -= 1
plateau[n].cont += 1
return n
def capture (self,case,plateau) :
num_joueur = self.nb
if case.appartient == num_joueur :
return
if case.cont > 3 :
return
else :
plateau.score[num_joueur-1] += case.cont
case.cont = 0
if case.num == 0 :
self.capture(plateau[11], plateau)
else :
self.capture(plateau[case.num-1],plateau)
def gagner (self,plateau) :
# if plateau.score[self.nb-1] >= 25 :
# return self.nb
return 0
\ No newline at end of file
from plateau import Plateau
from case import Case
from joueur import Joueur
if __name__ == "__main__":
plateau = Plateau()
for i in range(12):
plateau.append(Case(i))
print(plateau)
plateau.afficher()
joueur_1 = Joueur(1)
joueur_2 = Joueur(2)
qui_joue = joueur_1
while qui_joue.gagner(plateau) == 0 :
n = 0
while n==0 :
print("joueur {} tu joues quoi ?".format(qui_joue.nb))
x = int(input())
if qui_joue.nb != plateau[x].appartient() :
print("choisi une case qui t'appartient stp")
else :
print("ok")
n = 1
case_finale = qui_joue.egrene(plateau[x],plateau)
qui_joue.capture(plateau[case_finale-1],plateau)
plateau.afficher()
if qui_joue.nb == 1 :
qui_joue = joueur_2
else :
qui_joue = joueur_1
\ No newline at end of file
import numpy as np
import matplotlib.pyplot as plt
class Plateau (list) :
def __init__ (self) :
self.score = [0,0]
self.nb_coup = 0
def afficher (self) :
for i in range(len(self)) :
print("case n° {} :".format (i),self[i].cont)
if __name__ == "__main__":
plateau = Plateau()
plateau.afficher ()
\ No newline at end of file
Markdown is supported
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