Random Go Move Selection
Since there has been some discussion elsewhere on the randomness of "random" players, here is the algorithm that randomGo is using:
Move genMove(Color color) {
Move m; int n;
m.color = color; for (n = 0; n < 100; n++) { m.row = randomNext() % boardSize; m.col = randomNext() % boardSize; if (playMove(m)) { return m; } } /* no legal move found */ MK_PASS(m); return m;
}
randomNext() produces a pseudo-random number using a linear congruential generator
playMove() determines if a move is legal (taking into account the rules for superko and suicide), and if so, executes it and returns true - otherwise returns false