Starting to develop Minesweeper code java program module.

Asked By 0 points N/A Posted on -
qa-featured

I am new to Java programming, and I am going to develop a module for minesweeper code java program. As a starter I need to know the common syntax of that game so I can at least start.

Thanks.

SHARE
Best Answer by Moody Raglin
Best Answer
Best Answer
Answered By 0 points N/A #164762

Starting to develop Minesweeper code java program module.

qa-featured

Hi Dallas,

Before initiating you have to think of the logic to implement minesweeper as

  • How to scatter and generate random numbers on grids.
  • Logic to relate user clicked box with bomb available near around
  • And how to hide randomly generated numbers.

Generate random mines on board using random method. 

In java you have to define variables and methods in a class so we choose grids, row, columns and mines and define program within the class. You may download the sample code that attached below. Probably this would help you to get started with your program.

Thanks.

Answered By 0 points N/A #164763

Starting to develop Minesweeper code java program module.

qa-featured

Come up with the interface.

Ability to click on the interface.

Ability to distinguish between un-clicked button, a button with a mine, a button with a number, and a button that has been flagged.

On a button click, the ability to determine if the button is a mine and if not the ability to count neighboring squares.

Ability to detect when the game is finished, either by clicking on a mine or by clicking on all non-mine squares.

Defining the interface :

  • Minesweeper is a board so assuming a 10 by 10 matrix :
  • We use JPanel with grid layout to come up with this.

The rest is simply tiny stuff in java with initialization. Download the code that attached below.

Related Questions