Checkers -...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: //******************************************************************** // Checkers.java Author: Lewis/Loftus // // Solution to Programming Project 6.23 //******************************************************************** / import javax.swing.JApplet; import java.awt.Graphics; import java.awt.Color; import java.util.Random; i public class Checkers extends JApplet { int checkerBoard; private int NUM_ROWS = 8, NUM_RED = 5, NUM_BLACK = 8, BLACK = -1, EMPTY = 0, RED_CHECKER = 1, BLACK_CHECKER = 2, INSET = 5; //----------------------------------------------------------------- // Creates a checkboard and adds checker 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; else checkerBoard[i][j] = EMPTY; populateBoard(); } //-----------------------------------------------------------------...
View Full Document

Page1 / 2

Checkers -...

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