|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.genethello.game.Game
public class Game
Console program to play othello evolved using genetic algorithm.
| Field Summary | |
|---|---|
GameTheory |
blackBrain
Brain of black player. |
IBoard |
board
Board used in the game. |
GameTheory |
whiteBrain
Brain of white player. |
| Constructor Summary | |
|---|---|
Game(Chromosome black,
Chromosome white,
int blackTime,
int whiteTime,
IMessage gui,
boolean network,
java.sql.Connection connection)
Creates a new instance of Game. |
|
| Method Summary | |
|---|---|
void |
animatingRoutine(Move mv)
Main routine of the game while animating game. |
void |
breakRoutine()
Breaks routine. |
void |
cancelWorker()
Cancels thinking process by brain. |
int |
getBlackDepth()
Gets thinking depth of black player. |
int |
getBlackTime()
Gets time quota of black player in seconds. |
IBoard |
getBoard()
Gets board. |
int |
getCol(java.lang.String str)
Gets column number from column notation, e.g. |
long |
getElapsed()
Gets thinking time of last move. |
int |
getFlips()
Get the last number of flipped discs. |
int |
getPlayer(int index)
Gets player (MAN or MACHINE) for each color (BLACK or WHITE) |
int |
getResult()
Gets result of game, positive value indicates black wins with result number of discs, otherwise white wins. |
int |
getScore()
Gets score of last best move. |
int |
getStep()
Gets number of step. |
Move[][] |
getTranscript()
Gets transcript of game in matrix of moves, e.g. (BLACK)(WHITE) d3c3 b3e3 .... |
int |
getTurn()
Gets current color fo player to turn. |
int |
getWhiteDepth()
Gets thinking depth of white player. |
int |
getWhiteTime()
Gets time quota of white player in seconds. |
static void |
main(java.lang.String[] args)
|
void |
mainRoutine(Move mv)
Main routine of the game while using graphical user interface. |
static java.lang.String |
moveString(int idx)
Construct coordinate notation of move from index of board, e.g. |
static java.lang.String |
moveString(int col,
int row)
Construct coordinate notation of move from column and row number, e.g. |
static void |
print(java.lang.String msg)
Prints message to standar output. |
void |
printBoard()
Prints current board position to standard output. |
static void |
printf(java.lang.String fmt,
int arg)
Print formmated integer to standard output. |
static void |
printf(java.lang.String fmt,
java.lang.String arg)
Prints formatted message to standard output. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Handle of PropertyChangeEvent, gets fired after each move of MAN and MACHINE in mainRoutine when using GUI. |
void |
replayingRoutine(Move mv)
Main routine of the game while replaying game. |
void |
setBlackDepth(int depth)
Sets thinking depth of black player. |
void |
setBlackTime(int blackTime)
Sets time quota of black player in seconds. |
void |
setPlayer(int index,
int player)
Sets player (MAN or MACHINE) for each color (BLACK or WHITE) |
void |
setTranscript(Move[][] transcript)
Sets transcript of game in Move arrays. |
void |
setTurn(int turn)
Sets current color turn to play. |
void |
setWhiteDepth(int depth)
Sets thinking depth of white player. |
void |
setWhiteTime(int whiteTime)
Sets time quota of white player in seconds. |
int |
start()
Starts game |
void |
startAnimatedGif(Move[][] tr)
Starts replaying to generate animated GIF according to transcript. |
void |
startGUI()
Starts game using graphical user interface. |
void |
startReplay(Move[][] tr)
Starts replaying game using graphical user interface. |
java.lang.String |
toTranscript()
Constructs transcript of game in string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public GameTheory blackBrain
public GameTheory whiteBrain
public IBoard board
| Constructor Detail |
|---|
public Game(Chromosome black,
Chromosome white,
int blackTime,
int whiteTime,
IMessage gui,
boolean network,
java.sql.Connection connection)
black - chromosome of black playerwhite - chromosome of white playerblackTime - time quota for black player in secondswhiteTime - time quota for white player in secondsgui - GUI to print messagenetwork - if true use network, or not otherwise| Method Detail |
|---|
public static void main(java.lang.String[] args)
args - the command line argumentspublic int start()
public void startGUI()
public void startReplay(Move[][] tr)
public void mainRoutine(Move mv)
mv - movepublic void replayingRoutine(Move mv)
mv - movepublic void animatingRoutine(Move mv)
mv - move
public void setPlayer(int index,
int player)
index - color of disc: Game.BLACK, Game.WHITEplayer - player: Game.MAN, Game.MACHINEpublic int getPlayer(int index)
index - color of disc: Game.BLACK, Game.WHITE
public void setTurn(int turn)
setTurn in interface IGameturn - color to play: Game.BLACK, Game.WHITEpublic static void print(java.lang.String msg)
msg - message to print
public static void printf(java.lang.String fmt,
java.lang.String arg)
fmt - formatarg - message to print
public static void printf(java.lang.String fmt,
int arg)
fmt - formatarg - integer to printpublic int getBlackDepth()
public int getWhiteDepth()
public void setBlackDepth(int depth)
depth - thinking depthpublic void setWhiteDepth(int depth)
depth - thinking depth
public static java.lang.String moveString(int col,
int row)
col - column number of moverow - row number of move
public static java.lang.String moveString(int idx)
idx - index of board
public int getTurn()
getTurn in interface IGamepublic int getScore()
public long getElapsed()
public void printBoard()
printBoard in interface IGamepublic int getCol(java.lang.String str)
str - column notation
public void cancelWorker()
public void breakRoutine()
public int getFlips()
public Move[][] getTranscript()
| (BLACK) | (WHITE) |
| d3 | c3 |
| b3 | e3 |
| .. | .. |
public java.lang.String toTranscript()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerevt - eventpublic IBoard getBoard()
getBoard in interface IGamepublic void setBlackTime(int blackTime)
public void setWhiteTime(int whiteTime)
public int getResult()
public int getBlackTime()
public int getWhiteTime()
public void setTranscript(Move[][] transcript)
transcript - transcript of gamepublic int getStep()
public void startAnimatedGif(Move[][] tr)
tr - transcript of game
|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||