//This program was written by Michelle Koberlein and Naomi Rivera //The code is a little bit crazy, but it was our first JAVA applet. //The applets palys the game Simon. I'm sure everyone remembers Simon //If not, just check out our html page for directions. //I hope everyone enjoys this game. import java.awt.*; import java.applet.*; import java.util.*; public class Simon extends Applet { myPanel panel1; myPanel panel2; myPanel panel3; myPanel panel4; Canvas swatch1,swatch2,swatch3,swatch4; int [] sequence = new int[50]; Random myRandom = new Random(); boolean correctMove = true; int Passes=0; int m = -1; public void init(){ setLayout(new GridLayout(3,1,10,10)); panel1 = new myPanel(this,Color.red,0); panel2 = new myPanel(this,Color.green,1); panel3 = new myPanel(this,Color.yellow,2); panel4 = new myPanel(this,Color.blue,3); add(panel1); add(panel2); add(panel3); add(panel4); add(new Button("Begin")); } // void init public boolean action(Event e, Object arg){ if (e.target instanceof Button) RandomPanel(1); else if(checkSequence()); return true; } //boolean action // RandomPanel take an int which is the number of times it chosen color //should blink. It then generates a random number that gets sent to //PickPanel. It also stores the generated number in an array to be //checked later. public void RandomPanel (int NumberBlinks){ int PickedPanel=0; int i; Passes = NumberBlinks; boolean condition; for (i=0; i