import java.awt.*;
import java.applet.AudioClip;

public class boxCanvas extends Canvas implements Runnable 
{
	protected int s = 2; 
	
	private boolean first = true;
	private int id;
	private int next = 0;
	private int current = ((int) (Math.random() * 18));
	private int xPos = 0;
	private int yPos = 0, y2Pos = -120;
	public static int c = (int) (Math.random() * 6);
	
	public Thread boxThread;

	private final int Roll[][] = {{2, 1, 4, 2, 1, 2, 1, 5, 3, 
								   1, 0, 4, 1, 5, 2, 1, 2, 0},
								  {3, 1, 3, 2, 0, 3, 0, 3, 0,
								   4, 3, 0, 3, 0, 1, 3, 0, 2},
								  {4, 5, 3, 1, 3, 5, 3, 1, 2,
								   3, 1, 5, 3, 1, 3, 2, 4, 3}};
	
	public Color DkGreen = new Color(0, 128, 0);
	public Color Orange = new Color(255, 156, 0);
	
	public boxCanvas(int pass) {id = pass;}

	//private AudioClip sound = getAudioClip(getDocumentBase(), "Ca-ching.wav");
	public void setNext(int n){
		next = n;
	}

	public int getY(){return y2Pos;}

	public int getCurrent(){
		return Roll[id][current+1];}

	
	public void start()
	{
		boxThread = new Thread( this, "BoxThread");
		boxThread.start();
	}

	public void stop()	{boxThread.stop();}
	
	public void run()
	{
		if (first != true)
		current++;
		{
			for(int j=1; j5)
				d=0;
			y += 6*s;
		}
		g.setColor(Color.white);
		x += 5*s;
		g.fillArc(x, y, w, h, 0, 90*s);
		c++;
		if(c>5)
			c=0;
	}

	public Graphics setTheColor(Graphics g, int e)
	{
		switch(e)
		{
			case 0:
				g.setColor(Color.red);
				break;
			case 1:
				g.setColor(Orange);
				break;
			case 2:
				g.setColor(Color.yellow);
				break;
			case 3:
				g.setColor(Color.green);
				break;
			case 4:
				g.setColor(Color.blue);
				break;
			case 5:
				g.setColor(Color.magenta);
				break;
			default:
				g.setColor(Color.cyan);
				break;
		}
		return g;
	}
}