[Tutor] Dots-And-Boxes
Sean 'Shaleh' Perry
shalehperry@attbi.com
Sun, 02 Jun 2002 00:21:48 -0700 (PDT)
On 02-Jun-2002 Kirby Urner wrote:
>
>>\
>>"""Dots-and-Boxes is a familiar paper an pencil game for two players;
>
>
> Thanks for bringing this up Danny. In earlier lives (as a
> younger guy), I played this game quite a bit on paper, with
> my sister Julie, peer group. Taught it to a few people.
> Then I forgot about it completely -- until now. I always
> called it "Square Off" and played it on graphing paper
> (grid paper).
>
> Yes, having a GUI version w/ Python guts would be mucho fun
> and a challenging project. I salute you for initiating this
> bold proposal, backed with original code.
>
yeah, great one from childhood.
For the competition the design can be much simpler.
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 ..