Back to index

wims  3.65+svn20090927
PlinkoBall.java
Go to the documentation of this file.
00001 import java.awt.*;
00002 import java.util.*;
00003 
00004 
00005 public class PlinkoBall{
00006     final static double A = -2.0 - Math.sqrt(3); // Ball follows the motion of
00007     final static double B = 1.0 + Math.sqrt(3);         // y = Ax^2 + Bx
00008     Color color;                                 // color of ball, choosen randomly from above list
00009     PlinkoBall nextBall;                  // link to next ball in list
00010     PlinkoBall previousBall;              // link to previous ball in list
00011     double X;                                    // x-coordinate of location of ball
00012     double Y;                                    // y-coordinate of location of ball
00013     int ROW;
00014     int COL;
00015     int DIR;
00016     int C;                                                                   
00017     int t;                                              // ranges from 0 to (10-rate), parametrizes the motion of ball
00018     int spaz;                                    // 
00019     //double dx;
00020     boolean sound = false;
00021 
00022     public PlinkoBall( ){
00023               // pick a random color for the ball
00024               spaz = (int)( PlinkoBoard.COLORS.length*Math.random() );
00025               color = PlinkoBoard.COLORS[spaz];
00026 
00027               nextBall = null;
00028               previousBall = null;
00029 
00030               ROW = -1;
00031               COL = 0;
00032               DIR = 0;
00033               t = 0;
00034               C = 11-((Integer)Plinko.rate.getValue()).intValue();
00035     }
00036 }