"Alex Hall" <mehg...@gmail.com> wrote

I realize that one of us will have to play server and the other
client, but the roles nake no difference.

Actually since there are only two players in Battleships you
could dispense with a server and do a peer to peer game.

Or you could create a single server and both be clients.
There are several ways to architect this.
You could even make it a web app with cookies to
record which player is which.

Basically, how might I go about setting up a connection between the
two computers? Not at the socket level, but how do I tell his game
that mine is ready to start? How do I decide who is server and who is
client? Thanks!

If you go for a socket level interaction then you need to
define your own protocol, or message set. There is a basic
example of that in my tutorial in the Network Programming
topic under the AddressBook example.

If the protocol is significant in size - lots of commands - its
best to define the message strings as constants in a shared
module that both client and server can read. Python's string
formatting characters make a useful templating language.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/tutor/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to