|robot individual state?||python noob||11/17/13 9:56 AM|
Is there a way to preserve individual state data for each spawned robot? For example, preserving the last action that each individual robot took? Or preserving the turn on which each robot was spawned?
It seems like only one instance of my Robot class is initialized, so regular instance variables don't seem to work. I don't think I can modify robots in the game dictionary, either.
|Re: robot individual state?||andrep...@gmail.com||11/17/13 10:02 AM|
I'd like to know this too. :)
|Re: robot individual state?||oscarsso...@gmail.com||11/17/13 11:58 AM|
Hi, I first headed of this game afew hours ago, so this might not be 100% correct;
I've studied the code in the downloadable example program, and from what I can tell, you're right.. the robots that we see on the arena aren't actually objects of the class we create.
It would seem each of those robots are of the class "InternalRobot" and not "Robot" :(
The robot we write the code for only seems to be initialised once, which means that there is only one example of that robot in the game.
All the different InternalRobots then look at that one robot when it wants an action.
I'm guessing the only way to have our robots act as individual robots would be to either recalculate each state in the beginning of every turn or to save all the data in a list/array.
If we were to start saving all the data in a list, we would need to know where in that list to start looking for each individual robots data. This could be done by storing the position as one attribute in the list, and then, when a robot is about to load its attribute it just starts to search the list for it's position, when it is found, it will have found where in the list to start reading its attributes :) I havn't tested this though, sort of made it up as I wrote :p
|Re: robot individual state?||br...@bsull.com||11/17/13 1:35 PM|
I'm under the impression each Robot class is only instantiated once. Therefore, you should be able to create class members that track the robots by location. Ie. For each "act" call, it passes in the location of that robot. Have your class store that location with a Robot ID or something and track it around. That should be able to store "state" information, if you will.
|Re: robot individual state?||br...@bsull.com||11/17/13 1:36 PM|
To be more clear, I'm under the impression that when your "Robot" plays, it has it's class instantiated once. Then for each robot you own on the field, it calls the act method (on the same class) with different params.