Turn-based game - experimental economics

bouncyinc at gmail.com bouncyinc at gmail.com
Sat Sep 5 12:47:23 CEST 2009


As I Understand it I Would just use a simple shared variable or perhaps data wrote to a file to indicate busy or waiting and then use some kind of wait function or no-op to simulate' then recheck

----------
Sent via Cricket Mobile Email

------Original Message------
From: Paolo Crosetto <paolo.crosetto at unimi.it>
To: <python-list at python.org>
Date: Sat, 5 Sep 2009 12:07:59 PM +0200
Subject: Turn-based game - experimental economics

Dear all,

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

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 
words).

In another thread (about a battleship game) I found two possible leads to a 
solution:
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?

thanks!

-- 
Paolo Crosetto
---------------------------------------------------------------------
PhD Student in Economics
DEAS - Department of Economics - University of Milan
---------------------------------------------------------------------
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list