Open mueslo opened 10 years ago
So the problem is that rgsimulator can't be used for bots which record and use history of previous turns? It could be partially fixed by not reloading bots the first time actions are calculated, so that continuously simulating turns(pressing Return) would work even for history-eware bots. Adding robot caching looks like a great idea. Not sure how to implement global tracking...
Yep, that's it. I actually have the solution you suggested implemented locally, but only because I haven't managed to cache players.
When you show actions, the
rg.game.Player
state is modified. Currently, rgsimulator simply reinstantiates the bots (essentially wiping their memory). This is as if the game started on the turn where the actions are shown.Two things can change when the actions are generated from the
Player
instance:[...]._robot
, i.e. the instantiatedRobot
instance may change (this should be able to be cached bycopy.deepcopy
)[...]._module
, i.e. the globals, builtins, code, etc of the robot code (this cannot be cached bycopy.deepcopy
, since not all elements of a module can be deepcopied).To account for the
_module
problem, my idea would be to attempt to find out which globals were set by the user and explicitly cache those.