PatternSuggester implements Suggester { @Override public ShortSet getMoves() { moves.clear(); final int turn = board.getTurn(); if (turn == 0) { return moves; } final short p = history.get(turn - 1); if (p == CoordinateSystem.PASS) { return moves; } final short[] neighbors = coords.getNeighbors(p); for (final short n : neighbors) { if (board.getColorAt(n) == VACANT) { final char pattern = calculatePattern(n); if (goodPatterns.get(pattern)) { moves.add(n); } } } return moves; } PatternSuggester(Board board, HistoryObserver history);  PatternSuggester(Board board, HistoryObserver history, int bias); @Override int getBias(); @Override ShortSet getMoves();  }
@Test public void test() { String[] diagram = { "O....", ".....", "O....", ".....", ".....", }; board.setUpProblem(diagram, BLACK); board.play("b4"); assertTrue(patterns.getMoves().contains(board.getCoordinateSystem().at("a4"))); board.play("c3"); board.play("c1"); assertFalse(patterns.getMoves().contains(board.getCoordinateSystem().at("b2"))); }
@Test public void testTigersMouth() { String[] diagram = { ".....", "..O#.", "...O.", ".....", ".....", }; board.setUpProblem(diagram, WHITE); board.play("b3"); assertFalse(patterns.getMoves().contains(board.getCoordinateSystem().at("c3"))); }