Exemplo n.º 1
0
    def test_clear(self):
        action_manager = ActionManager()

        action_manager.addAction(ActionBuilder.buildSCV(5, 5), PRIORITY(2))
        action_manager.addAction(ActionBuilder.buildSCV(4, 4), PRIORITY(1))
        action_manager.addAction(ActionBuilder.buildSCV(3, 3), PRIORITY(0))

        action_manager.clear()
        assert action_manager.getQueueLen() == 0
Exemplo n.º 2
0
    def test_print_list(self):
        action_manager = ActionManager()

        action_manager.addAction(ActionBuilder.buildSCV(5, 5), PRIORITY(2))
        action_manager.addAction(ActionBuilder.buildSCV(4, 4), PRIORITY(1))
        action_manager.addAction(ActionBuilder.buildSCV(3, 3), PRIORITY(0))

        action_manager.printActionList()
Exemplo n.º 3
0
    def __init__(self):
        self.me = None
        self.world = None
        self.game = None

        self.actionMgr = ActionManager()
        self.ctrl = Controler(self)
Exemplo n.º 4
0
class MoveToBeacon(base_agent.BaseAgent):
    """An agent specifically for solving the MoveToBeacon map."""

    def setup(self, obs_spec, action_spec):
        super(MoveToBeacon, self).setup(obs_spec, action_spec)
        self.actMgr = ActionManager()
        self.controler = MoveToBeaconControler(self)

    def reset(self):
        super(MoveToBeacon, self).reset()
        self.actMgr.clear()

    def step(self, obs):
        super(MoveToBeacon, self).step(obs)

        self.controler.start(obs)

        return self.actMgr.nextCommand()
Exemplo n.º 5
0
    def test_priority_queue(self):
        action_manager = ActionManager()

        act1 = ActionBuilder.buildSCV(5, 5)
        act2 = ActionBuilder.buildSCV(4, 4)
        act3 = ActionBuilder.buildSCV(3, 3)

        action_manager.addAction(act1, PRIORITY(2))
        action_manager.addAction(act2, PRIORITY(1))
        action_manager.addAction(act3, PRIORITY(0))

        assert action_manager.popAction() == act3
        assert action_manager.popAction() == act2
        assert action_manager.popAction() == act1
Exemplo n.º 6
0
 def setup(self, obs_spec, action_spec):
     super(MoveToBeacon, self).setup(obs_spec, action_spec)
     self.actMgr = ActionManager()
     self.controler = MoveToBeaconControler(self)