Connect four server Updates (not the code, just the rules)

0 views
Skip to first unread message

Nick Wertzberger

unread,
Jan 19, 2009, 4:58:20 PM1/19/09
to pki...@googlegroups.com
Hello,

I'm adding more information.

If you want to practice with the server, you must:
install python
install pyglet

both of which are free and easy to install.

The competition will be on Friday, January 30th in the afternoon.  The location is to be decided, but there will be some sort of mail flyer next week about location.

The winner of the competition will be given free Jimmy John's.  Winning is determined via a two-match game where both people get the opportunity to go first... In the event of a tie, the lowest number of words (according to wc) wins. This includes comments, so I would recommend going to the competition with your commented code, taking a few minutes to make a copy of your code with the comments stripped out, and then compete with said code.

There will be other side-certificates, such as "most obscure language" and "most languages used" as well as any other weird awards I think of.  These will not be accompanied by Jimmy Johns, but may look far nerdier.
 
I have attached the server for you to play with while developing your AI... It is written in Python, and works anywhere Python and pyglet work, which is all major operating systems.
 
The wrappers for your programs are still being developed so that all you have to worry about is the AI, but you can connect to this using telnet or PuTTY and give it a try to see how the IO will work.  Good luck everyone! 
 
Note: PuTTY was giving me grief when entering a name, so your name is NoBody if you connect using putty.  Also, remember to connect via telnet, not ssh.

Interface:

After connecting, you will receive the text "Name:". Enter the name you want to be displayed as on this line and give a newline.

You will then receive the current state of the board.  'r' represents you, 'b' represents your opponent, '.' represents an open space.
The furthest left column is column 0, the furthest right is column six. 

After receiving the ascii representation of the board, you will need to send a number between 0 and 6 followed by a newline representing which column you are dropping your chip into.  In the case that you make a wrong move, your move is ignored, and the opponent gets a free move.  You are not notified in any way whether or not your move was legal.

All interfacing will have the option of connecting directly to the server, but a wrapper will also be provided that will tie your input and output from stdin and stdout to the port.

Example:

You will have to interface as shown below...  The text in red italics is your input.  The player below was the black chip on the screen, his moves are represented as r still, as all of your chips are always r and the opponent is always black.
 
Name: Steve
.......
.......
.......
.......
.......
...b...
2
.......
.......
.......
.......
..b....
..rb...
3
.......
.......
.......
...b...
..br...
..rb...
1
.......
.......
.......
..bb...
..br...
.rrb...
0
.......
.......
.......
..bb...
..br...
rrrb.b.
0
.......
.......
.......
b.bb...
r.br...
rrrb.b.
0
.......
.......
r.b....
b.bb...
r.br...
rrrb.b.
5
LOSE
 
The ports you connect on are port 1337 and 1338.  You have to connect to port 1337 first.  This player is the red player..  As you can see, you do not see your losing move, you only receive a board if you have not yet lost.
 
After both players are connected, the server opens a game window and the game begins with a graphical representation of the above ascii carnage.

If you have any questions, post to the group, i have changed settings so that members can post to this group.

Good Luck!
--
Nick Wertzberger
connect_four.zip

Sean m

unread,
Jan 20, 2009, 3:32:44 PM1/20/09
to PKI_ACM
> After receiving the ascii representation of the board, you will need to send
> a number between 0 and 6 followed by a newline representing which column you
> are dropping your chip into.  In the case that you make a wrong move, your
> move is ignored, and the opponent gets a free move.  You are not notified in
> any way whether or not your move was legal.

I just realized how fundamentally bad this is. Consider the board:

x x x _ x o x
o o o _ x x x
o o x _ o o o
x x x _ o x o
x x o _ x o x
o o o x o x o

with o to move, in a classical game o is forced to play column 3 and x
wins next turn via column 3, but with the above rules if x is playing
classically and o is not, o places in an illegal column and x places
in column three, o places column three and then the board is as
follows:

x x x _ x o x
o o o _ x x x
o o x _ o o o
x x x o o x o
x x o x x o x
o o o x o x o

x places 3 and o places 3 for the win, the behavior of skipping a
players turn on an illegal move fundamentally changes the nature of
the game stopping a player from forcing another player into a bad
position, it would be like allowing someone to pass in chess. Not only
that but there would arise situations such as above where to non-
classical opponents would make illegal moves indefinitely because it
was clear the first person to move would lose. Are we sure this is how
we want the game to work?

Adam Gehringer

unread,
Jan 20, 2009, 4:56:37 PM1/20/09
to pki...@googlegroups.com
Yeah, infact if both AI realized their impending doom upon placing a piece in column 3 then they could both continue to make illegal moves in order to prevent this from happening. The game would never end.
--
Adam Gehringer

Nick Wertzberger

unread,
Jan 21, 2009, 11:50:14 AM1/21/09
to pki...@googlegroups.com
Good point.  Attached is an updated server that remedies this problem... the new rule will be that a bad move results in immediate disqualification from the round.
--
Nick Wertzberger
connect_four.zip
Reply all
Reply to author
Forward
0 new messages