Comments (1)
Description
Minesweepskell is a web implementation of the widely known video game Minesweeper fully written in the Haskell functional programming language.
Features
- Minesweeper Web App with three predefined difficulties as well as customizable games
- Slim & blazing fast UI powered by server side events
- Join other players on their game either to view them playing or to play together
- Pause games & continue later
- History of all finished games to revisit your best & worst performances
Architecture
Web application with the Yesod
framework
- REST Backend
- Frontend fully developped in
Yesods
shakespearean templating system - Server-side events in order to provide live UI rerendering and updates for a flawless User Interface, which even has the possibility to play/view one game on multiple Bowsers/Machines simultaneously
Global mutable in-memory state with TVars
- Global state of all ongoing games realized with
TVars
, which provide mutability as well as atomic writing operations - The state only contains all ongoing games, paused and finished (lost/won) games are moved from the in-memory state to the database, if a paused game is continued it will be loaded back into the in-memory state
Database with Persistent
& MongoDB
- As just mentioned Minesweepskell stores non-ongoing games in a database this is realized by using the
Persistent
library to connect aMongoDB
Elegant data accessing/manipulation with Lenses
- In order to manipulate and query data types more elegantly
lenses
are used for almost all operations on data types - Lenses for matrices are provided by the
matrix-lens
package and provide elegant manipulation of cells on the game board
Utilisation of Monads
Monads
are widely used throughout the project, especially the IO monad for things like state manipulation, as well as Yesods Handler Monad for the REST API, own Monads are not defined- Problem: Initially we wanted to realize the global mutable state with the
State
monad, but we could not get it to work in combination with Yesods handler monad. Due to this we switched to TVars for the global in-memory state, which proved to be a better choice, since it even provides atomic writing operations and was astonishingly smooth to implement for our use cases.
from ffp.
Related Issues (9)
- UI - Sprites
- Boilerplate Yesod HOT 1
- Notes / Resources HOT 6
- Switch db to mongo HOT 1
- Modify game logic to only set state to succeed if user has flagged all bombs and pushed button to end game HOT 2
- Verify oncontextmenu listener is removed/added correctly
- Add delete game option to /game
- Deploy yesod-app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffp.