Pancake numbers: Difference between revisions

m
→‎{{header|REXX}}: make it executabke as is
(→‎{{header|REXX}}: Show examples as required for this task)
m (→‎{{header|REXX}}: make it executabke as is)
Line 1,171:
do #=1 for 20; say pad center(#, 10) center( pancake(#), 15) /*index, flips.*/
end /*#*/
exit 0
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
pancake: procedure; parse arg n; gap= 2 /*obtain N; initialize the GAP. */
Line 1,211 ⟶ 1,212:
Call pancake n
End
pancake: Procedure
/**********************************************************************
* REXX pancake.rex
Line 1,243 ⟶ 1,245:
stackFlips.t=flips -- flips from init to t
Call qadd t -- append it to the queue
If ex<3 Then Do -- show the forstfirst 3 examples
call o flips t
If ex>=0 Then Do -- record the data to be shown
Line 1,266 ⟶ 1,268:
End
Call o 'max cnt.max:' max cnt.max
te=time('E') -- elaüsedelapsed time
te=strip(format(te,8,1))
Call o te 'seconds'
Call o ''
Call o2 'p('n') = 'exf', example: {'example'} (of' cnt.max', 'te's)'
Return
Exit
 
flip: Procedure
Line 1,290 ⟶ 1,292:
 
o: -- investigation and debug output
Return
Say arg(1)
Return lineout('heureka.txt',arg(1))
2,295

edits