示例#1
0
 def place_ball(self, game: g.Game):
     """
     Place the ball when kicking.
     """
     left_center = m.Square(7, 8)
     right_center = m.Square(20, 8)
     if game.is_team_side(left_center, self.opp_team):
         return m.Action(t.ActionType.PLACE_BALL, pos=left_center)
     return m.Action(t.ActionType.PLACE_BALL, pos=right_center)
示例#2
0
 def setup(self, game: g.Game):
     """
     Move players from the reserves to the pitch
     """
     i = len(game.get_players_on_pitch(self.my_team))
     reserves = game.get_reserves(self.my_team)
     if i == 11 or len(reserves) == 0:
         return m.Action(t.ActionType.END_SETUP)
     player = reserves[0]
     y = 3
     x = 13 if game.is_team_side(m.Square(13, 3), self.my_team) else 14
     return m.Action(t.ActionType.PLACE_PLAYER,
                     player=player,
                     pos=m.Square(x, y + i))
示例#3
0
def reverse_x_for_left(game: g.Game, team: m.Team, x: int) -> int:
    if game.is_team_side(m.Square(13, 3), team):
        res = game.state.pitch.width - 1 - x
    else:
        res = x
    return res
示例#4
0
 def place_ball(self, game: game.Game):
     center_opposite = Model.Square(helper.reverse_x_for_left(game, self.my_team, 7), 8)
     return Model.Action(Table.ActionType.PLACE_BALL, pos=center_opposite)