@Test public void testRotate() { I3.rotate(1); Log.d(tag, "" + I3); L4.rotate(1); }
public Piece rotate(int dir) { for (int y=-h; y<-h+size; y++) { for (int x=-h; x<-h+size; x++) { if (odd) set(x,y, (dir>0 ? get(y,-x) : get(-y,x)) ); else { if (dir<0) set(x,y, get(-y+1,x) ); else set(x,y, get( y, -x+1) ); } } } r = (r+1) % rotations ; toggle(); return this; }
Piece { public Piece rotate(int dir) { for (int y=-h; y<-h+size; y++) { for (int x=-h; x<-h+size; x++) { if (odd) set(x,y, (dir>0 ? get(y,-x) : get(-y,x)) ); else { if (dir<0) set(x,y, get(-y+1,x) ); else set(x,y, get( y, -x+1) ); } } } r = (r+1) % rotations ; toggle(); return this; } }
Piece { public Piece rotate(int dir) { for (int y=-h; y<-h+size; y++) { for (int x=-h; x<-h+size; x++) { if (odd) set(x,y, (dir>0 ? get(y,-x) : get(-y,x)) ); else { if (dir<0) set(x,y, get(-y+1,x) ); else set(x,y, get( y, -x+1) ); } } } r = (r+1) % rotations ; toggle(); return this; } Piece( int color, int size, String type, int rotations, int flips );  Piece( int size, String type, int rotations, int flips ); }
Piece { public Piece rotate(int dir) { for (int y=-h; y<-h+size; y++) { for (int x=-h; x<-h+size; x++) { if (odd) set(x,y, (dir>0 ? get(y,-x) : get(-y,x)) ); else { if (dir<0) set(x,y, get(-y+1,x) ); else set(x,y, get( y, -x+1) ); } } } r = (r+1) % rotations ; toggle(); return this; } 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 Piece rotate(int dir) { for (int y=-h; y<-h+size; y++) { for (int x=-h; x<-h+size; x++) { if (odd) set(x,y, (dir>0 ? get(y,-x) : get(-y,x)) ); else { if (dir<0) set(x,y, get(-y+1,x) ); else set(x,y, get( y, -x+1) ); } } } r = (r+1) % rotations ; toggle(); return this; } 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; }