home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
047.lha
/
hanoi.doc
< prev
next >
Wrap
Text File
|
1986-11-20
|
2KB
|
49 lines
File: 2294.comp-sys-amiga
Path: ...!decwrl!labrea!navajo!ali
From: ali@navajo.STANFORD.EDU (Ali Ozer)
Newsgroups: comp.sys.amiga
Subject: Towers of Hanoi
Date: 21 Feb 87 03:50:00 GMT
Date-Received: 23 Feb 87 03:03:50 GMT
Reply-To: ali@navajo.ARPA (Ali Ozer)
Distribution: world
Organization: Stanford University
Lines: 481
----->8 cut cut --------
Here's a fun little program. It solves the towers of hanoi in a workbench
window of its own... It occupies little space, and is meant to be run
with a low priority (by default, -20). I was inspired by a similar program
I saw running on a workstation once. (But this is better (of course),
because it has color and runs on our favorite micro.)
The program will go on solving the puzzle forever, unless stopped by clicking
on the (invisible) close gadget. The window also provides sizing and depth
gadgets, all also invisible. You can vary the parameters like speed at which
the disks are moved, the number of disks (1..25), colors, etc... From CLI,
you can specify these parameters as command line arguments (type "hanoi ?"
to see what is expected). From the Workbench, the program opens a little
window and asks you for the values...
Using the default values (5 disks, moving pretty slowly, and no text),
and a stack size of 2000, I was able to get 22 hanoi's running (with 512k
memory). Try it if you've got nothing better to do --- it's real fun!
The overall speed at which the puzzle is solved doesn't change, really.
(But, let me warn you, starting up 22 hanois will take some time... By the
last few Intuition is really having a fun time drawing and redrawing all
of the windows, over and over, every time to activate or reactive or resize
any window...)
I compiled hanoi with Manx, using 16 bits (code is about 9.2k). It should
compile under Lattice, but that's what I said about YaBoing, too... (and
it didn't)
I'll appreciate any comments or suggestions! (But please don't tell me the
disks look too ugly --- I know they do. Oh well! Not much you can do with
RectFill(), you know.)
Ali Ozer, ali@score.stanford.edu OR ali@navajo.stanford.edu
------->8 cut here and compile! you might also want to design an icon -----