Пример #1
0
    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())
Пример #2
0
 def move(self, agent_id, move_direction):
     self.send_command(Move(id=agent_id, direction=move_direction))
Пример #3
0
 def move(self, medic_id, distance):
     self.send_command(Move(medic_id, distance))
Пример #4
0
 def warehouse_agent_move(self, forward):
     self.send_command(
         Move(agent_type=CommandAgentType.Warehouse, forward=forward))
Пример #5
0
 def factory_agent_move(self, forward):
     self.send_command(
         Move(agent_type=CommandAgentType.Factory, forward=forward))