I am stuck on creating it with only one array. I am currently: Tiles.java--- imp
ID: 3635698 • Letter: I
Question
I am stuck on creating it with only one array. I am currently:Tiles.java---
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JPanel;
public class tiles extends JPanel implements MouseListener
{
public tiles()
{
}
int numAdjacent;
private void set numberAdjacentTiles(){
}
private boolean mines(){
return isIt;
}
boolean isIt
private void placeMines(boom boolean){
isIT=boom
}
private void reveal (clicked boolean){
if (mines() == true)
{
initGame.gameOver();
}
else{
gameWon();
}
}
int gameMines;
private int mineCounter(mines int){
gameMines=mines;
}
----
initGame.java
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JPanel;
public class initGame extends JPanel implements MouseListener
{
public initGame()
{
Grid();
JButton enterButton = new JButton( "Press to Start" );
// add an action listener for button's action (click)
enterButton.addActionListener(
// this is a way of mimicking Function passing in AS3
new ActionListener()
{
/**
* Invoked when associated action is performed.
**/
public void actionPerformed( ActionEvent e )
{
// this is where you put the code you want
// executed when the button is pressed
// here, we call a method to update the display
resetTiles();
}});
}
private int numberTilesAdjacent(){
}
public Grid()
{
// Grid Boxes
setLayout( new GridLayout( 10, 10 ) );
new Tiles[10][10]
for( int i = 0; i < 10 && i < 10; i++ )
{
addCard( rows[i], columns[i] );
}
private void resetTiles();{
getMines();
getTiles();
}
private void placeMines(int mines);{
for (int i =0; i < mines; i++){
Random a = new Random();
int rowNum = a.nextInt(100);
Random b = new Random();
int colNum = b.nextInt(100);
[rowNum][colNum].placeMines(true);
}
}
private void getMines();
{
Random generator = new Random();
// Get the next integer between 0 and 20.
int randomNumber = generator.nextInt(30);
numberMines=randomNumber
Tiles.mineCounter(numberMines);
placeMines(numberMines);
}
private void gameOver();
{
}
private boolean bounds();
{
if ( Tiles[1]|| Tiles[2]|| Tiles[3]|| Tiles[4]|| Tiles[5]|| Tiles[6]|| Tiles[7]|| Tiles[8]|| Tiles[9]|| Tiles[10]){
return true
}
else if( Tiles[0][1]|| Tiles[0][2]|| Tiles[0][3]|| Tiles[0][4]|| Tiles[0][5]|| Tiles[0][6]|| Tiles[0][7]|| Tiles[0][8]|| Tiles[0][9]|| Tiles[0][10]){
return true
}
else{
return false
}
}
int totalTiles;
private void countClicks(){
totalTiles= totalTiles + 1
}
private void gameWon(){
if( 100-totalTiles == numberMines)
{
return ();
}
}
public static void Grid( String[] args )
{
Grid();
initGame();
}
}
}