ClojureScript snake game with p5.js

I made a simple snake game using ClojureScript and p5.js, with scaffolding courtesy of shadow-cljs.

The inspiration came from an old YouTube video by The Coding Train, which shows how to implement the snake game with JavaScript and the library p5.js.

My first attempt was almost a direct mapping of their JavaScript code to ClojureScript. It worked, but the code was messy so I proceeded to clean it up and add some tweaks of my own.

Click below to show/hide the game. Use arrow keys to navigate.

Click to show/hide the game.

The code is on GitHub. I plan to collect all my ClojureScript + p5.js demos in that repository. To run the snake demo, make sure the src/main/core.cljs file "requires" main.snake like this:

(ns main.core
  (:require [main.snake :as demo]))