[Tutor] common data access and timing

Andreas Zwinkau andi@buxach.de
Sun Apr 6 15:56:01 2003


greetings to the list, i am new here :)

Does anybody know RedCode or CoreWar ?
I am currently working on a real-time version of this game, but i have a
problem with the program structure.

There is a datafield (the core), which must be accessed and changed
regularly (let's say every 500ms). I am new to python, so how can i do
such a time-trigger or sleep or wait?

On the other side, the programm must handle several clients. I already
have the network-socket-thingy, but i have problems with my
inner-programm process-communication. The programm is structured as
1 master daemon, for handling new clients
x clients(fork), 1 for each client
1 core part(fork), for handling the core

The clients must give commands to the core part, i thought the best
solution would be pipes, so i made two pipes. One from master daemon to
core-part and the other from core-part to master daemon. The clients
take the pipe ends from the master daemon to send their commands.

problem: reading the pipe with read(), seems not to work, so i used
readline(), but now i must add and later subtract a '\n'. Could this be
done more elegant?

The main problem is the core part. It must include this timer and a
proper communication with the clients. How should i do this?

for info on CoreWar: http://www.sci.fi/~iltzu/corewar/guide.html

Andreas Zwinkau
 | web: andi.dasstellenwirinsinternet.de
 | mail: andi@buxach.de
 | jabber: beza1e1@amessage.de

Kio estis kaj pasis, tion tempo frakasis