@Test public void testCrosses() { Square s = new Square(1, 1); assertFalse( I3.crosses(s.i, s.j)); Log.d(tag, ""+L4 ); assertFalse(L4.crosses(s.i, s.j)); assertTrue(L4.crosses(-1, -2)); assertFalse(L4.crosses(-2, -2)); }
public boolean crosses(int x, int y) { if (isValue(x, y)) return false; if (touches(x, y)) return false; return ( isValue(x-1, y-1) || isValue(x+1, y-1) || isValue(x+1, y+1) || isValue(x-1, y+1)); }
Piece { public boolean crosses(int x, int y) { if (isValue(x, y)) return false; if (touches(x, y)) return false; return ( isValue(x-1, y-1) || isValue(x+1, y-1) || isValue(x+1, y+1) || isValue(x-1, y+1)); } }
Piece { public boolean crosses(int x, int y) { if (isValue(x, y)) return false; if (touches(x, y)) return false; return ( isValue(x-1, y-1) || isValue(x+1, y-1) || isValue(x+1, y+1) || isValue(x-1, y+1)); } Piece( int color, int size, String type, int rotations, int flips );  Piece( int size, String type, int rotations, int flips ); }
Piece { public boolean crosses(int x, int y) { if (isValue(x, y)) return false; if (touches(x, y)) return false; return ( isValue(x-1, y-1) || isValue(x+1, y-1) || isValue(x+1, y+1) || isValue(x-1, y+1)); } Piece( int color, int size, String type, int rotations, int flips );  Piece( int size, String type, int rotations, int flips ); void reset(); void reset(Piece ghost); Piece clone(); Piece add(Square s); Piece add(int x, int y); int getValue(int x, int y); boolean isValue(int x, int y); Piece rotate(int dir); Piece flip(); String toLabel(); @Override String toString(); boolean touches(int x, int y); boolean crosses(int x, int y); boolean overlaps(Piece that, int X, int Y); @Override boolean equals(Object obj); List<Square> squares(); List<Square> squares(int color); List<Square> seeds(); static String serialize(Piece piece); }
Piece { public boolean crosses(int x, int y) { if (isValue(x, y)) return false; if (touches(x, y)) return false; return ( isValue(x-1, y-1) || isValue(x+1, y-1) || isValue(x+1, y+1) || isValue(x-1, y+1)); } Piece( int color, int size, String type, int rotations, int flips );  Piece( int size, String type, int rotations, int flips ); void reset(); void reset(Piece ghost); Piece clone(); Piece add(Square s); Piece add(int x, int y); int getValue(int x, int y); boolean isValue(int x, int y); Piece rotate(int dir); Piece flip(); String toLabel(); @Override String toString(); boolean touches(int x, int y); boolean crosses(int x, int y); boolean overlaps(Piece that, int X, int Y); @Override boolean equals(Object obj); List<Square> squares(); List<Square> squares(int color); List<Square> seeds(); static String serialize(Piece piece); public String type; public int size; public int color; public int rotations; public int flips; public int count; static final String tag; }