| |||||||||||
Tuesday 04 September, 2007[ Marlow @ 21:53 ] Twisted TV - fairly simple processesTuesday: Went to the office and worked hard, but unfortunately not on my game. Kept thinking that there had to be a simpler way of implementing coroutines. Returned home in the evening and improved my code by taking things out, resulting in fsp.py - Fairly Simple Processes. It means that I can write multitasking code like this, hopefully simplifying the logic a bit. It's all part of a wild and wacky experiment based on reading a few articles about Erlang.
from fsp import spawn, run
def producer(consumers):
while True:
yield True
for consumer in consumers:
consumer.send(me)
def consumer():
while True:
yield wait()
msg = recv()
print me, msg
c = spawn(consumer)
for i in xrange(10):
spawn(producer, (c,))
run()
Next: Re-integrate sprite stuff. Monday 03 September, 2007[ Marlow @ 21:36 ] Twisted TVSunday: Devoid of ideas. Monday morning: Finally, an idea I can live with ... provisionally named Twisted TV. Monday evening: Started work on it, deciding to try out coroutines and pretending that Python has a shared-nothing, message passing architecture like Erlang. It has been a promising start - no loss of frame rate and it makes for simple logic. I'm also rather impressed by Pyglet. It shows promise, so I'm using it instead of my usual Pygame/PyOpenGL mix. |
Last Challenge
September 2008 [entries, ratings] Previous March 2008 [entries, ratings] > September 2007 [entries, ratings] April 2007 [entries, ratings] September 2006 [entries, ratings] March 2006 [entries, ratings] (June 2006) August 2005 [entries, ratings] Not logged in Login | ||||||||||