ShapeRater implements Rater { @Override public void updateNode(SearchNode node) { for (short p : coords.getAllPointsOnBoard()) { if (board.getColorAt(p) == VACANT) { long hash = PatternFinder.getHash(board, p, minStones, history.get(board.getTurn() - 1)); node.update(p, bias, (int) (bias * shapeTable.getWinRate(hash))); } } } ShapeRater(Board board, HistoryObserver history,
			ShapeTable shapeTable, int bias, int minStones); void setTable(ShapeTable table); @Override void updateNode(SearchNode node);  }
@Test public void testUpdateNode() { short p = coords.at("a1"); assertEquals(1, node.getWins(p), 0.01); assertEquals(0.5, node.getWinRate(p), 0.01); rater.updateNode(node); assertEquals(1.0 + (BIAS * 0.5), node.getWins(p), 0.01); assertEquals((1.0 + (BIAS * 0.5)) / (2.0 + BIAS), node.getWinRate(p), 0.01); }
@Test public void testSpecificUpdate() { short p = coords.at("c2"); long hash = PatternFinder.getHash(board, p, MIN_STONES, history.get(board.getTurn()-1)); shapeTable.update(hash, true); assertEquals(0.55f, shapeTable.getWinRate(hash), 0.01); rater.updateNode(node); assertEquals((1.0 + (BIAS * 0.5)) / (2.0 + BIAS), node.getWinRate(coords.at("a1")), 0.01); assertEquals((1.0 + (BIAS * 0.55)) / (2.0 + BIAS), node.getWinRate(p), 0.01); }