Yannick wrote: > Hi, > > I would like to program a small game in Python, kind of like robocode > (http://robocode.sourceforge.net/). > Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a thread (robot), and interrupt it after a given time > period. > Any suggestions on how to proceed? > Is Python just not adapted to this kind of things?
If your intent is to allow the user to program a robot using python then no it's NOT suitable. There's no builtin way to restrict what code can do (but Zope might have a way), nor can you force it to pause after a predetermined amount of time, nevermind making that amount of time deterministic enough to be fair in a game. However, if your intent was to have only trusted code then Python would work fine. My preference would be for generators (especially once Python 2.5 is released), but YMMV. -- http://mail.python.org/mailman/listinfo/python-list