All pastes #509575 Raw Edit

Minesweeper

public java v1 · immutable
·published 2007-05-25 15:15 UTC
rendered paste body
/** * @(#)minesweeper.java * * * @author  * @version 1.00 2007/5/18 */import java.applet.*;import java.awt.*;import java.awt.event.*;import java.util.Random;public class minesweeper extends Applet implements Runnable, MouseListener{ 	int maxX, maxY, mineCount; 	//Game Object, Handles instances of the game at different settings. 	public class game{ 		box grid = new box;   		   		int mineCount, minesFlagged;   		int flaggedSpaces, blankSpaces;   		long timePlayed;   		   		//Constructor Method   	   		   		public game (int setXBound, int setYBound, int setMineCount){   					   		}   	}      	//Game Settings Method   	public void newGame(short difficulty){  		   		   		switch(difficulty){		case'1':						game gameBeginner = new game( 8, 8, 10);			break;		case'2':						game gameIntermediate = new game( 16, 16, 40);			break;		case'3':						game gameExpert = new game( 30, 16, 99);			break;		default:						game gameBeginner = new game( 8, 8, 10);			break;   		}			   	}      	//Graphics Handling Events   	public void paint(Graphics g){	}   	//Double Buffering, as provided by the JavaBoutique Tutorial.	public void update (Graphics g){	// initialize buffer	if (dbImage == null){		dbImage = createImage (WIDTH, HEIGHT);		dbg = dbImage.getGraphics ();	}	// clear screen in background	dbg.setColor (getBackground ());	dbg.fillRect (0, 0, WIDTH, HEIGHT);	// draw elements in background	dbg.setColor (getForeground());	paint (dbg);	// draw image on the screen	g.drawImage (dbImage, 0, 0, this);	}      	//Mouse Handling Events   	public void mouseClicked(MouseEvent e){   	}   	public void mouseEntered(MouseEvent e){   	}   	public void mouseExited(MouseEvent e){   	}   	public void mousePressed(MouseEvent e){  	}   	public void mouseReleased(MouseEvent e){   	}    	   	//Thread Handling Events      	public void init(){   	newGame(1);// 1 = Beginner, 2 = Intermediate, 3 = Expert   	}   	public void start(){   		Thread runGame = new Thread (this);		runGame.start();   	}   	public void stop() {  	}   	public void destroy() {   	}   	public void run(){	Thread.currentThread().setPriority(Thread.MIN_PRIORITY);	addMouseListener(this);		while(true){				}	}}