public void setPointSet(MonteCarloPluginAdministration administration) { MersenneTwisterFast random = administration.RANDOM; _boardSize = administration.getBoardSize(); assert (_emptyPoints.getSize() == 0); PointSet copy = PointSetFactory.createPointSet(); copy.copyFrom(administration.getEmptyPoints()); // boolean isTestVersion = GlobalParameters.isTestVersion(); ProbabilityMap map = administration.getProbabilityMap(); byte colorToMove = administration.getColorToMove(); for (int size = copy.getSize(); size > 0; size--) { int xy = copy.get(random.nextInt(size)); copy.remove(xy); if (administration.isLegal(xy) && !administration.isVerboten(xy)) { _emptyPoints.add(xy); // if (isTestVersion) // { // float weight = (float)map.getWeight(xy, colorToMove); // float factor = (float)Math.log(weight); // if (weight<1.0) // weight = 0.0f; // else // weight -= 1.0f; // if (factor<1) // factor = 1.0f; // _virtualPlayouts[xy] = weight/factor; // _virtualWins[xy] = weight; // } // else { _virtualPlayouts[xy] = 0.0f; _virtualWins[xy] = 0.0f; } } } copy.recycle(); if (administration.isGameAlmostFinished()) { _virtualPlayouts[GoConstant.PASS] = 0; _virtualWins[GoConstant.PASS] = 0; _emptyPoints.add(GoConstant.PASS); } for (MoveGenerator generator : administration.getExplorationMoveGeneratorList()) { int xy = generator.generate(); if (xy != GoConstant.UNDEFINED_COORDINATE) increaseVirtualPlayouts(xy, generator.getUrgency(), generator.getUrgency()); } assert (_emptyPoints.freeze()); }
public void copyDataFrom(MonteCarloHashMapResult source) { _xy = source._xy; _color = source._color; _totalPlayouts = source._totalPlayouts; _wins = Arrays.copyOf(source._wins, source._wins.length); _playouts = Arrays.copyOf(source._playouts, source._playouts.length); _virtualWins = Arrays.copyOf(source._virtualWins, source._virtualWins.length); _virtualPlayouts = Arrays.copyOf(source._virtualPlayouts, source._virtualPlayouts.length); _emptyPoints.copyFrom(source._emptyPoints); _logNrPlayouts = source._logNrPlayouts; _beta = source._beta; _age = source._age; _checksum = source._checksum; _bestMove = source._bestMove; _bestResult = source._bestResult; usedLastBest = source.usedLastBest; _boardSize = source._boardSize; }