/**
* @return all reasonably good next moves.
*/
public final MoveList generateMoves(TwoPlayerMove lastMove, ParameterArray weights) {
MoveList moveList = new MoveList();
PenteBoard pb = searchable_.getBoard();
pb.determineCandidateMoves();
boolean player1 = (lastMove == null) || !lastMove.isPlayer1();
int ncols = pb.getNumCols();
int nrows = pb.getNumRows();
for (int i = 1; i <= ncols; i++ ) {
for (int j = 1; j <= nrows; j++ ) {
if ( pb.isCandidateMove( j, i )) {
TwoPlayerMove m;
if (lastMove == null)
m = TwoPlayerMove.createMove( j, i, 0, new GamePiece(player1));
else
m = TwoPlayerMove.createMove( j, i, lastMove.getValue(), new GamePiece(player1));
searchable_.makeInternalMove( m );
m.setValue(searchable_.worth( m, weights));
// now revert the board
searchable_.undoInternalMove( m );
moveList.add( m );
}
}
}
BestMoveFinder finder = new BestMoveFinder(searchable_.getSearchOptions().getBestMovesSearchOptions());
return finder.getBestMoves( player1, moveList);