Pre-parse scripting engine scripts
The scripting engine currently interprets each instruction from string representation each time it must be executed. Pre-compiling instructions would allow for improved speed of execution.
At the beginning of the simulator's execution, the scripts should be compiled once and only the compiled version should be used afterwards, in the scripting engine.
The result of ScriptingEngine.parse_script should be put in a local cache for each script. Then this pre-parsed cache would be used instead of parsing the script at use time.
A Python caching decorator could be used, but it should be more efficient to store the parsed script in a location accessible in constant time, without having to hash the script each time it's used. For this, a variable named Another way to do it would be to transparently parse the script and store the parsed version whenever the script is initially specified. For instance, the _parsed_script could be created right next to the script variable.Move constructor could call the script parser function and store its return value.