Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import javax.swing.JButton;
- import javax.swing.JOptionPane;
- public class MineSweeper {
- public static boolean[][] mineField;
- public static boolean[][] clicked;
- public static JButton[][] mineButtons;
- public static final int MINES = 20;
- public static int mineCount;
- public static void main(String[] args) {
- int r,c;
- mineCount = 0;
- mineField = new boolean[12][12];
- mineButtons = new JButton[10][10];
- while (mineCount<MINES)
- {
- int x = (int)(Math.random()*10);
- int y = (int)(Math.random()*10);
- if (mineField[x+1][y+1] = false)
- {
- mineField[x+1][y+1] = true;
- mineCount++;
- }
- }
- new Display();
- }
- }
Add Comment
Please, Sign In to add comment