How to add your Go engine to OpenGo
Copyright (c) 1998-2000 Jeffrey Greenberg

To add a go engine to OpenGo is to add an OpenGo PlayerProxy.

A simple random player is already implemented as the class PlayRand in the file playrand.cpp.  PlayRand is derived from the class PlayerProxy.  Look at this example which is described below.  You can also look at pwally.c which is the OpenGo interface to the wally program.

To create a player: subclass PlayerProxy.

To construct a player, it must be supplied with:

It uses these to initialize the base class, PlayerProxy.

At this point, the player is ready to play, so it tells the Referee by

Post_SetupRsp( TRUE );    // Post a setup response message to the referee: I'm ready to play!
To make a move:
When it is your turn to move, this function will be called:
ErrId PlayRand::cbGetMove( Move &OppMv, const DataBoard *pBd )
It tells you what the opponents move is and what the board looks like.  Class Move will tell you if it was a move, pass or resignation, by whom, and where.  The DataBoard will tell you what the board now looks like.  It also lets you enquire about blocks or strings, the history of moves, ko information and more.

Once the move is in your hands, you call you Go Engine code and obtain your response move.  You create a move to send back to the Referee using the following api:

And send it back to the referee with:
Post_MoveRsp( PlayRandMv );  // post results back...
You could also display something:
_pIO->Info( "My move is a killer.");
Which will be displayed in the status box.

The way it works is:
The Referee sits in the middle between the players.

  1. Each player submits a move to Referee.
  2. If the Referee thinks the move is legal, then it updates it's board and passes the move onto the opposing player.
  3. If the move is illegal, the move is rejected and the player's cbGetMove function again.
The Referee will reject the move if it: Since the Referee only allows proper moves, the random player can keep generating moves until it gets it right.  It also keeps a count of how many attempts it has tried, and after a while will pass.