Menu

#2 Implement game server

open
nobody
None
5
2013-02-19
2002-06-04
Danny Yoo
No

http://mail.python.org/pipermail/tutor/2002-June/014768.html

Sean recommends the following:

Have the player program read state from stdin and
output moves to stdout. A
mediator program can init to players and control the
game. Much like the
various net programming contests.

a sample session from the mediator's perspective would be:

(>> is output, <1 is player1 input, <2 is player2 input)
player 1 always goes first.

>1 init player1 as 1, grid 5x5
>2 init player2 as 2, grid 5x5
<1 move (0,0) (0,1)
>2 connect (0,), (0,1)
<2 move (5,0), (5,1)
1> connect (5,0), (5,1)
...
<1 move (3,2), (3,3) # this move makes a box and wins
>2 connect (3,2), (3,3)
>2 conceed
>> Player 1 wins, total .. out of ..

Discussion


Log in to post a comment.