A snake game implementation in clojurescript
This is a snake game implementation written in clojurescript using canvas.
It uses core.async for coordination and the code is divided in two parts, the UI and the game logic.
The code is fairly commented.
To compile and execute in development use the file
dev.html and compile using
lein cljsbuild auto cnake.
I developed this using lighttable connecting to an external tab. For connecting lighttable to the page you have to
Ctrl-Space and write
Add Connection and then choose
Ports. Copy the websocket port number and paste it on the html file substituting the one that is already there. Lighttable changes port every time it is started, so change it every time you restart it.
To compile for publishing on the web do
lein cljsbuild once cnake-prod. This will take about 20 seconds, and will compile with the advanced optimizations file.
To check the page and game open index.html
- Add sounds for the events (move, eat and game-over)
- Fix meta viewport on mobile devices
- Turbo and game restart on mobile?
- Make speed increase with snake size
- Make game restart when receiving any command