Python share CPU time?

linnorm at gmail.com linnorm at gmail.com
Wed Aug 9 16:48:38 EDT 2006


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?
>
> Thanks,
> Yannick

You should take a look at stackless Python.  It should do very nicely
for what you want.  There  is a good tutorial on it here:
http://members.verizon.net/olsongt/stackless/why_stackless.html




More information about the Python-list mailing list