/*************************************************************************
* Name:
* NetID:
* Precept:
*
* Description: Creates an N-by-N diamond tile, where N is the command
* line input.
* (This is booksite
* Dependencies: StdDraw.java Web Exercise 2.1.1.)
*************************************************************************/
public class DiamondTile {
// draw a diamond outline, center at (x, y), diagonals = 2*size
public ________ void diamond(double x, double y, double size) {
________[] px = { x + size, x, x - size, x };
________[] py = { ______________________________________ };
StdDraw.polygon( _______, _________ );
}
// draw a filled diamond, center at (x, y), diagonals = 2*size
public static ______ filledDiamond(double x, double y, double size) {
double[] px = { x + size, x, x - size, x };
double[] py = { y, y + size, y , y - size };
_______________________________________________________
}
public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
// for easy computation, set scale to match pattern
StdDraw.setXscale(0, N);
StdDraw.setYscale(0, N);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
// black diamond
StdDraw.setPenRadius();
StdDraw.setPenColor(StdDraw.BLACK);
filledDiamond(i+.5, j+.5, .5);
// red outline
StdDraw.setPenRadius(.005);
______________________________________
diamond(_______ , _____ , ____);
}
}
}
}