8
\$\begingroup\$

Robbers post

A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:

  • Split the string into equal sections.
  • Reverse the strings, and starting from the start of each string.
  • Put runs of a uniformly random length between 1 and the number of characters left in the current string into the final string
  • Then remove these characters from the string.
  • Repeat for the other half, until both halves are empty.

An example

"Hello World!"      Output string = ""
"Hello ", "World!"  ""
"Hell", "World!"    " o"
"Hell", "World"     " o!"
"Hel", "World"      " o!l"
"Hel", "Wo"         " o!ldlr"
"H", "Wo"           " o!ldlrle"
"H", ""             " o!ldlrleoW"
"", ""              " o!ldlrleoWH"

The final product from Hello World! could be o!ldlrleoWH and that is what you would output.

Cops

Your task is to make a program (or function) that will riffle shuffle a string. If the inputted string is of odd length, just split it into two uneven length strings with a relative length of +1 and +0 (abc => [ab, c] or [a, bc]). You may take input in the normal fashion and produce output in the normal fashion.

Your Cops submission will consist of 4 things

  • The language you used
  • The length of your program in bytes
  • Your program, riffle shuffled.
  • Anything else you want to add

You are aiming to keep your code from being uncracked by the Robbers for 7 days. After that period, your program is safe and you should edit in your original program. Your submission may still be cracked until you reveal your solution. The shortest, safe solution will be the winner!

\$\endgroup\$
  • \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$ – Jonathan Allan Jan 1 '18 at 13:52
  • \$\begingroup\$ The change to uniformly random makes me a sad dragon. I had fun making an entry using a Wald Distribution (inverse gaussian). I'd love to post it. \$\endgroup\$ – Draco18s Jan 11 '18 at 0:04
2
\$\begingroup\$

Jelly, 11 bytes, Cracked

This is a golfed version so someone can probably crack it easily just by making a golfy version. There are probably a few different approaches but I suspect this approach will be decently common with golfing languages.

Ṗ/Œż€X€U2sœ

The SHA-384 hash of my intended program is 86025a659b3c5fc38e943f72b1f26e28e2e751a7118a589073f1d24fa61ff6b02753d6a0f3f0c7fee6555de69fd06a74 (using UTF-8 encoding).

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – fireflame241 Jan 1 '18 at 3:58
  • \$\begingroup\$ @fireflame241 good job +1 \$\endgroup\$ – HyperNeutrino Jan 1 '18 at 17:32
2
\$\begingroup\$

><>, 46 bytes

 }lr]l:l~\r[-r}x>o?
<!l>x![; ?=\?(0:2i
:,2-%2:

There’s almost no obfuscations in the real code, but I suspect a 2D language will be hard enough to crack anyway.

Disclaimer: Written before it was specified that it had to be uniformly random. This is not uniformly random, and I'm not sure how I'd even implement a uniformly random algorithm in ><> to begin with.

\$\endgroup\$
1
\$\begingroup\$

Python 3, 154 bytes (list of chars -> list of chars) (function) Cracked

[=o;]1-::[]:s[i,]1-::[]s:[i=R,L;2//)i(nel=s    
:)i(r fed
*tropmi modR+L+o nruter    
]:s[L,R=R,L;]s:[L=+o;))L(nel,1(tnidnar=s:R dna L elihw    
]nar morf

I doubt this will be too hard to crack, especially since riffling once is rather ineffective (you can see entire program components in the output...). This is mostly just to get things rolling. There might be some whitespace (including newlines) that I didn't copy correctly. The SHA-384 hash of my intended solution is 5924530418bf8cd603c25da04ea308b124fdddfc61e7060d78b35e50ead69a7fbde9200b5ee16635cc0ee9df9c954fa1.

\$\endgroup\$
  • \$\begingroup\$ @H.PWiz Python. Whoops, forgot to add it in (also bytecount, thanks for the reminder!) \$\endgroup\$ – HyperNeutrino Jan 1 '18 at 3:21
  • \$\begingroup\$ In theory, could you just try reverse riffle shuffling the code and executing it with python until it works? \$\endgroup\$ – fəˈnɛtɪk Jan 1 '18 at 3:27
  • \$\begingroup\$ @fəˈnɛtɪk Theoretically that should work... It may take you a while though :P \$\endgroup\$ – HyperNeutrino Jan 1 '18 at 3:28
  • \$\begingroup\$ @fəˈnɛtɪk That's just like try solving the programming language quiz with TIO brute force. There is no fun in doing it. \$\endgroup\$ – user202729 Jan 1 '18 at 3:31
  • 1
    \$\begingroup\$ Recracked \$\endgroup\$ – fireflame241 Jan 1 '18 at 19:49
1
\$\begingroup\$

Röda, 118 bytes

2//x#=z}][=]:y[x
}]0>)b..a(#[]1-::[]:y[x
x#%)(reelihw}]0>b#[fi)b(g
getnI]0>a#[fi)a(g{]mo:z[x=b]zdnar=y|x|{=:[g{xx=a
 f

It takes a stream of characters as input and outputs a stream of characters.

\$\endgroup\$
1
\$\begingroup\$

R, 283 bytes, Cracked

/n,s(daeh-<l
))'',s(tilpsrts(le::sdohtem-<s
)s(rahcn-<n{)s(noitcnufhtgnel(fi
})x-,l(liat-<l
)))x,l(daeh(ver,o(c-<o
)1,)l(htgnel(elihw
}{-<o
)2/n,s(liat-<r
)2'=pes,o(tac
}})y-,r(liat-<r
)))y,r(daeh(ver,o(c-<o
)1,)r(htgnel(elpmas-<y{))r(l(fi{))r(htgnel|)l(htgnel()'htgne}(lpmas-<x{))le

I realize now that writing a longer answer has more "runs" of characters that are preserved, alas.

Good luck!

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – fergusq Jan 2 '18 at 9:38
  • \$\begingroup\$ @Mr.Xcoder thanks for the edit \$\endgroup\$ – Giuseppe Jan 3 '18 at 17:16
0
\$\begingroup\$

Pyth, 14 bytes, Cracked

_Qm/dc2iF.jk.O

Pretty standard-issue Pyth implementation to test the waters. May be quite easy to crack, but I guess we'll see how it fares.

\$\endgroup\$
0
\$\begingroup\$

Random Brainfuck, 273 bytes

]<.[<<]<[<<]<[<]<,.[<]-<<<]>>>>>]<+>-[<]<+>-[<<]>]>+<]<]>[>>]]>[>>]<]<+>-[[<<]>]>[>>]<-[[[>>]]>[>]<+>-[[<]<[[?>>]<+>-[[<]-<]>]<[>>]<<+>>+>-[[<<,[>]<.[<]>[>]<+>-[<]>[>]->>>]<<<<<]>+-[<<-[>]>+<-[>>]<]<+>-[[[<<]]<[<]>+<-[[><]<[[>]<+>-[>],]<+>-[<]<->>+]>[[<-[<?<<+>>>[,]>+<-[[>

Random brainfuck is the same as normal brainfuck, but it introduces the ? character, which sets the current cell to a random value. Fun note; I had a version of this that only worked for inputs of less than 256 characters, for obvious reasons, but the code itself was longer than that. When I changed it to handle longer, it turned out to be one byte shorter than the original. ¯\_(ツ)_/¯.

\$\endgroup\$
0
\$\begingroup\$

Pushy, 25 bytes, Cracked

iUL1[N@O;?x?v:/2L=0LF;.':

Takes input as a "quoted string" on the command line.

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – Jo King Jan 9 '18 at 0:26
  • \$\begingroup\$ Should the 1L be the other way around? Otherwise you're adding 1 to the length \$\endgroup\$ – Jo King Jan 9 '18 at 0:35
  • \$\begingroup\$ @JoKing Correct, and nice crack! \$\endgroup\$ – FlipTack Jan 9 '18 at 23:17
0
\$\begingroup\$

APL (Dyalog Unicode), 62 bytes

(g÷f¨()⍵(≢~⊃⍵⍺⍉⍨⍨}(←(←'')⊂f≢(g∘⌈¨}{?↑-⍵↑⋄)≢)))≢⊂{,⋄⍵⍵↑2f≢∘⊃?()

SHA-384 of my intended solution: 3209dba6ce8abd880eb0595cc0a334be7e686ca0aa441309b7c5c8d3118d877de2a48cbc6af9ef0299477e3170d1b94a

This is probably easy enough, especially since most of the people in the APL chat helped me build this answer.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.