Search code examples
clojurenoir

Modelling/Programming European roulette board in Clojure


For school we are creating a roulette webapplication in Clojure with the webnoir framework. Everything seems realizable in Clojure, but the problem is: how do we define the board in our domain in Clojure? It must be possible to place corner bets etc.

And if we modelled this in our domain how do we send the information of the view to our domain/board?

Does anyone has ideas or suggestions?


Solution

  • Since there are infinite ways to define a board, many of them good, I'll avoid that question and primarily address the second: communicating between your board view and model.

    One solution using webnoir is to have your board view contain form[s] to perform actions. Submitting that form updates your board model and redirects to the same route, resulting in an updated view. I'm sure you've been leafing through Chris Granger's excellent documentation.

    Another route, albeit one that might be outside the scope of your project, is to have client side code dynamically communicate with the model and update your view, the end result being a single page webapp. This could be done with ClojureScript. If you are considering this, take a look at Chris Granger's libraries formerly known as pinot. They provide a wonderful complement to webnoir.