Turn-based game - experimental economics

Paolo Crosetto paolo.crosetto at unimi.it
Sat Sep 5 12:07:59 CEST 2009

Dear all,

I am writing an application in Python for an experiment in Experimental 

For those who do not know what this is: experimental economics uses 
controlled, computerised lab experiments with real subjects, putting the 
subject in a game mimicking the situation of interest and collecting 
behavioural data about choices made.

Hence, experiments involve the use of a multi-client architecture with one 
server, and are sort of online games, with actions taken by clients and 
computation, data collection, etc... handled by servers.

I chose to use Python because I needed something flexible, powerful and easy - 
I am a beginner programmer.

My game is a sort of scrabble, with palyers buying letters and producing words 
or extending existing words. I use a pipe to ispell -a for spellcheck, XMLRPC 
for the server-client infrastructure, and have developed all the rules of the 
game as server functions, called by a client. States of players and of words 
created are stored in instances of two basic classes, Player and Word, on the 
server side.

The problem I now face is to organise turns. Players, as in Scrabble, will 
play in turns. So far I have developed the server and ONE client, and cannot 
get my head round to - nor find many examples of - how to simply develop a 
turn-based interaction.
I basically need the server to freeze in writing all the clients while client 
i is playing, then when i is over passing the turn to i+1; clients are still 
accessible by the server at any time (the payoff of a player changes even as 
she is not playing, by royalties collected from other players extending her 

In another thread (about a battleship game) I found two possible leads to a 
1. using 'select'.
2. using threads.

But in both cases I could not find any clear documentation on how to do this. 
The 'select' road was said to be the easiest, but I found no further hints.

Does anyone have any hints?


Paolo Crosetto
PhD Student in Economics
DEAS - Department of Economics - University of Milan

More information about the Python-list mailing list