CACanvas - This code is for the moment totally uncommented...

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

View Full Document Right Arrow Icon
/* This code is, for the moment, totally uncommented. Sorry. David Eck Department of Mathematics and Computer Science Hobart and William Smith Colleges Geneva, NY 14456 E-mail: [email protected] WWW: http://math.hws.edu/eck/ June 18, 1996 NOTE: YOU CAN DO ANYTHING YOU WANT WITH THIS CODE, EXCEPT COPYRIGHT IT, PATENT IT, OR OTHERWISE TRY TO CLAIM CREDIT FOR IT. */ * import java.awt.*; i class CACanvas extends Canvas { c private boolean backedUp = true; private Image OSC = null; private int[] rule = null; private int ruleCt = 8; private int states = 2; private int neighbors = 3; private int halfNeighborCt = 1; private int[] startWorld = null; private int[] world = null; private int[] newWorld = null; private Color[] stateColor = null; private int width = 0; private int height = 0; private int lineCt = 0; synchronized void properties(int stateCt, int neighborCt, int[] theRules, Color[] theColors, boolean useOffScreenCanvas) { backedUp = useOffScreenCanvas; states = stateCt; if (states < 2) states = 2; neighbors = neighborCt; if (neighbors % 2 == 0) neighbors++; if (neighborCt < 3) neighborCt = 3; ruleCt = 1; for (int i=0; i<neighbors; i++) { if (ruleCt > 32768) { states = 2; neighbors = 3; ruleCt = 8; break; } ruleCt = ruleCt*states; }
Background image of page 1

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

View Full DocumentRight Arrow Icon
halfNeighborCt = neighbors / 2; rule = theRules;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course CSC 115 taught by Professor Jackson during the Spring '09 term at University of Victoria.

Page1 / 5

CACanvas - This code is for the moment totally uncommented...

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

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