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


Random Go Move Selection last edited by HellwigGeisse on March 9, 2006 - 19:31
RecentChanges · StartingPoints · About
Edit page ·Search · Related · Page info · Latest diff
[Welcome to Sensei's Library!]
RecentChanges
StartingPoints
About
RandomPage
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Goproblems.com
Login / Prefs
Tools
Sensei's Library