Board { public boolean onseed( Piece piece, int i, int j) { for(Square s : piece.squares()) { if ( !outside(s, i, j) && ij[i+s.i][j+s.j]==1) 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 testOnseed() { assertTrue( board.onseed(L4, 0, 1)); assertFalse( board.onseed(L4, 2, 4)); board.add(L4, 0, 1); assertTrue( board.onseed(L4, 2, 4)); }