Board { public boolean overlaps( int color, Piece piece, int i, int j) { for(Square s : piece.squares()) { if (outside(s, i, j)) return true; if (ij[i+s.i][j+s.j] > (piece.color == color ? 1: 2) ) return true; } return false; } Board(int color); Piece findPieceByType(String type); void add( Piece piece, int i, int j); int scoreSeedsIfAdding(Piece piece, int i, int j); boolean outside(Square s, int i, int j); boolean overlaps( int color, Piece piece, int i, int j); boolean fits( int color, Piece piece, int i, int j); boolean onseed( Piece piece, int i, int j); String toString(); String toString(int jmax); List<Square> seeds(); static final String tag; public int color; public int size; public List<Piece> pieces; public int nbPieces; public int score; public boolean over; }
@Test public void testOverlaps() { assertTrue( board.overlaps(0, L4, 0, 0)); assertFalse( board.overlaps(0, L4, 0, 1)); }