![]() Goal is to discover and avoid hidden mines within a gridded minefield, and Having binged on at least once or twice in their lives. That ubiquitous single-player puzzle game that most of us will admit to Weeks ago, I discussed briefly how to use event callbacks to implementĪnd later used this as a base for creating a Here they are.Lately I've been playing around with interactivity in matplotlib. to setMine(), or check isMine(), or the more straightforward isChecked() as opposed to isNotChecked(). Public ArrayList generateMinesLocation(int q)) Īs pointed out by it'll be better have methods that directly represents the exact actions we want on a Cell, i.e. JPanel panel = new JPanel(new GridLayout(side,side)) įor(int i = 0 i loc = generateMinesLocation(10) I post basic working GUI version, if someone would like to run it.įtDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) ![]() However I will be gratefull for any commants and advices, also concenring OOP, code structure and style. These are two methods in Board Class: setCellValues() and scanForEmpt圜ells(). I wonder if my solution is reasonable (it works, but it look scary), and I would be great, if someone would review it. The hardest part for me, was a determining the value of single cells (how many mines is around it), and firing a chain reaction, if some cell was empty(value = 0) - it check closest cells, if they have value, it just reveal it, if they are empty it repeats process on them. Board - coordinating behavior of cells.Cell - controling behavior of single cell.I wrote a basic Minesweeper game for practice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |