Upgrade to Pro — share decks privately, control downloads, hide ads and more …

EmojiSweeper: 💣💥 with Reagent and re-frame

Chris Jester-Young
April 28, 2016
160

EmojiSweeper: 💣💥 with Reagent and re-frame

Presented on 28th April 2016 at the TriClojure lightning talks session.

EmojiSweeper is a web-based Minesweeper that uses emoji to present a pleasant game interface. Coded in ClojureScript using Reagent and re-frame, it was designed to be the kind of game that a serious Minesweeper player would want to play.

Chris Jester-Young

April 28, 2016
Tweet

Transcript

  1. Mining My Own Business ❖ Aim: make a web-based Minesweeper

    I would play ❖ Beautiful, functional, fast
  2. In the Eye of the Beholder ❖ Aesthetic icons that

    display well on high-DPI devices ❖ I can’t draw, so I need to borrow others’ work ❖ Initial version used system emoji font ❖ Only usable on El Capitan ❖ Thanks to Twemoji, beautiful emoji everywhere
  3. Mine It Your Way ❖ I want to customise Minesweeper

    to the way I play ❖ Single-click “clear-around” ❖ 1.5-click ❖ Game pausing ❖ Special status indicator for a “no-flag” win
  4. Fast Reaction ❖ React’s value proposition: virtual DOM ❖ Frees

    me from having to worry about DOM state ❖ Only need to worry about model state ❖ Encourages functional-style programming ❖ Facebook’s Immutable library ❖ Why not Clojure’s own persistent data structures?
  5. Paradox of Choice ❖ There’s just 1 React, but 3

    ClojureScript interfaces ❖ Had to start somewhere, went with Reagent ❖ Discovered re-frame and knew I struck gold
  6. Who re-framed Roger Rabbit ❖ re-frame: like Flux, only easier

    ❖ Subscribers: only get notified if relevant state changes ❖ Event handlers: arbiters of all state changes ❖ Components do not change state directly, unlike React ❖ Dispatch events to trigger (async) state change ❖ Can dispatch from: DOM events, AJAX callbacks, tick events, etc.
  7. Future Directions ❖ Small and medium boards ❖ Choice of

    other emoji sets ❖ “Pro” Minesweeper stats (like 3BV/s) ❖ Leaderboards?