[PD] Tower of Hanoi

Steffen stffn at dibidut.dk
Wed Feb 28 12:37:04 CET 2007


Hey list,

I've toyed with an implementation of a solution to the Tower of Hanoi  
problem in Pd. It ended up being too simple once i skipped trying to  
use the recursive algorithm that normally is used to solve the  
problem. Instead i've used an iterative algorithm that uses a binary  
representation of each move, and from that the disk number being  
moved, from where it's moved and where to, is fairly simply  
calculations using the bitwise operators that ships with Pd ( - which  
I thought i was gonna implement that first, but no).

See for example the wikipedia entry on the topic for more info.

Attached is the patch, made as an abstraction, and a help file that  
demonstrate it.

Any comment is very welcome!

Best, Steffen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hanoi.pd
Type: application/octet-stream
Size: 2347 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070228/25fd3615/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hanoi-help.pd
Type: application/octet-stream
Size: 3446 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070228/25fd3615/attachment-0001.obj>
-------------- next part --------------




More information about the Pd-list mailing list