Designing an HTML5 game

Thinking about games in general leads you to design a rather complex system in which you'd have several independent entities interacting on the playing board. This seems to be a perfect case for core.async, especially considering how plain JavaScript code could have become bloated had you gone the classical way: laying out a solution inside a single huge loop. In fact, core.async and ClojureScript will enable us to design a very elegant and human-readable solution, one considering every element of the UI as an independent co-routine, executing concurrently and communicating through channels.

Imagine that you want to design a very simple game in which balls are falling from the sky and you must catch as many of them as you ...

Get Clojure Data Structures and Algorithms Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.