RaveNode extends SimpleSearchNode { @Override public void recordPlayout(float winProportion, McRunnable runnable, int t) { final ShortSet playedPoints = runnable.getPlayedPoints(); super.recordPlayout(winProportion, runnable, t); playedPoints.clear(); while (t < runnable.getTurn()) { short move = runnable.getHistoryObserver().get(t); if (move != PASS && !playedPoints.contains(move)) { assert runnable.getBoard().getCoordinateSystem() .isOnBoard(move); playedPoints.addKnownAbsent(move); addRaveRun(move, winProportion); } t++; if (t >= runnable.getTurn()) { return; } move = runnable.getHistoryObserver().get(t); playedPoints.add(move); t++; } } RaveNode(CoordinateSystem coords); void addRaveLoss(short p); void addRaveRun(int p, float w); void addRaveWin(short p); @Override void clear(long fancyHash, CoordinateSystem coords); int getRaveRuns(short p); float getRaveWinRate(short p); float getRaveWins(int p); @Override void recordPlayout(float winProportion, McRunnable runnable, int t); @Override String toString(CoordinateSystem coords);  }
@Test public void testRecordPlayout() { node.recordPlayout(1, new short[] {at("a1"), at("b2"), at("a2")}, 0, 3, new ShortSet(coords.getFirstPointBeyondBoard())); assertEquals(3, node.getRaveRuns(at("a1")), 0.001); assertEquals(2, node.getRaveWins(at("a1")), 0.001); assertEquals(3, node.getRaveRuns(at("a2")), 0.001); assertEquals(2, node.getRaveWins(at("a2")), 0.001); }
@Test public void testBug1() { short[] moves = new short[coords.getArea() * 2 - 2]; int i = 0; for (short p : coords.getAllPointsOnBoard()) { if (i < moves.length) { moves[i] = p; i++; moves[i] = p; i++; } } node.recordPlayout((float) 0.5, moves, 0, moves.length, new ShortSet(coords.getFirstPointBeyondBoard())); }