Skip to content

Instantly share code, notes, and snippets.

@gazliddon
Created December 15, 2014 16:45
Show Gist options
  • Save gazliddon/298480b62c80f42593e3 to your computer and use it in GitHub Desktop.
Save gazliddon/298480b62c80f42593e3 to your computer and use it in GitHub Desktop.
Man, clojure is terse
(def get-event-action [table event current-state]
(let [identity (fn [o _] o)]
(get-in table [current-state event] identity)))
(def player-state-table
{:spawning {:timeout go-running }
:running {:button go-jump
:fall-off go-fall }
:falling {:out-of-bounds go-die
:button go-jump
:landed go-running }
:jumping {:button go-double-jump }
:dieing {:timeout go-quit}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment