Best shuffle: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: elided a function, changed the bestShuffle function, added/changed whitespace and comments.) |
m (→{{header|REXX}}: elided the need for a B variable in the function.) |
||
Line 2,685: | Line 2,685: | ||
end /*j*/ |
end /*j*/ |
||
do k=1 for L |
do k=1 for L; a=substr(x, k, 1) /*handle a possible rep. */ |
||
a= |
if a\==substr(ox, k, 1) then iterate /*skip non-replications. */ |
||
b= substr(ox, k, 1) /*obtain the original char.*/ |
|||
if a\==b then iterate /*skip non-replications. */ |
|||
if k==L then x=left(x, k-2)a || substr(x, k-1, 1) /*last case.*/ |
if k==L then x=left(x, k-2)a || substr(x, k-1, 1) /*last case.*/ |
||
else x=left(x, k-1)substr(x, k+1, 1)a || substr(x, k+2) |
else x=left(x, k-1)substr(x, k+1, 1)a || substr(x, k+2) |