def reset(self): self.army = [Army(0), Army(1)] self.win_index = -1 self.all_steps = 0 self.is_end = False self.red_agent.reset(self.red_pos) self.blue_agent.reset(self.blue_pos)
def __init__(self, red_agent=None, blue_agent=None, distance=5, max_steps=1): self.red_agent = red_agent self.blue_agent = blue_agent self.distance = distance self.red_pos = 0 self.blue_pos = distance - 1 self.max_steps = max_steps self.army = [Army(0), Army(1)] self.win_index = -1 self.all_steps = 0 self.is_end = False
def set_army(self): army = Army(self.player_id) army.pos = self.pos self.env.army[self.player_id] = army