Jump to content

Towers of Hanoi: Difference between revisions

m
→‎pictorial moves: added verbiage to the REXX section header.
m (→‎pictorial moves: added/changed whitespace and comments, elided some dead code, broke apart a long line of assignments, changed the wording in the REXX section header.)
m (→‎pictorial moves: added verbiage to the REXX section header.)
Line 2,568:
 
It may not be obvious from the pictorial display of the moves, but whenever a disk is moved from one tower to another, it is always the top disk that is moved   (to the target tower).
 
Also, since the pictorial showing of the moves may be voluminous (especially for a larger number of disks), the move counter is started with the maximum and is the count shown is decremented so the viewer can see how many moves are left to display.
<lang rexx>/*REXX program shows pictorial moves to solve Tower of Hanoi (with N disks).*/
parse arg N .; if N=='' then N=3 /*Not given? Then use default 3 disks.*/
Cookies help us deliver our services. By using our services, you agree to our use of cookies.