Esempio n. 1
0
 def __init__(self, fn_st=None):
     Strategy.__init__(self,"Attaquant")
     if fn_st is not None:
         with open(loadPath(fn_st),"rb") as f:
             self.dico = pickle.load(f)
     else:
         self.dico = dict()
     self.dico['distShoot'] = 36.
Esempio n. 2
0
 def __init__(self, succ=None):
     Strategy.__init__(self, "Solo")
     self.counter = 0
     self.counterstep = 0
     self.counter_engage = 0
     self.score1 = 0
     self.score2 = 0
     self.succ = succ
Esempio n. 3
0
 def __init__(self, strength=None, fn=None):
     Strategy.__init__(self, "Fonceur")
     self.strength = strength
     self.best_force = None
     if fn is not None:
         import os
         fn = os.path.join(os.path.dirname(os.path.realpath(__file__)), fn)
         with open(fn, "rb") as f:
             self.best_force = pickle.load(f)
Esempio n. 4
0
 def __init__(self, fn_gk=None):
     Strategy.__init__(self,"Gardien")
     if fn_gk is not None:
         with open(loadPath(fn_gk),"rb") as f:
             self.dico = pickle.load(f)
     else:
         self.dico = dict()
     self.dico['tempsI'] = int(self.dico['tempsI'])
     self.dico['n'] = self.dico['tempsI']
Esempio n. 5
0
 def __init__(self, fn_gk=None, fn_st=None):
     Strategy.__init__(self,"FonceurModif")
     if fn_st is not None:
         with open(loadPath(fn_st),"rb") as f:
             self.dico = pickle.load(f)
         with open(loadPath(fn_gk),"rb") as f:
             self.dico.update(pickle.load(f))
     else:
         self.dico = dict()
     self.dico['n'] = -1
Esempio n. 6
0
 def start(self, show=True):
     if not self.simu:
         team1 = SoccerTeam("Team 1")
         team2 = SoccerTeam("Team 2")
         team1.add(self.strategy.name, self.strategy)
         team2.add(Strategy().name, Strategy())
         self.simu = Simulation(team1, team2, max_steps=self.max_steps)
         self.simu.listeners += self
         if show:
             show_simu(self.simu)
         else:
             self.simu.start()
Esempio n. 7
0
 def __init__(self,
              strD1=None,
              strD2=None,
              strPs=None,
              decal=None,
              qd=None):
     Strategy.__init__(self, "Fonceur Test")
     self.strD1 = strD1
     self.strD2 = strD2
     self.strPs = strPs
     self.decal = decal
     self.qd = qd
Esempio n. 8
0
    def __init__(self,
                 accPasse=0.1,
                 accShoot=1,
                 vit=1,
                 n=4,
                 tooClose=100 * PLAYER_RADIUS):
        Strategy.__init__(self, "PassOpt")
        self.accPasse = accPasse
        self.accShoot = accShoot
        self.vit = vit

        self.n = n
        self.tooClose = tooClose
Esempio n. 9
0
 def __init__(self,
              accShoot=0.25,
              accDrible=0.25,
              vit=1,
              n=4,
              maxAngle=math.pi / 3,
              tooFar=10 * maxBallAcceleration):
     Strategy.__init__(self, "Drible")
     self.accShoot = accShoot
     self.accDrible = accDrible
     self.vit = vit
     self.n = n
     self.maxAngle = maxAngle
     self.tooFar = tooFar
Esempio n. 10
0
 def __init__(self,
              distShoot=50,
              accShoot=0.64,
              distMin=10,
              distMax=60,
              rayon=15,
              alpha=0.6):
     Strategy.__init__(self, "AtkIntelligent")
     self.distShoot = distShoot
     self.accShoot = accShoot
     self.distMin = distMin
     self.distMax = distMax
     self.rayon = rayon
     self.alpha = alpha
Esempio n. 11
0
 def __init__(self, fn_gk=None, fn_st=None):
     Strategy.__init__(self,"CBNaif")
     if fn_st is not None:
         with open(loadPath(fn_st),"rb") as f:
             self.dico = pickle.load(f)
         with open(loadPath(fn_gk),"rb") as f:
             self.dico.update(pickle.load(f))
     else:
         self.dico = dict()
     self.dico['n'] = -1
     self.dico['tempsI'] = 4.8
     self.dico['rayDribble'] = 19.
     self.dico['rayRecept'] = 30.
     self.dico['coeffPushUp'] = 6.
     self.dico['controleAttaque'] = self.dico['controleMT']
Esempio n. 12
0
 def __init__(self,
              p=0.7,
              n=0,
              alpha=0.6,
              distMin=10,
              distMax=60,
              maxAngle=math.pi / 6,
              rayon=15):
     Strategy.__init__(self, "DefIntelligent")
     self.p = p
     self.n = n
     self.alpha = alpha
     self.distMin = distMin
     self.distMax = distMax
     self.maxAngle = maxAngle
     self.rayon = rayon
Esempio n. 13
0
def check_team(team):
    teamDefault = SoccerTeam()
    for nb in range(team.nb_players):
        teamDefault.add(str(nb), Strategy())
    if Simulation(team,teamDefault,max_steps=MAX_TEST_STEPS).start().error or \
            Simulation(teamDefault,team,max_steps=MAX_TEST_STEPS).start().error:
        return False
    return True
Esempio n. 14
0
 def __init__(self, fn_gk=None, fn_st=None):
     Strategy.__init__(self,"AttaquantModif")
     if fn_st is not None:
         with open(loadPath(fn_st),"rb") as f:
             self.dico = pickle.load(f)
         with open(loadPath(fn_gk),"rb") as f:
             self.dico.update(pickle.load(f))
     else:
         self.dico = dict()
     self.dico['n'] = -1
     self.dico['tempsI'] = 4.8
     self.dico['rayDribble'] = 16.
     self.dico['rayRecept'] = 30.
     self.dico['coeffPushUp'] = 6.
     self.dico['controleAttaque'] = self.dico['controleMT']
     self.dico['rayPressing'] = 30.
     self.dico['distDefZone'] = 75.
     self.dico['distShoot'] = 40.
Esempio n. 15
0
 def __init__(self):
     self.strat = ShootExpe()
     team1 = SoccerTeam("test")
     team1.add("Expe", self.strat)
     team2 = SoccerTeam("test2")
     team2.add("Nothing", Strategy())
     self.simu = Simulation(team1, team2, max_steps=40000)
     self.simu.listeners += self
     self.discr_step = 20
     self.nb_essais = 20
Esempio n. 16
0
    def __init__(self,
                 accShoot=0.64,
                 accDrible=0.25,
                 vit=1,
                 n=4,
                 maxAngle=math.pi / 3,
                 tooFar=10 * maxBallAcceleration,
                 rSurfBut=40,
                 AngleHyst=math.pi / 12):
        Strategy.__init__(self, "Drible1vs1")
        self.accShoot = accShoot
        self.accDrible = accDrible
        self.vit = vit
        self.n = n
        self.maxAngle = maxAngle
        self.tooFar = tooFar
        self.rSurfBut = rSurfBut
        self.AngleHyst = AngleHyst

        self.cpt = 0
        self.cpt2 = 0
        self.dernierdrible = None
Esempio n. 17
0
    def __init__(self,
                 accShoot=0.64,
                 accDrible=0.25,
                 vit=1,
                 n=4,
                 maxAngle=math.pi / 6,
                 tooFar=5 * maxBallAcceleration,
                 rSurfBut=40,
                 AngleHyst=math.pi / 12,
                 distShoot=50):
        Strategy.__init__(self, "Drible2")
        self.accShoot = accShoot
        self.accDrible = accDrible
        self.vit = vit
        self.n = n
        self.maxAngle = maxAngle
        self.tooFar = tooFar
        self.rSurfBut = rSurfBut
        self.AngleHyst = AngleHyst
        self.distShoot = distShoot

        self.dernierdrible = None
Esempio n. 18
0
    def __init__(self,
                 accShoot=0.64,
                 accDrible=0.25,
                 vit=1,
                 n=4,
                 maxAngle=math.pi / 3,
                 tooFar=10 * maxBallAcceleration,
                 rSurfBut=40,
                 AngleHyst=math.pi / 12,
                 alpha=0.4):
        Strategy.__init__(self, "Drible_1v1_intelligent")
        self.accShoot = accShoot
        self.accDrible = accDrible
        self.vit = vit
        self.n = n
        self.maxAngle = maxAngle
        self.tooFar = tooFar
        self.rSurfBut = rSurfBut
        self.AngleHyst = AngleHyst
        self.alpha = alpha

        self.dernierdrible = None
        self.position_ennemi_x = 0
        self.position_ennemi_y = 0
 def __init__(self,visu = False):  # Visu permet la visualisation de la simu. Si on en veut pas, on met false. Cela est permis par la fonction start en bas.
     team1 = SoccerTeam("expe1")
     team2 = SoccerTeam("expe2")
     self.strat = shoot()         # On donne la strat qu'on va utiliser.
     team1.add("jexp1", self.strat )
     team2.add("jplot",Strategy())  # Si besoin d'un joueur de team adverse
     self.simu = Simulation(team1,team2,max_steps=10000000) # On def la simu avec un enorme max_steps car on veut test x round et on veut pas devoir recommencer un match
     self.visu = visu
     self.simu.listeners+=self #ajout de l observer
     list_a = np.linspace(0.1,20,30)    # Creation de la matrice pour la parametre a. De param1 a param2 avec param2 valeurs
     list_b = np.linspace(0.1,20,30)
     self.list_params = [(a,b) for a in list_a for b in list_b]   # Creation de tout les couples possible
     self.cpt_params = 0     # Va permettre de tester toute la liste de couple de params
     self.nb_expe = 20       # Nb de round que l on fera par postion 
     self.res = dict()       # Ini de notre dico
     self.pos = dict()
Esempio n. 20
0
 def __init__(self):
     """ POURQUOI ON UTILISE PAS UN SUPER"""
     Strategy.__init__(self, "1 vs 1")
     self.debug = 0
Esempio n. 21
0
 def __init__(self):
     Strategy.__init__(self, "Gardien")
     self.retour_au_cage = 0
Esempio n. 22
0
 def __init__(self):
     Strategy.__init__(self, "Milieu")
Esempio n. 23
0
 def __init__(self):
     Strategy.__init__(self, "Attaquant")
Esempio n. 24
0
 def __init__(self):
     Strategy.__init__(self, "1 vs 1")
Esempio n. 25
0
 def __init__(self):
     Strategy.__init__(self, "Defenseur")
Esempio n. 26
0
 def __init__(self):
     Strategy.__init__(self, "Q - learning ")
     self.strategies = dict()
     self.current_strategy = None
     self.qtable = None
Esempio n. 27
0
 def __init__(self):
     Strategy.__init__(self,"GoToMyGoal")
Esempio n. 28
0
 def __init__(self, fn_st=None):
     Strategy.__init__(self,"ControlDribble")
     with open(loadPath(fn_st),"rb") as f:
         self.dico = pickle.load(f)
     self.dico['distShoot'] = 36.
Esempio n. 29
0
 def __init__(self):
     Strategy.__init__(self,"Fonceur")
     self.alpha = 0.2
     self.beta = 0.7
Esempio n. 30
0
 def __init__(self):
     Strategy.__init__(self,"Mark")