Logo Search packages:      
Sourcecode: wims version File versions

PlinkoBall.java

import java.awt.*;
import java.util.*;


public class PlinkoBall{
    final static double A = -2.0 - Math.sqrt(3);      // Ball follows the motion of
    final static double B = 1.0 + Math.sqrt(3);       // y = Ax^2 + Bx
    Color color;                          // color of ball, choosen randomly from above list
    PlinkoBall nextBall;                  // link to next ball in list
    PlinkoBall previousBall;        // link to previous ball in list
    double X;                                   // x-coordinate of location of ball
    double Y;                                   // y-coordinate of location of ball
    int ROW;
    int COL;
    int DIR;
    int C;                                                        
    int t;                                      // ranges from 0 to (10-rate), parametrizes the motion of ball
    int spaz;                                   // 
    //double dx;
    boolean sound = false;

    public PlinkoBall( ){
            // pick a random color for the ball
            spaz = (int)( PlinkoBoard.COLORS.length*Math.random() );
            color = PlinkoBoard.COLORS[spaz];

            nextBall = null;
            previousBall = null;

            ROW = -1;
            COL = 0;
            DIR = 0;
            t = 0;
            C = 11-((Integer)Plinko.rate.getValue()).intValue();
    }
}

Generated by  Doxygen 1.6.0   Back to index