Michael Goettsche wrote:
> What would be a good, but still easy way to write such a server?
You could use SimpleXMLRPCServer. A client call sequence could like this:
>>> s = xmlrpclib.Server('http://...')
>>> token = s.join_game() # blocks until another player joins
>>> s.send_board(
... ['...pppa...',
... '......a...',
... '.d....a...',
... '.d....a.ss',
... '.d....a...'])
>>> s.get_other_board(token) # blocks until other player sends board
['...........',
'...........',
'...........',
'...........',
'...........']
>>> s.fire(2,2)
'Hit!'
>>> s.get_other_board(token)
['...........',
'.H.........',
'...........',
'...........',
'...........']
>>> s.get_my_board(token) # blocks until other guy shoots
['...pppa...',
'......a...',
'.d....a...',
'.d....A.ss', # uppercase if hit
'.d....a...'])
Just designed in 2 minutes - but you get the idea.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list