Skip to content

Learn to use HJKL with a game of Snake

Notifications You must be signed in to change notification settings

paramtapmewada/snake.hjkl

 
 

Repository files navigation

Snake -HJKL->

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.

Running It On Your Local Machine

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.

Build

To build the game in resources/public, run clojure -M:prod:play-cljc.

Why using the keys h,j,k and l?

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 left
  • j down
  • k up
  • l 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.

Inspiration

I used a lot of the code from this snake.

That's all?

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.

About

Learn to use HJKL with a game of Snake

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 85.1%
  • CSS 8.7%
  • HTML 5.7%
  • Shell 0.5%