Exemplo n.º 1
0
 def compute_strategy(self, state, idteam, idplayer):
     mystate = toolbox.MyState(state, idteam, idplayer)
     if mystate.can_shoot():
         if (mystate.distanceToBall(mystate.my_but) < 60):
             return BDB.shootToGoal(mystate)
         if (self.attendre < 20):
             self.attendre += 1
             BDB.intercepter(mystate,
                             mystate.distanceToBall(mystate.my_but) * 0.65)
         if (mystate.closest(2)[0] and self.enplace < 3):
             self.enplace += 1
             return BDB.saligner(
                 mystate,
                 mystate.distanceToBall(mystate.adv_but) + 2)
         if (mystate.closest(2)[0] and self.enplace < 5
                 and self.enplace > 3):
             self.enplace += 1
             return BDB.saligner(
                 mystate,
                 mystate.distanceToBall(mystate.adv_but) + 1)
         self.enplace = 0
         return BDB.shootToGoal(mystate)
     if (mystate.closest(0)[0]
             or mystate.distanceToBall(mystate.my_but) < 60):
         return BDB.goToBallPredict(mystate)
     return BDB.intercepter(mystate,
                            mystate.distanceToBall(mystate.my_but) * 0.65)
Exemplo n.º 2
0
 def compute_strategy(self, state, idteam, idplayer):
     mystate = toolbox.MyState(state, idteam, idplayer)
     if mystate.can_shoot():
         if (mystate.distanceToBall(mystate.my_but) < 40):
             return BDB.shootToGoal(mystate)
         if (mystate.imclosest() and self.enplace == 0):
             self.enplace = 1
             return BDB.saligner(
                 mystate,
                 mystate.distanceToBall(mystate.adv_but) + 2)
         self.enplace = 0
         return BDB.shootToGoal(mystate)
     if ((mystate.imclosest())
             or mystate.distanceToBall(mystate.my_but) < 45):
         return BDB.goToBallPredict(mystate)
     return BDB.intercepter(mystate,
                            mystate.distanceToBall(mystate.my_but) * 0.65)
Exemplo n.º 3
0
 def compute_strategy(self, state, idteam, idplayer):
     mystate = toolbox.MyState(state, idteam, idplayer)
     if mystate.can_shoot():
         return BDB.shootToGoal(mystate)
     elif (mystate.my_position().distance(mystate.ball_position()) < 40
           and mystate.my_but.distance(mystate.ball_position()) < 90):
         return BDB.goToBallPredict(mystate)
     return BDB.intercepter(mystate, 20)
Exemplo n.º 4
0
 def compute_strategy(self, state, idteam, idplayer):
     mystate = toolbox.MyState(state, idteam, idplayer)
     if mystate.can_shoot():
         if (mystate.imclosest() and self.enplace < 3):
             self.enplace += 1
             return BDB.saligner(
                 mystate,
                 mystate.distanceToBall(mystate.adv_but) + 2)
         if (mystate.imclosest() and self.enplace < 5 and self.enplace > 3):
             self.enplace += 1
             return BDB.saligner(
                 mystate,
                 mystate.distanceToBall(mystate.adv_but) + 1)
         self.enplace = 0
         return BDB.shootToGoal(mystate)
     if (mystate.mateclosest()):
         return BDB.allerEnA(mystate)
     return BDB.goToBallPredict(mystate)
Exemplo n.º 5
0
 def compute_strategy(self, state, id_team, id_player):
     mystate = toolbox.MyState(state, id_team, id_player)
     return BDB.shootToGoal(mystate, self.norm)