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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.