39
\$\begingroup\$

This is part of a challenge. Go here for the robbers' part.

The Cops' Challenge

You should write a program or function in a language of your choice, which outputs the string Haystack. However, it must be possible to remove some subset of characters from your program (without reordering the rest), such that the resulting string is also a valid program in the same language, which prints Needle instead. Both programs/functions may optionally print a single trailing newline (independently of each other), but nothing else. Output is case sensitive and must follow the exact casing provided.

Your goal, of course, is to hide the "needle" very well. But note that your submission can be cracked with any valid solution, not just the one you intended.

Please include in your answer:

  • The language (and version if relevant) of your submission.
  • The size of the Haystack program in bytes.
  • The Haystack program itself.
  • The output method if it's not STDOUT.
  • If possible, a link to an online interpreter/compiler for your chosen language.

Your submission may be either a program or function, but not a snippet and you must not assume a REPL environment. You must not take any input, and you may output via STDOUT, function return value or function (out) parameter.

Both programs/functions have to complete within 5 seconds on a reasonable desktop machine and need to be deterministic. You must not use built-ins for hashing, encryption or random number generation (even if you seed the random number generator to a fixed value).

In the interest of fairness, there must be a freely available interpreter or compiler for your chosen language.

An answer is cracked if the Needle program is found. If your answer has not been cracked for 7 days, you may reveal the intended Needle program in your answer, which renders your submission safe. As long as you don't reveal your solution, it may still be cracked by robbers, even if the 7 days have already passed. The shortest safe Haystack program (measured in bytes) wins.

Examples

Here are a couple of simple examples in different languages:

Ruby

Haystack: puts 1>0?"Haystack":"Needle"
Delete:        XXXXXXXXXXXXXXX
Needle:   puts "Needle"

Python 2

Haystack: print "kcatsyaHeldeeN"[-7::-1]
Delete:          XXXXXXXX        XX
Needle:   print "eldeeN"[::-1]

Note that the subset of removed characters doesn't have to be contiguous.

Uncracked Submissions

<script>site = 'meta.codegolf'; postID = 5686; isAnswer = false; QUESTION_ID = 144600;</script><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>jQuery(function(){var u='https://api.stackexchange.com/2.2/';if(isAnswer)u+='answers/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJeRCD';else u+='questions/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJO6t)';jQuery.get(u,function(b){function d(s){return jQuery('<textarea>').html(s).text()};function r(l){return new RegExp('<pre class="snippet-code-'+l+'\\b[^>]*><code>([\\s\\S]*?)</code></pre>')};b=b.items[0].body;var j=r('js').exec(b),c=r('css').exec(b),h=r('html').exec(b);if(c!==null)jQuery('head').append(jQuery('<style>').text(d(c[1])));if (h!==null)jQuery('body').append(d(h[1]));if(j!==null)jQuery('body').append(jQuery('<script>').text(d(j[1])))})})</script>

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Related. (The main difference is that that one had the programs implement OEIS sequences and allowed the cracked program to output any different OEIS sequence, which makes it a lot harder for the cops to guard against unintentional cracks. It also allowed robbers to steal cracks from other robbers by finding even shorter solutions.) \$\endgroup\$ Oct 7 '17 at 14:21
  • \$\begingroup\$ I would do this in Haystack but it has no documentation and I cbb looking through the code :( \$\endgroup\$
    – Okx
    Oct 7 '17 at 15:45
  • \$\begingroup\$ @Okx github.com/kade-robertson/haystack/wiki/Documentation \$\endgroup\$
    – hyper-neutrino
    Oct 7 '17 at 15:50
  • 1
    \$\begingroup\$ The stack snippet gets the length wrong for this answer \$\endgroup\$
    – mbomb007
    Oct 9 '17 at 20:02
  • 1
    \$\begingroup\$ @kamoroso94 Yes, but that means you can terminate candidate programs after 5 or 6 seconds, because if they haven't finished they can't be the solution you're looking for. \$\endgroup\$ Oct 14 '17 at 11:24

25 Answers 25

16
\$\begingroup\$

Haystack, 84 bytes, Cracked

0\\1-c\
//    
?10F17+c8F+4+cd8F+3+c6-c1+c,c2+c8+c|
 0   \1++c,c|
F/c++2F8
c\8F+2+cd

Try it online!

This looks (to me) rather convoluted but if you find the right subset it's a bit too easy... oh well, just to get us started :P

\$\endgroup\$
6
  • \$\begingroup\$ Cracked. \$\endgroup\$ Oct 7 '17 at 16:27
  • 1
    \$\begingroup\$ @icrieverytim 1. oo cool they're both unicode glyphs 2. the current one is more scientifically accurate \$\endgroup\$
    – hyper-neutrino
    Oct 8 '17 at 14:23
  • \$\begingroup\$ 1. Yeah, I know, they look really cool. :P I found them in this gold mine of a Unicode block. Don't be surprised if they end up in Neon's code page. 2. TBH, the old one looked better IMO. :P \$\endgroup\$ Oct 8 '17 at 14:31
  • 1
    \$\begingroup\$ @HyperNeutrino Why do you have an interest in benzene? \$\endgroup\$
    – Michthan
    Oct 9 '17 at 13:23
  • 3
    \$\begingroup\$ @Michthan Considering that I'm a neutrino, that is a good question, but I don't know :P \$\endgroup\$
    – hyper-neutrino
    Oct 9 '17 at 13:28
12
\$\begingroup\$

Hexagony, 37 bytes

H[@;(...e<l.a;./$.>;\sN;\ac.>).;;;._y

Try it online!

Just my obligatory Hexagony entry...

For convenience, here is the unfolded code:

   H [ @ ;
  ( . . . e
 < l . a ; . 
/ $ . > ; \ s
 N ; \ a c .
  > ) . ; ;
   ; . _ y

How this works:

The program starts off with H, then we move to IP #5. This IP starts in the west corner, bouncing and wrapping around while executing (in effect) ;a;y;s; (so we've printed Hays). Then s gets incremented to a t by ) and printed, then we pass through Ne...(c before getting to a;c; (still bouncing around a small section of the hexagon). The program hits the _, reflects up through \ to l which gets decremented to a k by (, which passes through another \ before being printed and the program terminates on the @.

Verbose version

H   H is entered into the current memory cell
[   We move to the previous instruction pointer (starting at the / and moving NE)
/   No-op
<   Mirrors the IP back to south-west
/   No-op (IP now wraps to the NE corner)
;   Outputs H
.   No-op
a   a is entered into the current memory cell
>   Mirrors the IP back to north-east
a   a is entered into the current memory cell
.   No-op
;   Outputs a (IP now wraps SE corner)
y   y is entered into the current memory cell
;   Outputs y
.   No-op
s   s is entered into the current memory cell (IP now wraps SW corner)
;   Outputs s
)   Increments the memory cell to t
\   Mirrors the IP west
;   Outputs t
N   N is entered into the current memory cell (IP now wraps to e)
e   e is entered into the current memory cell
... No-ops
(   Decrements the memory cell to d (IP now wraps to . on SE edge)
.   No-op
c   c is entered into the current memory cell
a   a is entered into the current memory cell
\   Mirrors the IP north-east
>   Redirects the IP east
;   Outputs a
\   Mirrors the IP south-west
c   c is entered into the current memory cell
;   Outputs c
_   Mirrors the IP north-west
.\. No-ops
l   l is entered into the current memory cell
(   Decrements the memory cell to k (IP now wraps to . on SE edge)
.\  No-ops
;   Outputs k
.   No-op
@   Terminates the program

\$\endgroup\$
7
  • 3
    \$\begingroup\$ This language still cracks me up. I love you for it. \$\endgroup\$
    – phroureo
    Oct 9 '17 at 16:44
  • \$\begingroup\$ My brain is exploding right now. I was trying to figure this out enough to crack the code, but YEESH man. What kind of twisted guy makes this up?? \$\endgroup\$
    – phroureo
    Oct 13 '17 at 18:10
  • \$\begingroup\$ @phroureo ... >_> \$\endgroup\$ Oct 13 '17 at 18:20
  • \$\begingroup\$ After your answer is safe, can you give me a step-by-step on what it's doing? (Or if you already have a step-by-step somewhere one something similar, point me there?) \$\endgroup\$
    – phroureo
    Oct 13 '17 at 18:22
  • 1
    \$\begingroup\$ @phroureo I don't mind adding an explanation of the cop program before it's safe, and I don't think I'll claim it safe anyway (I'm not too keen on winning my own challenge with a submission that I put barely any effort in). I'll try to add the explanation tomorrow. In the meantime, I'm happy to help you with Hexagony in the esolangs chatroom. \$\endgroup\$ Oct 13 '17 at 19:44
10
\$\begingroup\$

Brain-Flak, 146 bytes (Cracked)

([((((()()())){}){}){}](()([()](()({}([((((()()()){})))[]])[]({}({})[{}]()({}((()(({}){}){}){}){}())))[][][][][][]))[]))(((()[]){}){({}[()()])}{})

Try it online!

Intended solution, 80 bytes

([((((()()())){}){}){}](()([()](()({}([((((()()()){})))[]])[]({}({})[{}]()({}((()(({}){}){}){}){}())))[][][][][][]))[]))(((()[]){}){({}[()()])}{})
( ((   )(                  [(  (( (         )()()){})) []]   ({}(  )    ( (  ( ()(({}){}){}){}){}())))            ))    (((()[]){}){({}[()  ])}{})
\$\endgroup\$
1
9
\$\begingroup\$

Haskell, 168 bytes (Cracked by nimi)

hays=map;hay=zipWith;stack=head;h=stack{-
 hay.(hays.(stackany hay$or id).stack hay
<*>hays(sum$stack haystack<$>hay))-}$words
 "Haystack Hayst ackH aysta ckH aystac k"

Try it online! Evaluating the identifier h returns the string "Haystack", after some deletions h yields "Needle".

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked. Was quite some fun to solve. \$\endgroup\$
    – nimi
    Oct 13 '17 at 13:08
8
\$\begingroup\$

JavaScript, 95 bytes (ES6), Cracked

A function returning a string.

f=(k=b=x=35)=>x--?f(k*74837258394056219&268435455):k&2?'N'+(k^124038877).toString(b):'Haystack'

"Haystack" demo

f=(k=b=x=35)=>x--?f(k*74837258394056219&268435455):k&2?'N'+(k^124038877).toString(b):'Haystack'

console.log(f())

\$\endgroup\$
1
  • \$\begingroup\$ Very nice puzzle. Cracked \$\endgroup\$ Oct 7 '17 at 19:15
4
\$\begingroup\$

Jelly, 41 bytes (Cracked)

“¿ọ⁽ṅ*FỊ⁼g£¡#!ʋzoɦṪ£ṢÞḲÐɠ`”m3⁾“»jVḟ“¡!pṄ»

Try it online!

Happy hunting!

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – jacobly
    Oct 8 '17 at 14:09
4
\$\begingroup\$

Hexagony, 32 bytes. Cracked

I couldn't solve Martin's, so I'm posting my own.

];N.@cl;e@;;(\H/;ya;_.>s.;t//<._

Try it online!

Here it is formatted:

   ] ; N .
  @ c l ; e
 @ ; ; ( \ H
/ ; y a ; _ .
 > s . ; t /
  / < . _ .
   . . . .

My aim with this was for both solutions to use as many IPs as possible, I got 6 for Needle and only 5 for Haystack.

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

Pyth, 44 bytes (Cracked)

Kr."Dn2û"2sf!/+rrK2 2r."EL8"2Tr."AhÐP­®Z"2

Try it here.

\$\endgroup\$
3
  • \$\begingroup\$ Should be easy to crack, just a first attempt :-) \$\endgroup\$
    – Mr. Xcoder
    Oct 7 '17 at 17:10
  • \$\begingroup\$ @_@ Why is there Jelly code \$\endgroup\$
    – Leaky Nun
    Oct 8 '17 at 9:43
  • \$\begingroup\$ cracked \$\endgroup\$
    – Leaky Nun
    Oct 8 '17 at 9:51
3
\$\begingroup\$

Java (OpenJDK 8), 226 217 bytes (Cracked)

First ever code golf, probably very easy but it was a fun challenge!

String d(){int h=3609000-5055+911,m=557558,s=15441301-157*10000;String d="0"+h*2+""+m*20+""+s*7,x="",y;for(int g=0;g<d.length();g+=3){y="";for(int e=0;e<3;e++)y+=d.charAt(e+g);x+=(char)Integer.parseInt(y);}return x;}

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Your TIO doesn't work. You might want to change the return new Main().d(); to System.out.print(new Main().d()); in the main-method. \$\endgroup\$ Oct 9 '17 at 12:47
  • \$\begingroup\$ @KevinCruijssen Thanks for the heads up! \$\endgroup\$ Oct 9 '17 at 13:12
  • 1
    \$\begingroup\$ Cracked. \$\endgroup\$
    – milk
    Oct 9 '17 at 21:57
3
\$\begingroup\$

dc, 148 bytes (Cracked)

6 93 3 9 2 2**+*+483622 1 2 3 3*+3*+89 47*+*+3 5 2* 269 158 9**107 97*2 4*++2 3 3*+42 14 2**+*+5*+5 2148 1 6 2*+*+68262 5 280 7 2 3 3*+5 2**+*+*+*+P

Try it online!

It is rather simple, but I hope it will be at least a little fun to solve :з

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

JavaScript, 119 bytes (ES6), Cracked

A function returning a string. Quite long and not so hard, but hopefully fun.

_=>(+{}+['H'])[+[3]]+(+[][[]]+[])[+!!3]+(+[][[]]+['y'])[3]+(+[][[]]+['s'])[-~2]+(~![]+['t'])[2]+(+[][[]]+[])[+!!3]+'ck'

"Haystack" demo

let f =

_=>(+{}+['H'])[+[3]]+(+[][[]]+[])[+!!3]+(+[][[]]+['y'])[3]+(+[][[]]+['s'])[-~2]+(~![]+['t'])[2]+(+[][[]]+[])[+!!3]+'ck'

console.log(f())

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. The jsfuck github README.md helped a lot. \$\endgroup\$ Oct 8 '17 at 8:16
2
\$\begingroup\$

Python 2.7.2, 103 / 117 bytes, Cracked

Function Version (117 bytes):

def e():
 a,b,s=20070763850923833476353301471991752,0b1010100010010011,""
 while a>0:
  s=chr(a%b)+s
  a//=b
 print s

Program Version (103 bytes):

a,b,s=20070763850923833476353301471991752,0b1010100010010011,""
while a>0:
 s=chr(a%b)+s
 a//=b
print s

This should print Haystack well. Tested on Python Fiddle.

Btw this is the first attempt.

Not sure if the program version is counted as a snippet, so I put both versions here.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – jacobly
    Oct 9 '17 at 4:01
2
\$\begingroup\$

Python 2.7.10 with Numpy 1.12.1, 208 209 bytes (cracked)

It appears that there is a Needle and a Haystack in Numpy! Here is the Haystack; see if you can find the Needle. I hope you have as much fun searching for the Needle as I had hiding it.

import numpy
print "".join([dir(numpy)[int(i)][1-0] for i in numpy.poly1d([-1*1433/252e1,-3232/1920.,4026./72/2/3.,613/(6*4.)*1,-4723./1.8e2,-9763/120.,-2689/(-1+5*17.),1+138*.4*2])(numpy.arange(-12/3,13%9))])

It outputs as specified:

Haystack

You can repl.it.

\$\endgroup\$
2
  • \$\begingroup\$ Not that it really matters, but this is 209 bytes, not 208 \$\endgroup\$ Oct 8 '17 at 20:12
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – jacobly
    Oct 9 '17 at 11:32
2
\$\begingroup\$

Java 8, 321 bytes, Cracked

v->{String h="Haystack";int x=-7;return x<0?h:new String(new java.math.BigInteger(new byte[]{(byte)((~-~-~-~-~-~-~-~-~-~1^-x++*x)+151),new Byte("2"+"1+\"0+\"".length()+(x=h.length()*4/x)+"-x-7")}).toByteArray())+(new StringBuffer("hidden".substring(++x%3^4,--x-x--).replaceFirst("dd","e"+(char)(x*211%+93))).reverse());}

Try it here.

More readable:

v->{
  String h="Haystack";
  int x=-7;
  return x<0?
          h
         :
          new String(new java.math.BigInteger(new byte[]{
            (byte)((~-~-~-~-~-~-~-~-~-~1^-x++*x)+151),
            new Byte("2"+"1+\"0+\"".length()+(x=h.length()*4/x)+"-x-7")
          }).toByteArray())
          +(new StringBuffer("hidden".substring(++x%3^4,--x-x--)
             .replaceFirst("dd","e"+(char)(x*211%+93))
            ).reverse());
}

Not sure if it's too long/hard.. Then again, Java in general is pretty long to begin with, so hiding the 'Needle' properly of course increases the byte-count quite a bit..
If no one cracks it, I'll add some spoiler-tips later on.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ The TIO has one fewer character, but cracked either way. \$\endgroup\$
    – jacobly
    Oct 9 '17 at 19:44
2
\$\begingroup\$

Ruby, 185 bytes, cracked by cab404

x='yGwztsPXhxDkBKlCYdFjQnpUROfoHvqmTgbaJSLcEiZrIAuMVNW'
s="n=x.to_i 36;x.bytjs.jach_cons(3){|a,b,c|n+=n*b%c;n*=a^b};puts n%8675309==1388649 ?'Njjdlj':'Haystack'"
eval s.tr ?j,s.size.chr

Try it online!

I'll try to come up with something sneaky, but for now here's a try at "simple but obnoxious."

\$\endgroup\$
3
2
\$\begingroup\$

Brain-Flak, 188 bytes (Cracked)

I only just saw Funky Computer Man's answer As I posted this.

It is somewhat obfuscated.

((((((((((()()()){}){}()){}){}()){}()))<({}[(()()()()){}])(([[]]({})<>)<>)>((()()())){}{})[()]))<[[]()]>((()){}){}((){}[][(<>){}<>])(<>){}(({}<>()[()])[(((()()()){}<[()]>)<(()){}>{}){}()])

Try it online!

Intended solution, 96 bytes:

((((((((((()()()){}){}()){}){}()){}()))<({}[(()()()()){}])(([[]]({})<>)<>)>((()()())){}{})[()]))<[[]()]>((()){}){}((){}[][(<>){}<>])(<>){}(({}<>()[()])[(((()()()){}<[()]>)<(()){}>{}){}()])((((((((()()()){}){}){}()){}){}()<>)<>)(()()()){}())<>(((({}[()]<>)()))[(((()()()){}())()){}{}])
(((((((( (()()()){}){}  ){}){}()){}()))      ()()                   <>)     (()()()) {}    () ) <      >((()      ((){}    <>)     )   )  (({}        )[(((()()  ){}  ()  )  () {}   ){}()])

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ You mean somewhat obfuscated beyond just normal Brain-Flak obfuscation. \$\endgroup\$
    – Gryphon
    Oct 9 '17 at 13:33
  • \$\begingroup\$ @Gryphon Yes, I added some extra bits. \$\endgroup\$
    – H.PWiz
    Oct 9 '17 at 15:41
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Nitrodon
    Oct 15 '17 at 0:15
2
\$\begingroup\$

T-SQL, 757 characters CRACKED

Apologies for deleting my previous answer--I edited it too many times as I obfuscated, and didn't want to give anything away. :)

In any case, obfuscating in SQL is a bit difficult, unless you want to do crazy stuff like this, and I wasn't that invested.

Also, I unabashedly do not apologize for naming my variables after Dota.

SQL Fiddle

create table a(l int,c int)
insert into a values (1,10),(2,1),(3,8),(4,0)
go
;CREATE FUNCTION b(@ varchar(max)) returns varchar(max) as
begin return 'char('+@+'),'''','end 
go
;CREATE FUNCTION h(@ varchar(max),@a varchar(max), @b varchar(max), @c varchar(max), @d varchar(max), @e varchar(max), @f varchar(max), @g varchar(max), @h varchar(max))
returns varchar(max) as 
begin
return replace(replace(replace(replace(@,@a,@b),@c,@d),@e,@f),@g,@h)
end
declare @x varchar(max),@ int=1,@y varchar(99)=''
,@D varchar(4)='Ha',@O varchar(4)='ys'
,@T varchar(3)='ta',@A varchar(4)='ck'
WHILE @<=4
BEGIN
set @y+=(SELECT dbo.b(c+100)from a where l=@)+' '
set @+=1
END
SELECT @x='select
left(dbo.h('''+@D+@O+@T+@A+''','+ left(@y,len(@y)-1) +'),char(56))'
execute(@x)

If this is the easiest answer in this thread, you're probably right. :P It's hard to trick SQL.

\$\endgroup\$
9
  • \$\begingroup\$ shouldn't 'haystack' be 'Haystack'? \$\endgroup\$
    – cab404
    Oct 11 '17 at 1:58
  • \$\begingroup\$ SQL doesn't handle capitalization very nicely (unless you specifically define the schema that it's supposed to use for the letters). I opted not to. :P \$\endgroup\$
    – phroureo
    Oct 11 '17 at 2:55
  • 1
    \$\begingroup\$ @phroureo The spec does explicitly state that it must be capitalized correctly. \$\endgroup\$
    – LyricLy
    Oct 11 '17 at 3:51
  • \$\begingroup\$ Alright, I fixed the code above (although I didn't necessarily fix the SQL Fiddle, since it works the same). \$\endgroup\$
    – phroureo
    Oct 11 '17 at 15:54
  • 1
    \$\begingroup\$ cracked (I'm sorry...) \$\endgroup\$ Oct 15 '17 at 10:53
1
\$\begingroup\$

Ly, 40 bytes, cracked

(78)"e"&p"Ha"s"yst"l"ck"&o(100)"l"l'&'o;

Try it online!

Oh boy, another Ly CNR submission. These haven't worked very well historically (possibly due to me and not the language), but we'll see how this fares and today is no exception.

Solution:

(78)"e"sl(100)"l"l&o;, remove XXXXXX XXXXX XXXXXX X X with seven leading spaces

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

Java, 345 bytes, Cracked

import java.util.*;interface Main{static void main(String[]args){Stack<Hay>s=new Stack();s.add(new Needle());for(int i=0;i<1000;i++)s.add(new Hay());System.out.println(s.get(s.indexOf(new Hay())+1).a);}}class Needle extends Hay{{a="Needle";}}class Hay{String a="Haystack";public boolean equals(Object o){return getClass().equals(o.getClass());}}

Try it online!

Really long and probably easy to crack, but at least it's got a Stack<Hay>!

\$\endgroup\$
1
  • \$\begingroup\$ very nice one! but yes, pretty easy to crack. \$\endgroup\$
    – Titus
    Oct 20 '17 at 12:28
1
\$\begingroup\$

Vyxal o, 51 bytes

‛Ha:₍₴Cv∑∑Ṙ⌊√‹½⇩⇩²C:₴«•∞yλ;ß4ġ∆Ė_□∴9«øc:3Ẏ$4ȯ∇ppĖ5e

Try it Online!

Have fun!

So, here's an explanation of the code:

‛Ha                                      # Push 'ha'
   :₍                                    # Duplicate and parallel apply...
     ₴                                   # Flatprint
      C                                  # And charcode, wrapped into a list
       v∑∑Ṙ                              # Get sum, concatenate, reverse (`961aH`)
           ⌊√‹½                          # Intify, square root, decrement and halve (15)
               ⇩⇩²C                      # Subtract 4, convert to char, which happens to be y
                   :₴                    # Dupe and flatprint.
                     «...«               # Push a string, specially chosen, see below
                          øc             # Compress
                            :3Ẏ$4ȯ∇pp    # Insert ToS (`y`) at char 3
                                     Ė   # Evaluate
                                      5e # Every fifth character

So, I realised I could use the compressed string ‛₍∞ as the needle program. I could easily sneak in a and , but was proving to be a problem. Eventually, I managed to construct a compressed string that contained and y, and had the property that if you took every fifth character, you got 'stack'.

So yeah, this was tricky.

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

TI-BASIC, 119 bytes (Safe)

Output stored in Ans.

"TIBASIC→Str1
length(Ans→X
Str1
For(I,X,2(7-4not(X-1
Ans+sub("ACDEHKLNSTY",inString("ABCDEFGHIJK",sub("KCBADAEDJDHIGF",1+remainder(11I-1,14),1)),1
End
sub(Ans,1+X,length(Ans)-X

Solution

Remove characters from Str1 to give it a length of 1.

"C→Str1
length(Ans→X
Str1
For(I,X,2(7-4not(X-1
Ans+sub("ACDEHKLNSTY",inString("ABCDEFGHIJK",sub("KCBADAEDJDHIGF",1+remainder(11I-1,14),1)),1
End
sub(Ans,1+X,length(Ans)-X
\$\endgroup\$
0
\$\begingroup\$

PHP, 44 bytes, Cracked

fairly easy to crack; but I like it.

for($i=~1;$c=H_aNyesetdalcek[$i+=2];)echo$c;

Run with -nr or try it online.

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

Aceto, 154 bytes (Safe)

              27\'dNU   QJi9MLJ€{{x(}]J{'!o∑€xiDQxsJ(]sicpicp1.2sJJicp90I.2+D/edxi-'>xd80J0IJicx'NIx5sJsJidcpIcpL7sssJicpei7+ UUdJicpLI7sJicpx'p\p9*coJcU'p+\p   

Try it online!

'N'ed'd80J0IJic'eUpppppp Try it online!

Explanation:
<space>*2 - Two spaces for the hilbert curve to work right
'N pushes 'N' onto the stack
'e pushes 'e'
d duplicates it
'd pushes d
80 pushes 8, 0
J concats top two values
0I pushes 0, pops, increments, pushes back on, net effect: pushes 1
J concats to '108'
i converts to integer
c pops and pushes ascii equiv on stack
'e pushes 'e' (again)
U reverses the stack
and the p's print out the stack
\$\endgroup\$
0
\$\begingroup\$

Vyxal, 44 bytes

17SǏ⌊0»¹∇ḃF2»*»∷J∇Y.ḊṖ¼ḭ¦]uy»S4ẇṫ½Y⌊$oḢJCṅĖǐ

Try it Online!

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

Rattle, 55 bytes

Haystack&Needl|Ip0=2+(1*2)!Ps[bg0*3b^](`+5);$b|1,%(?3b)

Try it Online!

This isn't terribly difficult but it's not trivial either (note that "Needle" is missing the last "e" near the beginning of the code).

Hint: the Needle program will not have a trailing newline, while the Haystack program does.

\$\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.