https://github.com/pitpik/minesweeper
VanillaJS minesweeper implememntation
https://github.com/pitpik/minesweeper
Last synced: about 1 year ago
JSON representation
VanillaJS minesweeper implememntation
- Host: GitHub
- URL: https://github.com/pitpik/minesweeper
- Owner: PitPik
- License: mit
- Created: 2023-01-30T20:41:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-01T21:42:27.000Z (over 3 years ago)
- Last Synced: 2025-01-26T21:56:29.247Z (over 1 year ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minesweeper
You don't need a server to play this game. Just DnD the `index.html` file into your browser or [play the 4896Byts version right here](https://htmlpreview.github.io/?https://github.com/PitPik/minesweeper/blob/master/index.min.html). (Download size ~2.3kB).
This is a little fun example that shows how to seperate concernes. This game is build uppon the MVC concept as a SPA. It's meant to be as small as possible although readable and maintainable.
There is a service that provides the model, a controller that just manipulates the model (or state of the game) and the view, that has it's on state model for its UI components.
The view only sets up the event listeners and the view and has access to the service's ```createBoard()``` to build the game and ```checkItem()``` from the controller to check the currently clicked item and ```getItems()``` for extracting items from the model with a certain property.
The event listeners are based on event delegation.
The controller and the service could be taken as is and being implemented in a CircularJS, Vue, Ember, React or Angular example. They are not dependend on this implementation at all.
Have fun =)