LgrfSuggester implements Suggester { @Override public ShortSet getMoves() { moves.clear(); final short previousMove = history.get(board.getTurn() - 1); short reply = table.getSecondLevelReply(board.getColorToPlay(), history.get(board.getTurn() - 2), previousMove); if (reply != NO_POINT && board.getColorAt(reply) == VACANT && filter.at(reply)) { moves.add(reply); } else { reply = table.getFirstLevelReply(board.getColorToPlay(), previousMove); if (reply != NO_POINT && board.getColorAt(reply) == VACANT && filter.at(reply)) { moves.add(reply); } } return moves; } LgrfSuggester(Board board, HistoryObserver history, LgrfTable table, Predicate filter);  LgrfSuggester(Board board, HistoryObserver history, LgrfTable table, int bias, Predicate filter); @Override int getBias(); @Override ShortSet getMoves(); void setTable(LgrfTable table);  }
@Test public void testLevel1() { lgrfTable.update(BLACK, true, coords.at("a1"), coords.at("b1"), coords.at("c1")); board.play(coords.at("d1")); board.play(coords.at("b1")); assertEquals(coords.at("c1"), suggester.getMoves().get(0)); }
@Test public void testOccupiedPoint() { lgrfTable.update(BLACK, true, coords.at("a1"), coords.at("b1"), coords.at("c1")); board.play(coords.at("c1")); board.play(coords.at("b1")); assertEquals(NO_POINT, suggester.getMoves().get(0)); }
@Test public void testFilter() { lgrfTable.update(BLACK, true, coords.at("a1"), coords.at("b1"), coords.at("c3")); String[] before = { ".....", "..#..", ".#.#.", "..#..", ".....", }; board.setUpProblem(before, WHITE); board.play(coords.at("b1")); assertEquals(0, suggester.getMoves().size()); }