org.xistrat.math
Class GoEngine

java.lang.Object
  extended by java.lang.Thread
      extended by org.xistrat.math.GoEngine
All Implemented Interfaces:
java.lang.Runnable, ClientUI

public class GoEngine
extends java.lang.Thread
implements ClientUI, java.lang.Runnable

Engine provides an autoplayer engine for the XiStrat Go variant

Since:
0.6.59

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int NOTHING
           
static int PASS
           
static int PUT
           
static long sleepT
           
 int strength
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GoEngine(F4ClientCore clientCore, boolean verbose, java.lang.String game, java.lang.String alias, int strength)
           
 
Method Summary
 void abort()
           
 void buildPlayField(java.lang.String positionID)
           clientCore calls this after loginAck by server does as well hashTables declaration and initialization
 void doMove(int from, int to)
          dummy
 void doPass()
           
 void doPut(int to, int cont)
          sync representation
 void doRemove(int loc, int cont)
           
 void doUndo(int num)
           
 void handleNewGame(boolean ok, java.lang.String info)
          methods called by F4ClientCore, implemeting ClientUI
 void logout()
           
 void lose(java.lang.String winner)
           
 void run()
          for the moment we only do s.th. when it's our turn (no thinking on time of others so far ...)
 void setGameList(java.lang.String[] list, java.lang.String[] position)
          interface ClientUI
 void showErr(java.lang.String error)
           
 void showMsg(java.lang.String info)
           
 void waitForUserMove(boolean waitForMe)
           
 void waitForUserRemove(boolean wait)
           
 void waitForUserUndo(boolean undoForMe)
          after victory, engine is nice and makes undo of last 2 elementar moves (plies)
 void win()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

strength

public final int strength

PUT

public static final int PUT
See Also:
Constant Field Values

NOTHING

public static final int NOTHING
See Also:
Constant Field Values

PASS

public static final int PASS
See Also:
Constant Field Values

sleepT

public static final long sleepT
See Also:
Constant Field Values
Constructor Detail

GoEngine

public GoEngine(F4ClientCore clientCore,
                boolean verbose,
                java.lang.String game,
                java.lang.String alias,
                int strength)
Parameters:
strength - number of levels the search should do
Method Detail

run

public void run()
for the moment we only do s.th. when it's our turn (no thinking on time of others so far ...)

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setGameList

public void setGameList(java.lang.String[] list,
                        java.lang.String[] position)
interface ClientUI

Specified by:
setGameList in interface ClientUI

handleNewGame

public void handleNewGame(boolean ok,
                          java.lang.String info)
methods called by F4ClientCore, implemeting ClientUI

Specified by:
handleNewGame in interface ClientUI

showMsg

public void showMsg(java.lang.String info)
Specified by:
showMsg in interface ClientUI

showErr

public void showErr(java.lang.String error)
Specified by:
showErr in interface ClientUI

abort

public void abort()
Specified by:
abort in interface ClientUI

logout

public void logout()
Specified by:
logout in interface ClientUI

lose

public void lose(java.lang.String winner)
Specified by:
lose in interface ClientUI

win

public void win()
Specified by:
win in interface ClientUI

waitForUserMove

public void waitForUserMove(boolean waitForMe)
Specified by:
waitForUserMove in interface ClientUI

waitForUserUndo

public void waitForUserUndo(boolean undoForMe)
after victory, engine is nice and makes undo of last 2 elementar moves (plies)

Specified by:
waitForUserUndo in interface ClientUI

buildPlayField

public void buildPlayField(java.lang.String positionID)

clientCore calls this after loginAck by server

does as well hashTables declaration and initialization

Specified by:
buildPlayField in interface ClientUI

doMove

public void doMove(int from,
                   int to)
dummy

Specified by:
doMove in interface ClientUI

doRemove

public void doRemove(int loc,
                     int cont)
Specified by:
doRemove in interface ClientUI

doPass

public void doPass()
Specified by:
doPass in interface ClientUI

waitForUserRemove

public void waitForUserRemove(boolean wait)
Specified by:
waitForUserRemove in interface ClientUI

doPut

public void doPut(int to,
                  int cont)
sync representation

Specified by:
doPut in interface ClientUI

doUndo

public void doUndo(int num)
Specified by:
doUndo in interface ClientUI