Class GoMokuSearchable<B extends GoMokuBoard>
- java.lang.Object
-
- com.barrybecker4.game.twoplayer.common.AbstractSearchable<M,B>
-
- com.barrybecker4.game.twoplayer.common.TwoPlayerSearchable<TwoPlayerMove,B>
-
- com.barrybecker4.game.twoplayer.gomoku.GoMokuSearchable<B>
-
- All Implemented Interfaces:
Searchable<TwoPlayerMove,B>
- Direct Known Subclasses:
TicTacToeSearchable
public class GoMokuSearchable<B extends GoMokuBoard> extends TwoPlayerSearchable<TwoPlayerMove,B>
Defines everything the computer needs to know to search for the next gomoku move.
-
-
Field Summary
-
Fields inherited from class com.barrybecker4.game.twoplayer.common.TwoPlayerSearchable
bestMoveFinder_, board_, hash, players
-
Fields inherited from class com.barrybecker4.game.twoplayer.common.AbstractSearchable
moveList, strategy_
-
-
Constructor Summary
Constructors Constructor Description GoMokuSearchable(B board, PlayerList players)ConstructorGoMokuSearchable(GoMokuSearchable<B> searchable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GoMokuSearchable<B>copy()protected PatternscreatePatterns()MoveList<TwoPlayerMove>generateMoves(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)generate all possible next moves.MoveList<TwoPlayerMove>generateUrgentMoves(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)Consider both our moves and opponent moves that result in wins.BgetBoard()The current board state.protected intgetJeopardyWeight()booleaninJeopardy(TwoPlayerMove move, com.barrybecker4.optimization.parameter.ParameterArray weights)Consider the delta big if >= w.intworth(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)Statically evaluate the board position from player1's point of view.-
Methods inherited from class com.barrybecker4.game.twoplayer.common.TwoPlayerSearchable
done, getHashKey, getSearchOptions, makeInternalMove, undoInternalMove
-
Methods inherited from class com.barrybecker4.game.twoplayer.common.AbstractSearchable
getMoveList, getNumMoves, getProfiler, getSearchStrategy, searchForNextMove
-
-
-
-
Constructor Detail
-
GoMokuSearchable
public GoMokuSearchable(B board, PlayerList players)
Constructor
-
GoMokuSearchable
public GoMokuSearchable(GoMokuSearchable<B> searchable)
-
-
Method Detail
-
copy
public GoMokuSearchable<B> copy()
- Returns:
- a copy of our current state so we can make moves and not worry about undoing them.
-
getBoard
public B getBoard()
Description copied from interface:SearchableThe current board state.- Specified by:
getBoardin interfaceSearchable<TwoPlayerMove,B extends GoMokuBoard>- Overrides:
getBoardin classTwoPlayerSearchable<TwoPlayerMove,B extends GoMokuBoard>
-
createPatterns
protected Patterns createPatterns()
-
worth
public int worth(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)
Statically evaluate the board position from player1's point of view.- Specified by:
worthin interfaceSearchable<TwoPlayerMove,B extends GoMokuBoard>- Specified by:
worthin classTwoPlayerSearchable<TwoPlayerMove,B extends GoMokuBoard>- Parameters:
lastMove- the last move madeweights- the polynomial weights to use in the polynomial evaluation function- Returns:
- the lastMoves value modified by the value add of the new move. a large positive value means that the move is good from player1's viewpoint
-
generateMoves
public MoveList<TwoPlayerMove> generateMoves(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)
generate all possible next moves.- Parameters:
lastMove- the last move made if there was one. (null if first move of the game)weights- the polynomial weights to use in the polynomial evaluation function.- Returns:
- list of possible next moves.
-
generateUrgentMoves
public MoveList<TwoPlayerMove> generateUrgentMoves(TwoPlayerMove lastMove, com.barrybecker4.optimization.parameter.ParameterArray weights)
Consider both our moves and opponent moves that result in wins. Opponent moves that result in a win should be blocked.- Parameters:
lastMove- the last move madeweights- the polynomial weights to use in the polynomial evaluation function- Returns:
- Set of moves the moves that result in a certain win or a certain loss.
-
inJeopardy
public boolean inJeopardy(TwoPlayerMove move, com.barrybecker4.optimization.parameter.ParameterArray weights)
Consider the delta big if >= w. Where w is the value of a near win.- Specified by:
inJeopardyin interfaceSearchable<TwoPlayerMove,B extends GoMokuBoard>- Overrides:
inJeopardyin classTwoPlayerSearchable<TwoPlayerMove,B extends GoMokuBoard>- Returns:
- true if the last move created a big change in the score
-
getJeopardyWeight
protected int getJeopardyWeight()
-
-