![]() However, it is hard to identify the row and column of the JButton triggering an event.įor better OO and modular design, we design FIVE classes (in a package called minesweeper) as shown in the above class diagram: We could simply use 10x10 JButtons arranged in 10x10 GridLayout on a JPanel/ JFrame's ContentPane. You win if all the cells not containing mines are revealed you lose if you reveal a cell containing a mine. ![]() You left-click to reveal a cell and right-click on a cell to plant/remove a flag marking suspicious mine. The objective is to clear a rectangular mine field containing hidden "mines" without detonating any of them, with help from clues about the number of neighboring mines in the revealed cells. Mine Sweeper is a single-player mind game. You could wiki "Mine Sweeper" to understand the rules of the game. Do TODO 1 and run the program (2/10 points).The pre-requsite for this assignment is: You shall be able to program "SwingPhoneApp" in the "Exercises: Graphics Programming". Public static void main(String.Unfortunately, you have only little time to complete this mini-assignment. ![]() Also please point out any bad habits or patterns. I would love some input on how to make it more functional. I have gone for a more functional approach but it kinda feels weird, a mid point between functional and object oriented without doing anything right. I am not too concerned about the way it looks either, the main reason I post this here is to get an opinion on the design and code. It is working without any weird bugs, at least none that I found.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |