With any program, no matter the language or the scale, the first thing that you want to do is determine what exactly you will need. For minesweeper the list is fairly straightforward:
- Area to display the grid.
- Ability to click on squares in the grid.
- Ability to distinguish between unclicked square, square with a mine, square with a number, and square that has been flagged.
- On square click, the ability to determine if the square is a mine and if not the ability to count neighboring squares.
- Ability to detect when game is finished, either by clicking on a mine or by clicking on all non-mine squares.
- (Optional) Timer or move counter
- (Optional) Ability to change options; grid size, number of mines, etc.
Your answer to these questions may change depending on the language you choose to write the program in, and the personal desires of the client. It is important to note that creating any list such as this is not meant to be too detailed or all inclusive. Some programmers prefer to just jump right in, others prefer to have absolutely everything planned and outlined in advance.
I will be referring back to this post regularly, with the goal of having a working version of minesweeper in every language that I learn.
How about the rest? The dots ?! ;-)
ReplyDelete