jeudi 3 avril 2014

Parse netlogo code with python


Vote count:

0




I have some code being generated by a netlogo simulation which I need to read-in and parse with with Python. The code needs to then be run in a very specific simulation, which will have functions written to match the netlogo code.


For example :



netlogoCode = "ifelse ahead-clear [ move ][ turn-left move ]"

def ahead-cear(self, )
### returns true if the environment ahead of the agent is clear

def turn-left(self, )
### turns the agent 90 degrees to the left


What I'm struggling to get my head around is how to actually process the program... my main worry is that the ifelse statement could have another ifelse within it and Im not sure how to translate that...


could anyone point me in the right direction?



asked 48 secs ago






Aucun commentaire:

Enregistrer un commentaire