public void increaseWins(int xy, boolean blackWins) { byte color = ColorConstant.opposite(_color); boolean playerWins = (blackWins && color == BLACK) || (!blackWins && color == WHITE); if (playerWins) { _wins[xy]++; _virtualWins[xy]++; } _playouts[xy]++; _virtualPlayouts[xy]++; // _results[xy] = Double.MIN_VALUE; }
public String toString() { StringBuilder out = new StringBuilder(); out.append("\nHashMapSearch\n"); // out.append(GoArray.toString(_board)); GoMove move = GoMoveFactory.getSingleton().createMove(getBestMove(), ColorConstant.opposite(_color)); out.append(move.toString() + "\n"); for (int row = 1; row <= _boardSize; row++) { for (int col = 1; col <= _boardSize; col++) { int xy = GoArray.toXY(col, row); if (_playouts[xy] != 0) out.append(Double.toString(_wins[xy] / _playouts[xy])); else { out.append(Integer.toString(_wins[xy])); out.append("/"); out.append(Integer.toString(_playouts[xy])); } out.append("\t"); } out.append("\n"); } out.append("\n"); for (int row = 1; row <= _boardSize; row++) { for (int col = 1; col <= _boardSize; col++) { int xy = GoArray.toXY(col, row); if (_virtualPlayouts[xy] != 0.0) out.append(Double.toString((double) _virtualWins[xy] / (double) _virtualPlayouts[xy])); else { out.append(Double.toString(_virtualWins[xy])); out.append("/"); out.append(Double.toString(_virtualPlayouts[xy])); } out.append("\t"); } out.append("\n"); } out.append("\n"); for (int row = 1; row <= _boardSize; row++) { for (int col = 1; col <= _boardSize; col++) { int xy = GoArray.toXY(col, row); out.append(Double.toString(getVirtualWinRatio(xy))); out.append("/"); out.append(Double.toString(getWinRatio(xy))); out.append("\t"); } out.append("\n"); } out.append("\n"); return out.toString(); }