The Towers of Hanoi implemented in Smalltalk.
"The Towers of Hanoi
Copyright (C) 2004 Amit Singh. All Rights Reserved.
Tested under Squeak on Mac OS X"
moveDisk: fromTower to: toTower
Transcript show: (fromTower printString, '-->', toTower printString).
doHanoi: n from: fromTower using: usingTower to: toTower
(n > 0) ifTrue: [
self doHanoi: (n - 1) from: fromTower using: toTower to: usingTower.
self moveDisk: fromTower to: toTower.
self doHanoi: (n - 1) from: usingTower using: fromTower to: toTower]
(Object new) doHanoi: 3 from: 1 using: 2 to: 3.