Nevo Game Manager
---------------------
10/29/99
kenrick@cs.pdx.edu

Here is source code for a Nevo game manager.  The source directory
contains two programs.  The first one is "game_manager" and acts as a 
server that coordinates play among people or AI programs.  The
second program is called "dumbclient" and is an example of a dumb 
AI client that works with the manager.  It is intended only as 
an example of how to interface with the manager, and selects 
first valid move it can find.  Needless to say, your program 
should be able to beat dumbclient easily (especially since it
will beat itself quickly by eliminating its own pieces!)

Note that you are not required to implement this interface.
If you wish, we can always run tournaments manually by entering moves
to each program to have computer programs play one another. However,
if you can implement this interface, AI play will be faster and
automatic.

You are free to use any of the source code here as a base for 
your own AI program.  If so, make sure that you work from the
dumbclient program, not the manager program.

If you find any bugs, have questions, or come up with enhancements 
to this package, please let me know!

Building the package
---------------------

Issue the command "make" in both directories.
The programs "manager" and "dumbclient" should be built.  This has 
been tested on solaris, sunos, and linux.  For both to work,
the file "start.game" needs to be in the same working directory.

Game Manager Usage
--------------------

The gamemanager program takes two arguments.  The first
argument is the name of a program that will be player 1.  This
program will be White.  The second argument is the name of a program
that will be player 2.   If one of these arguments is "-" then that
player will be a human player rather than a program.

If you want the "dumbclient" player to play itself 
then run it as:

	manager dumbclient dumbclient 

If any client program (or the human) issues a move that is not
valid, then that player immediately loses the game.

Dumb Client Usage
--------------------

The other program in this package is called "dumbclient".  It is just a
skeleton implementation of a program that plays nevo.  It plays by
selecting the first valid move it can find, so it won't play very
well :)  It is included simply to show you how the AI program will 
interface with the game manager.  

The client is expecting one argument, a character that indicates
whether the client should be white or black.  The game manager
will pass either 'W' or 'B' to denote which.  You can access
this through argv[1][0].

For example, invoking dumbclient via:
	dumbclient B
tells the client that it should play black and go second.

See the client_main.c program for examples of how to parse
the input.


Move Format
--------------------

Send moves to the manager in the "oldX oldY newX newY" format, without any 
commas.  In this format, the X/Y coordinates of the piece to move is 
specified.  0 0 is the upper left corner of the board, while 11 7 is 
the lower right.


Communications
--------------------

The game manager works by connecting the stdin and stdout of each
client program to a file descriptor within the game manager.
This means that stdin and stdout from the client program will
be redirected to the manager.

To fully implement a client AI, your program should parse the
assignment of which color you are from the argv string, and ONLY print
moves to stdout.  Moves from the opponent should be read from
stdin.  This means that your client cannot print a board or
any other information, or this will muck up the game manager.

You may want to implement a separate version that prints its own
board, for debugging purposes.  

See the functions in client_io.c and main.c in the dumbclient
directory for examples of how to send and get moves.  


Binaries
------------------

To help you test your program, I have included binaries of three
of my AI implementations for a Nevo playing program. These binaries
run only on sun4 and compatible machine.  

smartclient2 is a program that uses minimax and alpha-beta pruning
to look two moves ahead, and uses a very simple heuristic function.

smartclient3 is a program that uses minimax and alpha-beta pruning
to look three moves ahead, and uses a very simple heuristic function.

smartclient4 is a program that uses minimax and alpha-beta pruning
to look four moves ahead, and uses a very simple heuristic function.

Both smartclient2 and smartclient3 run very fast, under a few seconds even on 
a 200Mhz pentium, while smartclient4 may take longer.  On sirius (a pretty
beefy machine) this takes about 10 seconds.

For example, if you wanted to have smartclient4 play smartclient2 where
smartclient2 is white, you would run this via:

     manager smartclient2 smartclient4

If you pit the programs against each other, you may notice that the
programs will often get stuck, repeating the same moves over again.
If this happens, the player with the higher score will be awarded the
win (so you might want to check for this case and avoid it if it
happens, if you have a lower score!)  In the event that both players
repeat the same moves and the score oscillates between one player
having the higher score, a tie will be declared.


