This is a simple snake game where you must use the keys h
, j
, k
and l
in order to eat some pills.
You can play it right now if you click here.
This game is based on a true story.
You need the clojure-cli tool to build the project. You might have it if clojure is installed on your machine.
Then, simply run clojure -M:dev
.
To build the game in resources/public
, run clojure -M:prod:play-cljc
.
In many CLI and specifically Vim, you can use the keys hjkl
to move around, instead of using the arrow keys.
The controls are:
h
leftj
downk
upl
right
Using hjkl
won't oblige you to move your hands to reach the arrow keys. It might sound silly, but it's really nice when you're used to it.
To teach people to do so, I developed this Snake game where you must use hjkl
to move the snake.
I speak about all of that in more details in my blog article Is Vim Really Not For You? A Beginner Guide.
I used a lot of the code from this snake.
This is my first ClojureScript project. It helped me learn the language, and it pushed me to think about functional stuff, like pure function, states and such.