Towers of Hanoi: Difference between revisions

m
→‎{{header|REXX}}: removed some superflous blank lines. -- ~~~~
m (→‎{{header|REXX}}: removed some superflous blank lines. -- ~~~~)
Line 1,621:
===version 1===
<lang rexx>/*REXX program to show the moves to solve the Tower of Hanoi (3 disks). */
 
arg z .
if z=='' then z=3
Line 1,630 ⟶ 1,629:
say 'The minimum number of moves to solve a' z "ring Tower of Hanoi is" moves'.'
exit
 
 
/*─────────────────────────────MOV subroutine───────────────────────────*/
mov: if arg(3)==1 then call dsk arg(1),arg(2)
Line 1,640 ⟶ 1,637:
end
return
 
 
/*─────────────────────────────DSK subroutine───────────────────────────*/
dsk: move=move+1
Line 1,688 ⟶ 1,683:
No attempt is mode to explain this REXX code because of the complexity and somewhat obtuse features of the REXX language, the smallest of which is support for ASCII and EBCDIC "graphic" characters.
<lang rexx>/*REXX program shows pictorial moves to solve Tower of Hanoi (3 disks). */
arg z .; if z=='' then z=3
 
arg z .
if z=='' then z=3
sw=80
wp=sw%3-1
Line 1,738 ⟶ 1,731:
say "The minimum number of moves for a" z 'ring Tower of Hanoi is' totmoves
exit
 
 
/*─────────────────────────────MOV subroutine───────────────────────────*/
mov: if arg(3)==1 then call rng arg(1) arg(2)
Line 1,748 ⟶ 1,739:
end
return
 
 
/*─────────────────────────────RNG subroutine───────────────────────────*/
rng: parse arg from dest
Line 1,797 ⟶ 1,786:
call showtowers
return
 
 
/*─────────────────────────────SHOWTOWERS subroutine────────────────────*/
showtowers: do j=z to 1 by -1