CheckerMoves - /* / CheckerMoves.java Author: Lewis/Loftus...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // CheckerMoves.java Author: Lewis/Loftus // // Solution to Programming Project 6.24 //******************************************************************** / import javax.swing.JApplet; import java.awt.Graphics; import java.awt.Color; import java.util.Random; i public class CheckerMoves extends JApplet { int[][] checkerBoard; private final int NUM_ROWS = 8, NUM_RED = 5, NUM_BLACK = 8, BLACK = -1, EMPTY = 0, RED_CHECKER = 1, BLACK_CHECKER = 2, INSET = 5, STRING_OFFSET = 50, LABEL_OFFSET = 10; private String[] rowLabels = {"a", "b", "c", "d", "e", "f", "g", "h" }; //----------------------------------------------------------------- // Creates a checkboard and adds checkers in random positions //----------------------------------------------------------------- public void init() { checkerBoard = new int[NUM_ROWS][NUM_ROWS]; int j; for (int i=0; i<NUM_ROWS; i++) for (j=0; j<NUM_ROWS; j++) if ((i % 2 == 0) == (j % 2 == 0)) checkerBoard[i][j] = BLACK;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 3

CheckerMoves - /* / CheckerMoves.java Author: Lewis/Loftus...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online