Skip to content

kohyama/clj-animation-towerofhanoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clojure Animation Tower of Hanoi

The code animates Tower of Hanoi in 3 ways

  • on a terminal,
  • on a gaphical window and
  • on a web browser

written in Clojure.

Demo

Clojure - Animate Tower of Hanoi in 3 ways

Usage

on a terminal

$ lein repl
toh.core=> (ns toh.terminal)
toh.terminal=> (require 'toh.terminal :reload-all)
toh.terminal=> (display 4 50) ; 4 disks, 50 ms wait
toh.terminal=> (display 5 10) ; 5 disks, 10 ms wait
toh.terminal=> (System/exit 0)

on a window

$ lein repl
toh.core=> (ns toh.swing)
toh.swing=> (require 'toh.swing :reload-all)
toh.swing=> (display 4 50 16) ; 4 disks, 50 ms wait, unit 16 pixels
toh.swing=> (close!)
toh.swing=> (display 5 10  8) ; 5 disks, 10 ms wait, unit 8 pixels
toh.swing=> (close!)
toh.swing=> (System/exit 0)

on a web browser

$ lein cljsbuild once
$ lein trampoline cljsbuild lein-repl
; (open http://localhost:9000/toh_canvas.html with your web browser)
ClojureScript:cljs.user> (ns toh.canvas)
ClojureScript:toh.canvas> (display 4 50 16) ; 4 disks, 50 ms wait, unit 16 pixels
ClojureScript:toh.canvas> (display 5 10 8) ; 5 disks, 10 ms wait, unit 8 pixels
ClojureScript:toh.canvas> :cljs/quit

License

Copyright (c) 2015 Yoshinori Kohyama. Distributed under the BSD 3-Clause License.

About

Animates Tower of Hanoi in 3 ways

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published