// SampleGridTester.java // A sample tester program for CS 10 assignment 3, part 1, Fall 2008. // We might use a different one to grade your ColorGrid.java. // cmc, 10/21/08 import java.awt.Color; public class SampleGridTester { public static void main(String[] args) { ColorGrid grid = new ColorGrid(40, 40, Color.GREEN.darker()); int rows = grid.rows(); int columns = grid.columns(); for (int i = 10; i < rows-10; i++) { for (int j = 10; j < columns-10; j++) { int red = 255 * i * j / 1000; int blue = 255 - red; grid.set(i, j, new Color(red, 0, blue)); } grid.brighten(i, i); grid.darken(i, columns - i - 1); } grid.brighten(0, 0, 0, 38); grid.brighten(1, 0, 38, 0); grid.darken(39, 1, 39, 39); grid.darken(1, 39, 38, 39); grid.set(10, 10, 10, columns-11, Color.YELLOW); grid.set(rows-11, 10, rows-11, columns-11, Color.YELLOW); grid.set(11, 10, rows-12, 10, Color.YELLOW); grid.set(11, columns-11, rows-12, columns-11, Color.YELLOW); Color[][] colors = grid.grid(); CS10Display.showGrid(colors); // verify the grid() method returns a *copy* of Color array Color[][] copy = grid.grid(); if (copy == colors) System.out.println("grid() method returns original array, not a copy"); } }