Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further ToDos #17

Open
46 tasks done
tmrdlt opened this issue Sep 7, 2020 · 1 comment
Open
46 tasks done

Further ToDos #17

tmrdlt opened this issue Sep 7, 2020 · 1 comment

Comments

@tmrdlt
Copy link
Collaborator

tmrdlt commented Sep 7, 2020

SPRINT GOAL ♦️
  • Apply lenses to Data.matrix Feature/matrix lenses #28
  • Use actual randomSeed (either via user input or generated) Allow user to choose random seed incl. fallback in backend #29
  • Add ServerSideEvents [Tfoo, Chan] to update UI instantly 🗼 Add ServerSideEvents #31
  • Human Readable unique GameID generieren (like HarmfulExpectationsCeaseParticularly) @timunkulus
  • Generate games of predefined sizes / difficulty ⚡️
  • Rework user interface (minimal and clean design language, remove boilerplate) Facelift /games #30 @ndrsllwngr @timunkulus
    • Render digits using Attributes to remove flickering
    • Add game instructions (controls)
    • Go Back & Pause Button is just one
    • Completed game history in colors
  • BUG: It should be possible to put only as many flags as totally available @griase94
  • BUG: Show elapsed time of finished games @timunkulus
  • BUG: Pause a game that has no move yet will cause timeElapsed to be already counted @timunkulus
  • On reset finished game: leave game in DB and create new gameID @griase94
  • Update README.md (incl. usage, topics and short description) and align with lecture topics 🔺 Further ToDos #17 (comment)
  • Refactor project, cleanup code, align routes, give variables suitable names [86bae6f]
  • Format files with linter (e.g. stylish-haskell -r -i src/*), be careful that {-# LANGUAGE are preserved
  • Test project
    • game logic
    • moves
    • interactions & routing
    • warnings
BACKEND
  • Don't allow flagging of already revealed cells
  • Error Handling in Requests und Logik (z.b. outOfBound) ❓
FRONTEND
  • Landing page: Show total time of each game which is in final state (lost/won)
OPTIONAL
BUGS
  • Performance Issues ❓
NOT DOING
  • host project on heroku (https://github.com/mfine/heroku-buildpack-stack)
  • UI - implement right-click instead of alt+left-click to flag a cell
  • UI - add pressed state to unrevealed cell & face status
  • Leaderboard (sorted by time, grouped by size+difficulty) would be possible, if we would allow players to enter username (similar to retro game machines)
  • Add unit-tests
  • Error handling on route responses (e.g. show not found page)
  • Make use of advanced monads
  • Game page: Show move history on /game/#id page (🤔 not sure if useful at all. any information gain?)

DONE

REQUIREMENTS (Uni2Work)
  1. Webapplikation mit yesod
  2. Monaden

Fortgeschrittenere Themen, welche sich zu Monaden anrechnen lassen sind z.B. Monad-Transformer, Lifting, fortgeschrittene Verwendungen von Zustandsmonaden, etc.
Beachten Sie bitte, dass zu einer zufriedenstellenden Anrechnung des Themas Monaden mehr als einfacher monadischer Code (z.B. nicht nur do-Notation) vorhanden sein muss.

  1. Datenbankanbindung (Persistent)

zusätzlich eine Datenbankanbindung implementieren (z.B. mit Persistent), beispielsweise um Spielstände persistent zu speichern, um zu einem späteren Zeitpunkt mit dem Spiel fortfahren zu können.

  1. Tests (?)
  2. AI/Automated Problem Solving

Das Thema KI / Automated Problem Solving ist des Weiteren nicht direkt ein Thema der funktionalen Programmierung.

UPDATED REQUIREMENTS
  1. TVars (nebenläufigkeit)

TVars decken ja eigentlich sogar auch Nebenläufiges Programmieren

  1. Lenses

Sie könnten noch ein paar Lenses für irgendwelche Datentypen (die sie ja wahrscheinlich sowieso haben) definieren und deren Verwendung demonstrieren.

  1. Unlösbare Probleme (State monade)

Die unlösbaren Probleme sind sicherlich auch ein guter Punkt, den Sie in der Abgabe ja kurz dokumentieren und begründen könnten (was geht da, warum nicht).

@griase94
Copy link
Collaborator

griase94 commented Sep 13, 2020

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 a MongoDB
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants