Code ladder, Cops
Retina, 2 bytes, 10 numbers, Cracked
_1
Works for 1 to 10, _
is a hidden character. This shouldn't be too hard, but I hope it provides a somewhat interesting puzzle. :)
You can try Retina online over here.
Octave, 55 bytes, 10 numbers, cracked
(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_
_
is the unknown character.
Solution
(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o)
%then changing the very last0
to1,2,3
e.t.c.
Givenx
, this does recursively calculatex+1
. It is mainly composed of two anonymous functions. One provides anif
statement to anchor the recursion:
if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();
This is just abusing the fact that a boolean values evaluates to0
or1
. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:
plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})
As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argumentf
first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:
plus_one_final = @(n)plus_one(n,plus_one);
So in this notation my submission becomes:
(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)
I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.
Python 2, 9 bytes, 10 numbers, cracked
print 8/8
No hidden chars. Can you crack it without brute forcing?