def decide(self): print('decide') cmd_rand = random.uniform(0.0, 1.0) if cmd_rand < 0.9: # Move bomberman = self.world.bombermans[self.my_side] valid_directions = [] if self.world.board[bomberman.y - 1][bomberman.x].type == ECellType.Empty: valid_directions.append(EDir.Top) if self.world.board[bomberman.y][bomberman.x + 1].type == ECellType.Empty: valid_directions.append(EDir.Right) if self.world.board[bomberman.y + 1][bomberman.x].type == ECellType.Empty: valid_directions.append(EDir.Bottom) if self.world.board[bomberman.y][bomberman.x - 1].type == ECellType.Empty: valid_directions.append(EDir.Left) if len(valid_directions) >= 1: self.send_command( Move(direction=valid_directions[random.randrange( 0, len(valid_directions))])) else: # Bomb self.send_command(Bomb())
def move(self, agent_id, move_direction): self.send_command(Move(id=agent_id, direction=move_direction))
def move(self, medic_id, distance): self.send_command(Move(medic_id, distance))
def warehouse_agent_move(self, forward): self.send_command( Move(agent_type=CommandAgentType.Warehouse, forward=forward))
def factory_agent_move(self, forward): self.send_command( Move(agent_type=CommandAgentType.Factory, forward=forward))