|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.genethello.applet.Board
public class Board
Implementation of gametheory's Board to simulate an othello board.
Board's index (8x8)
| a | b | c | d | e | f | g | h | |
| 1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 2 | 8 | 9 | ... | |||||
| ... | ||||||||
| 8 | 56 | ... | ... | 63 | ||||
| Constructor Summary | |
|---|---|
Board(boolean network)
Creates a new instance of Board. |
|
| Method Summary | |
|---|---|
void |
addMovesUndoDepth(int undogendep)
Increments depth of undo of valid moves. |
void |
addSquaresUndoDepth(int undodep)
Increments depth of undo of board simulation. |
java.lang.String |
bottomCornerPattern()
Constructs bottom corner pattern from current board. |
int |
bottomCornerValue()
Calculates value of bottom corner pattern for BLACK disc. |
java.lang.String |
bottomSidePattern()
Constructs bottom side pattern from current board. |
int |
bottomSideValue()
Calculates value of bottom side pattern for BLACK disc. |
int |
calcPatternValue(int turn)
Calculates sum of all pattern values for certain color of disc. |
int |
countCorners(int turn)
Calculates number of discs in corners for certain color. |
static int |
countEmpty(java.lang.String pat)
Counts number of empty squares in a pattern. |
int |
countMobility(int turn)
Counts mobility for current player. |
int |
countXsquares(int turn)
Calculates number of discs in x-squares for certain color. |
int |
doPut(int idx,
int turn)
Puts new disc and flip opponent's discs if possible. |
int |
doPut(int col,
int row,
int turn)
Puts new disc and flip opponent's discs if possible. |
boolean |
equals(Board other)
Checks equality of two boards. |
void |
generate(int turn)
Generates valid moves for current player. |
int[] |
getDiscs()
Gets number of discs of both colors. |
int |
getDiscs(int i)
Gets number of discs. |
int |
getFlips()
Gets the last number of flipped discs. |
int[] |
getMoves()
Gets array of valid moves. |
int |
getMoves(int index)
Gets index'th move from array of valid moves. |
int |
getMovesUndoDepth()
Gets depth of undo of valid moves. |
int |
getSquares(int index)
Gets value of a square in board. |
int |
getSquaresUndoDepth()
Gets depth of undo of board simulation. |
int |
getTotalDiscs()
Gets total number of discs. |
long |
getZobristKey()
Get Zobrist key, a long number reflecting a board position to be used for faster and more space efficient transposition tables and opening books. |
boolean |
isUnquiet()
Unimplemented. |
java.lang.String |
leftCornerPattern()
Constructs left corner pattern from current board. |
int |
leftCornerValue()
Calculates value of left corner pattern for BLACK disc. |
java.lang.String |
leftSidePattern()
Constructs left side pattern from current board. |
int |
leftSideValue()
Calculates value of left side pattern for BLACK disc. |
java.lang.String |
rightCornerPattern()
Constructs right corner pattern from current board. |
int |
rightCornerValue()
Calculates value of right corner pattern for BLACK disc. |
java.lang.String |
rightSidePattern()
Constructs right side pattern from current board. |
int |
rightSideValue()
Calculates value of right side pattern for BLACK disc. |
void |
setSquares(int index,
int disc)
Sets value of a square in board. |
void |
setSquaresUndoDepth(int undodep)
Sets depth of undo of board simulation. |
int[] |
toIntArray()
Integer array representation of board. |
java.lang.String |
topCornerPattern()
Constructs top corner pattern from current board. |
int |
topCornerValue()
Calculates value of top corner pattern for BLACK disc. |
java.lang.String |
topSidePattern()
Constructs top side pattern from current board. |
int |
topSideValue()
Calculates value of top side pattern for BLACK disc. |
java.lang.String |
toString()
String representation of board. |
void |
undoGenerate()
Undoes the last Generate(). |
void |
undoPut()
Undoes the last doPut(). |
void |
updateZobristKeyOnTurn(int turn)
Updates zobrist key when turn changes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Board(boolean network)
network - true if using network, or not otherwise| Method Detail |
|---|
public long getZobristKey()
getZobristKey in interface Boardpublic boolean isUnquiet()
isUnquiet in interface Boardpublic int getSquares(int index)
getSquares in interface IBoardindex - board index
public void setSquares(int index,
int disc)
index - board indexdisc - value
public int doPut(int col,
int row,
int turn)
col - New disc's column (0- 7).row - New disc's row (0 - 7).turn - New disc's turn (BLACK or WHITE).
public int doPut(int idx,
int turn)
doPut in interface IBoardidx - New disc's index (0- 63).turn - New disc's turn (BLACK or WHITE).
public void undoPut()
undoPut in interface IBoardpublic void generate(int turn)
generate in interface IBoardturn - Current player to generate moves.public void undoGenerate()
undoGenerate in interface IBoardpublic int getMoves(int index)
getMoves in interface IBoardindex - index of move
public int[] getMoves()
public java.lang.String toString()
toString in class java.lang.Objectpublic int[] toIntArray()
toIntArray in interface IBoardpublic int getFlips()
getFlips in interface IBoardpublic int getSquaresUndoDepth()
public void setSquaresUndoDepth(int undodep)
undodep - undo depthpublic void addSquaresUndoDepth(int undodep)
addSquaresUndoDepth in interface IBoardundodep - undo depth to incrementpublic void addMovesUndoDepth(int undogendep)
addMovesUndoDepth in interface IBoardundogendep - undo depth to incrementpublic int getDiscs(int i)
getDiscs in interface IBoardi - color of disc: Constants.BLACK, Constants.WHITE
public int getTotalDiscs()
getTotalDiscs in interface IBoardpublic int[] getDiscs()
getDiscs in interface IBoardpublic int getMovesUndoDepth()
public java.lang.String topSidePattern()
public java.lang.String rightSidePattern()
public java.lang.String bottomSidePattern()
public java.lang.String leftSidePattern()
public java.lang.String topCornerPattern()
public java.lang.String rightCornerPattern()
public java.lang.String bottomCornerPattern()
public java.lang.String leftCornerPattern()
public int topSideValue()
public int rightSideValue()
public int bottomSideValue()
public int leftSideValue()
public int topCornerValue()
public int rightCornerValue()
public int bottomCornerValue()
public int leftCornerValue()
public static int countEmpty(java.lang.String pat)
pat - pattern to count
public boolean equals(Board other)
equals in interface Boardother - other board to compare
public int countMobility(int turn)
countMobility in interface IBoardturn - Current player to count.public int countCorners(int turn)
countCorners in interface IBoardturn - color of disc: Constants.BLACK, Constants.WHITE
public int countXsquares(int turn)
countXsquares in interface IBoardturn - color of disc: Constants.BLACK, Constants.WHITE
public int calcPatternValue(int turn)
calcPatternValue in interface IBoardturn - color of disc: Constants.BLACK, Constants.WHITE
public void updateZobristKeyOnTurn(int turn)
updateZobristKeyOnTurn in interface Boardturn -
|
GeneThello Home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||