It seems that the documentation and the implementation differ on the semantic of the commands, and in particular the implementation of the perform method.
Some things are strange is this method, as a command can be success without taking into account the result of the execution on the actor:
Here is an example with the command MOVE_RAND:
elif self.function_id == Command.MOVE_RAND and self.args.__len__() == 1:
self.set_state(Command.ACTIVE)
actor = self.world.get_by_id(self.args[0], entity_type="Actor")
if actor is not None:
self.set_result(actor.travel_rand())
self.set_state(Command.SUCCEEDED)
return self.result
self.set_state(Command.REJECTED)
return False
Two things that I find misleading is first that the result of actor.travel_rand() does change the value of the command state, and their is no monitoring of the execution of the command, to know the progress of the command, we should monitor the actor and not the command, which differs from the documentation.
In the wiki, it is stated that a Command stays ACTIVE until the execution of the command is completed, and clearly here we do not wait the completion.
Therefore I think that the execution and the monitoring of commands should be adapted to be consistent with the doc, and ease the implementation of other Agent.
For the moment ad-hoc mechanism can be added, as monitoring the actor state, but it would be much simpler to monitor only commands.
It seems that the documentation and the implementation differ on the semantic of the commands, and in particular the implementation of the perform method. Some things are strange is this method, as a command can be success without taking into account the result of the execution on the actor: Here is an example with the command MOVE_RAND:
Two things that I find misleading is first that the result of actor.travel_rand() does change the value of the command state, and their is no monitoring of the execution of the command, to know the progress of the command, we should monitor the actor and not the command, which differs from the documentation. In the wiki, it is stated that a Command stays ACTIVE until the execution of the command is completed, and clearly here we do not wait the completion.
Therefore I think that the execution and the monitoring of commands should be adapted to be consistent with the doc, and ease the implementation of other Agent. For the moment ad-hoc mechanism can be added, as monitoring the actor state, but it would be much simpler to monitor only commands.