Board { public boolean fits( int color, Piece piece, int i, int j) { if (i<-1 || i> size || j<-1 || j>size) return false; return ! overlaps( color, piece, i, j); } 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 testFits() { assertFalse( board.fits(0, L4, 0, 0)); assertTrue( board.fits(0, L4, 0, 1)); assertTrue( board.fits(0, L4, 0, 18)); assertFalse( board.fits(0, L4, 0, 19)); assertTrue( board.fits(0, L4, 18, 1)); assertFalse( board.fits(0, L4, 19, 1)); }