Simple interactive 15-puzzle game in Clojure for presentation at Women Who Code Toronto event.
This project was intended as a demonstration of Clojure programming language in action. It is a learning tool.
As an introduction to Clojure syntax try this guide.
Please install IntelliJ IDEA and Cursive plugin for it. Both are available under free license.
In IntelliJ IDEA import this project: File → New → Project from Version Control → GitHub.
Use the repository URL:
[email protected]:jlebedeva/wwc-clojure.git
The project has a single namespace wwc-clojure.core. The implementation allows to play the 15-puzzle game in REPL.
Code contains detailed comments.
-
Right-click project.clj file in the Project panel on the left and select Run 'REPL for wwc-clojure'. When the message "nREPL server started..." appears in the REPL output area it is ready to interact with. At the bottom of REPL panel input area will be accepting new statements.
-
Open file src → wwc_clojure → core.clj.
-
Right-click anywhere inside the editor panel and select REPL → Load file in REPL. Note the instructions being printed: "To play: call...".
-
In REPL input area, type or paste in:
(def play! (wwc-clojure.core/new-game))
-
Check your board and make a move using another expression, for example to "move" the "empty" tile displayed as '*' (star) one position up:
(play! :up)