This project is just something for me to play around with elm-lang, elm-ui and to wrap my head around functional programming at it's purest.
The goal of this side project is to have a working minesweeper web application (as a thousand other in the web) in a similar behaviour as the Gnome Mines application.
I also like the way the android game Minesweeper - The Clean One solved some issues for touch devices.
Features it should have (in no particular order):
- Multiple difficulties ✔
- A current played game history ✔
- Able to pause and resume the game ✔
- Able to switch between click or mark fields ✔
- See the result board after finished the game ✔
- If the game has been won or lost ✔
- The mines should be revealed on the board ✔
- The end state of the board ✔
- Time it took for the game ✔
- After game finish:
- Able to start a new game with the same difficulty ✔
- Back to overview to create a new game ✔
- Click on a number, where are enough marks to open all remaining items should work ✔
- Open a blank field should open all other blank fields and the neighbour number fields ✔
- Have some game information like
- how many mines are still missing ✔
- how many have been marked ✔
- how much time it took for the game ✔
- Have the game automated build and published to https://swissbite.github.io/elm-minesweeper/ ✔
This project will be an on/off project ;-)
Use nvm or nvm-windows to have the correct node version installed. On Microsoft Windows, you may consider to use the dev environments on Docker for Desktop.
nvm use
npm install
- Run
npm run start
to start a local development server with auto-reload and all other features
npm run test
npm run format-validate
Currently, I'm following Structuring Web Apps and the Live of a file
To simplify lookups as a developer, I split it in three main files:
- Types.elm: All types and type aliases. No functions, no helpers, no transformers.
- Styles.elm: Make styles reusable. Define colors, icons, predefined elements (like the toogle element). But does not hold any model related code. Styles has zero dependencies to Types.elm
- Main.elm: The main startup application. Responsible for initialize the application. Coordinates update subscription and view between the different elements.
- Game/Game.elm:Has its own msg type, GameMsg. Responsible for the complite minesweeper game flow. Extracted into own module to be able to add additional views like an About view or other stuff.
- Game/History.elm: The game history of lost / won games. Sortable.
Elm Minesweeper is licensed under the GNU Affero General Public License version 3 or later.