<> Project introduction

Minesweeping has a long history , Since mine sweeping was developed, it has been optimized countless times , This game is becoming more and more popular , Simple gameplay with a nice game interface , Every detail reflects the charm of mine sweeping . So this graduation project, I will develop a mine sweeping game .

This graduation project is based on JAVA Language as development environment , use Eclipse Design and develop a similar Windows Minesweeping game , Realize its basic functions . Firstly, the paper introduces the background of the subject , Secondly, the demand analysis and feasibility analysis are carried out ; Then design the game flow , This paper introduces the random algorithm of how to place and produce mines in minefield ; Finally, it introduces various times that may be triggered in the game , Such as mouse click time and clearing the grid without thunder , Among them, mouse events include those triggered by clicking or not clicking thunder, those triggered by clicking restart and those triggered by menu , It needs to be used to clean up the lattice without thunder “ recursion ” To make this function simple to implement .

Players need to find all mines in the minefield in the shortest time , And mark it , All other grids without thunder Click to open and win the game . But if you point to a mine, the game fails .

The operation of the game is very simple , When the player clicks the grid that he thinks is not a mine with the left mouse button, the grid will be opened , Clicking on a grid with the right mouse button will mark the grid , Right click again to unmark . Players can judge the area around the grid by the number displayed on the grid clicked in the minefield 8 A mine hidden in a grid , for example ： Click on the grid to display numbers “2”, Indicates the surrounding area of the grid 8 Hidden in a grid 2 A mine .
If there is no thunder under the grid and there is no surrounding 8 There's no thunder in either grid , The system will automatically click on the 8 A grid , Then recursively judge whether there is thunder around these grids .

This minesweeping game design , Need to write 7 individual Java class ：MineaGamae.java class ,MineAra.java class ,Block.jaav class ,BlockVaiw.java class ,LayMinas.java class ,Record.java Class sum ShowRecrd.java class .

(1) MineGame.java
MineGame Class is the entrance of the game , Used to initialize game resources , Such as interface size and thunder number . At the same time, it is also responsible for the conversion of difficulty .
(2) MineArea.java
MineArea Class is a mine that arranges minefields , In addition to initializing the minefield, it can also respond to the player's mouse operation .
(3) Block.java
Block Class is a POJO class , It mainly records the properties of each grid in the minefield , Like names , Number of surrounding mines, etc .
(4) BlockView.java
BlockView Class is used to display the attributes of a block , And use the card layout to divide the grid into two layers , When the player clicks on the grid , Will make the following properties appear .
(5) LayMines.java
LayMines Class is a class that calculates the number of rays around a lattice that is not a ray , And set the picture style after clicking . Created object lay yes MineArea The most important member of .
(6) Record.java
Record Class is through IO Stream stores game records in a local file , It mainly realizes the window of pop-up prompt after customs clearance , And record your grades .
(7) ShowRecord.java
ShowRecord Class is a class that displays minesweeping records .

<> design sketch

order record
pick want i
Abstract ii
1 introduction 1
1.1 Background and significance of the subject 1
1.2 Selection and introduction of development tools 1
1.3 Purpose and significance of the topic 2
2 requirement analysis 3
2.1 feasibility analysis 3
2.2 Function description of mine sweeping game 3
2.3 Use case diagram of mine sweeping game 4
2.4 Functional requirements of mine sweeping game 4
2.5 Minesweeping game interface requirements 5
2.6 Minesweeping game function module 6
3 Summary analysis and design of game 7
3.1 Design conception 7
3.2 Process planning 8
3.3 Interface planning 9
3.4 Algorithmic thought 9
4 Detailed design of the game 11
4.1 Game initialization 11
4.2 Arrangement of minefields 12
4.3 Introduction and use of main modules in the game 13
4.3.1 Mouse event 13
4.3.2 Surface detection of mines and mined areas 14
4.3.3 Clear the grid not close to the mine 15
4.3.4 Choice of game difficulty 16
4.3.5 Functions of menu bar 16
4.4 Game judgment 16
4.4.1 Game completed successfully 16
4.4.2 Game failure 16
4.5 Class design 17
4.5.1 MineGame class 17
4.5.2 Block class 18
4.5.3 BlockView class 19
4.5.4 Record class 20
4.5.5 ShowRecord class 21
4.5.6 MineArea class 22
4.5.7 LayMines class 23
5 Game implementation 25
5.1 Game difficulty customization 25
5.2 mine clearance 28
5.2.1 Players can clear mines by right clicking , And display a small red flag 28
5.2.2 The player touches the thunder and ends the game 29
5.2.3 Player minesweeps successfully 29
5.2.4 Player game data display 30
5.3 Program packaging and publishing process 32
6 Game test results 33
6.1 Game difficulty custom test 33
6.2 Minesweeping test 35
6.3 Player game data display test 37
6.4 Game data display area test 39
6.5 Recursive algorithm test 43
junction theory 44
reference 45
To thank 47
Foreign original 48
Chinese translation 55

Technology