Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Permutations/Amazing-Hopper/permutations.hopper
Normal file
35
Task/Permutations/Amazing-Hopper/permutations.hopper
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/* hopper-JAMBO - a flavour of Amazing Hopper! */
|
||||
|
||||
#include <jambo.h>
|
||||
Main
|
||||
leng=0
|
||||
Void(lista)
|
||||
Set("la realidad","escapa","a los sentidos"), Apnd list(lista)
|
||||
Length(lista), Move to(leng)
|
||||
Toksep(" ")
|
||||
Printnl( lista )
|
||||
Set(1) Gosub(Permutar)
|
||||
End-Return
|
||||
|
||||
Subrutines
|
||||
|
||||
Define( Permutar, pos )
|
||||
If ( Sub(leng, pos) Isgeq(1) )
|
||||
i=pos
|
||||
Loop if( Less( i, leng ) )
|
||||
Plusone(pos), Gosub(Permutar)
|
||||
Set( pos ), Gosub(Rotate)
|
||||
Printnl( lista )
|
||||
++i
|
||||
Back
|
||||
Plusone(pos), Gosub(Permutar)
|
||||
Set( pos ), Gosub(Rotate)
|
||||
End If
|
||||
Return
|
||||
|
||||
Define ( Rotate, pos )
|
||||
c=0, [pos] Get(lista), Move to(c)
|
||||
[ Plusone(pos): leng ] Cget(lista)
|
||||
[ pos: Minusone(leng) ] Cput(lista)
|
||||
Set(c), [ leng ] Cput(lista)
|
||||
Return
|
||||
Loading…
Add table
Add a link
Reference in a new issue