LgrfUpdater implements TreeUpdater { @Override public void updateTree(Color winner, McRunnable runnable) { updater.updateTree(winner, runnable); HistoryObserver history = runnable.getHistoryObserver(); if (winner != VACANT) { Board playerBoard = runnable.getPlayer().getBoard(); int turn = runnable.getTurn(); boolean win = winner == playerBoard.getColorToPlay(); StoneColor color = playerBoard.getColorToPlay(); int t = playerBoard.getTurn(); short penultimate = history.get(t - 2); short previous = history.get(t - 1); for (; t < turn; t++) { short reply = history.get(t); table.update(color, win, penultimate, previous, reply); win = !win; penultimate = previous; previous = reply; color = color.opposite(); } } } LgrfUpdater(TreeUpdater updater, LgrfTable table); @Override void clear(); @Override int getGestation(); @Override SearchNode getRoot(); @Override void updateForAcceptMove(); @Override void updateTree(Color winner, McRunnable runnable);  }
@Test public void testLgrfUpdate(){ McRunnable runnable = player.getMcRunnable(0); runnable.acceptMove(coords.at("a1")); runnable.acceptMove(coords.at("b1")); runnable.acceptMove(coords.at("c1")); updater.updateTree(BLACK, runnable); assertEquals(coords.at("c1"), lgrfTable.getFirstLevelReply(BLACK, coords.at("b1"))); assertEquals(coords.at("a1"), lgrfTable.getFirstLevelReply(BLACK, NO_POINT)); assertEquals(coords.at("a1"), lgrfTable.getSecondLevelReply(BLACK, NO_POINT, NO_POINT)); assertEquals(NO_POINT, lgrfTable.getFirstLevelReply(BLACK, coords.at("a1"))); assertEquals(coords.at("c1"), lgrfTable.getSecondLevelReply(BLACK, coords.at("a1"), coords.at("b1"))); }