22
\$\begingroup\$

This is the cops' thread of a challenge. The robbers' thread can be found here

In this challenge as a cop you will choose two programming languages A and B, as well as a non-empty string S. You are then going to write 4 programs:

  1. A program which outputs exactly S when run in both A and B.
  2. A program which outputs S in A but not in B.
  3. A program which outputs S in B but not in A.
  4. A program which doesn't output S in either A or B.

You will then reveal all 4 programs (including which number each program is) and S, but keep the languages hidden.

Robbers will try to figure out a pair of languages such that they print the correct results for the 4 programs, and cops will try to make posts that are hard to figure out while remaining as short as possible.

Warning: There is a slight difference in the rules from "normal"

Cops' posts here can have 4 different states:

  1. Vulnerable
  2. Cracked
  3. Safe
  4. Revealed

All cops' posts start as vulnerable. If a robber finds and posts a solution to a vulnerable post they will receive 1 point and the post will become cracked. If a post lasts 10 days in vulnerable without being solved it automatically becomes safe. A cop with a safe post may choose to reveal A and B and their safe post will become revealed. A robber can still solve a safe post, if they do they receive a point and the post becomes revealed.

Only revealed posts are eligible for scoring. Robbers are only permitted to solve vulnerable and safe posts.

Scoring

Cops will be scored on the sum size of all four programs as measured in bytes, with the goal being to have an answer with as low a score as possible. Answers that are not revealed effectively have infinite score by this measure until they become revealed.

Languages and Output

In the interest of fairness, we are going to require that languages are free and reasonably cross platform. Both languages you choose must be freely available on Linux and FreeBSD (the two largest foss operating systems). This includes languages which are free and open source.

Your selected languages must predate this challenge.

Since this challenge requires that A and B produce different outputs for the same program, there is no requirement for what "counts" as a different language, the fact that they produce different outputs is enough.

Programs do not have to compile, run without error or "work" in the cases where they do not need to output S. As long as S is not the output it is valid.

Programs here should be complete programs not functions, expressions or snippets.

Running a program is assumed to be done with no input. All four programs must be deterministic, within an environment. It is fine for example if as a part of an error the program outputs the name of the file or your host name, this is not considered non-determinism since it is determined by the environment running the program. However if it is included in the output please indicate what the file is named etc.

\$\endgroup\$
5
  • \$\begingroup\$ Are online interpreters allowed? \$\endgroup\$ Commented Aug 30, 2022 at 15:09
  • \$\begingroup\$ @thejonymyster They seem to satisfy the rules given so yes. Unless they only run on some weird proprietary browser or require a subscription. \$\endgroup\$
    – Wheat Wizard
    Commented Aug 30, 2022 at 15:26
  • \$\begingroup\$ How about flags? \$\endgroup\$ Commented Aug 31, 2022 at 1:40
  • \$\begingroup\$ Since it's extremely easy to write a program not working in both, why count its length as part of the score? \$\endgroup\$
    – emanresu A
    Commented Aug 31, 2022 at 5:48
  • 4
    \$\begingroup\$ @emanresuA Not OP, but my thinking is that it can help prevent unintended answers if you create that program well. \$\endgroup\$
    – Aiden Chow
    Commented Aug 31, 2022 at 8:22

15 Answers 15

8
\$\begingroup\$

A = HQ9+, B = Python 3, 291 bytes, Cracked

S is Hello, world!

  1. Both A and B work
#console.log("Hello, world!")/*
print("hello, world!".capitalize())
#*/
  1. A only
console.log("Hello, world!")/*
print("hello, world!")
*/
  1. B only
#console.log("Hello, world!")/*
print("Hello, world!")
#*/
  1. Neither work
console.log(String.fromCharCode(49-1)+"ello, world!")/*
print(String.fromCharCode(49-1)+"ello, world!")
*/

GG

\$\endgroup\$
4
  • 2
    \$\begingroup\$ So the only difference between 1 and 3 is the .capitalize() method? (and the string case) \$\endgroup\$
    – Baby_Boy
    Commented Aug 30, 2022 at 18:31
  • 2
    \$\begingroup\$ @Baby_Boy yep, that's all. no hidden control characters or shenanigans :P \$\endgroup\$ Commented Aug 30, 2022 at 18:39
  • 2
    \$\begingroup\$ Cracked (was this the intended solution???) \$\endgroup\$
    – Aiden Chow
    Commented Aug 31, 2022 at 1:06
  • \$\begingroup\$ @AidenChow yes LOL im surprised it wasnt cracked sooner GG \$\endgroup\$ Commented Aug 31, 2022 at 1:37
6
\$\begingroup\$

[A] and [B], 64 Bytes, Cracked by @Steffan

S = "Cop"

Both A and B works

main=print"Cop"

Works only A

main=print
 "Cop"

Works only B

main=
print"Cop"

None works

main=print
"Cop"
\$\endgroup\$
1
  • \$\begingroup\$ cracked \$\endgroup\$
    – naffetS
    Commented Aug 30, 2022 at 22:30
5
\$\begingroup\$

05AB1E and yup, 8 bytes, Cracked by @FryAmTheEggman

\$S\$: 0

1. Works in \$A\$=05AB1E and \$B\$=yup:

0#?

2. Works in just \$A\$=05AB1E:

0?

3. Works in just \$B\$=yup:

0#

4. Works in neither \$A\$=05AB1E nor \$B\$=yup:

0

Explanation now that it's cracked:

0#?    # 05AB1E: Push 0; pop and split on spaces (no-op that just pops); print
       # without newline, which implicitly uses the last value that was on the now
       # empty stack, which is the 0
       # yup: Push 0; pop and print it without newline; no-op character '?'

0?     # 05AB1E: Push 0; pop and print it without newline
       # yup: Push 0; no-op character '?', so don't print anything

0#     # 05AB1E: Push 0; no-op pop; implicitly output 0 with trailing newline
       # yup: Push 0; pop and print it without newline

0      # 05AB1E: Push 0; implicitly output 0 with trailing newline
       # yup: Push 0; don't print anything
\$\endgroup\$
9
  • 1
    \$\begingroup\$ My guess is it's a stack-based lang where # and ? are print instructions. That's a huge pain to search through though\ \$\endgroup\$
    – emanresu A
    Commented Aug 31, 2022 at 9:43
  • \$\begingroup\$ @emanresuA Yup, you're indeed correct, both are stack-based languages and #/? are indeed printing instructions respectively. As a hint to narrow it down somewhat perhaps: one of the languages I use pretty often, and the other I've never used before. \$\endgroup\$ Commented Aug 31, 2022 at 9:55
  • 2
    \$\begingroup\$ @AidenChow :) Yup, that's why I choose this on purpose. The intended results of programs 1, 2, and 3 are all outputting 0 without trailing newline. \$\endgroup\$ Commented Aug 31, 2022 at 16:21
  • 1
    \$\begingroup\$ Cracked. \$\endgroup\$ Commented Sep 4, 2022 at 16:10
  • 2
    \$\begingroup\$ @FryAmTheEggman Nice, that was indeed the intended answer. :D (And as you may have noticed - or maybe haven't, I sneakily mentioned the language name it in two of my comments above, haha. ;p Not that anyone would have picked up on that.) \$\endgroup\$ Commented Sep 4, 2022 at 16:21
4
\$\begingroup\$

Hexagony and Labyrinth, 44 bytes, Cracked by Aiden Chow

S = 1234

  1. Works in both A and B
"123_1234!@
  1. Works in A, but not in B
123+1
234!@
  1. Works in B, but not A
1234@
;!;!;
  1. Does not work in A or B
;!;!;
1234@
\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Aiden Chow
    Commented Aug 31, 2022 at 2:48
4
\$\begingroup\$

??? and ???, 69 bytes, vulnerable

S = A

  1. Both A and B work:
:-%~! v
put(97)
.% >`a
  1. Works in A, but not B:
:-%~v!
put(a)
.% >97
  1. Works in B, but not A:
:-%~!<
put a.
.%^97C
  1. Works in neither A or B:
put(97)
\$\endgroup\$
4
\$\begingroup\$

Glypho and Somme, 747 bytes, revealed

Explanation

For this approach, I thought it would make sense to choose two languages which cared very little about the actual content of their source codes, and instead cared about some properties the code has.

Glypho is a language who cares about the distinct permutations formed by chunks of 4 bytes. It has 15 commands, and is a stack-based language. For example, the string UU{u corresponds to the push command, since it is equivalent to aabc (in terms of uniqueness).

Somme is a language which is usually a fairly innocuous stack-based language, but once multiple lines are involved, the columns are summed and converted into a corresponding command. (Addition is performed by treating space, 32, as 0, ! as 1, etc., then taking the result mod 95.)

Hence, the programs consist almost entirely of red herrings.

Recall that

S = owo!owo!owo!owo!owo!owo!owo!owo!

a string chosen because I thought it was funny.

Both Glypho and Somme work:

UU{uOOwo!??!oOoOowwoSRSR<ww<W!WOOOw0oWoW>ww>!
!
owwo!0!0
!!
QwQwOwOw!?!?.,.,owwo@?@?<ww<W!W!OwOwoWWo>ww>!

!owwo!!0w
!W
QwwQOwOw!???oOoOoow
@?@?<ww<W!W!OwwOoWoW>ww>!

!owww!000

!WQwqQOwwO!?!?ooO!owow@??@<w><W!!WOww0ooW!>w>w!

!owOo!00!
SSSQQwqOwoO!??!oO!O>!>?
#A` C=Z6fyC[U`SSmT5@)m`>3] =^OE^;"owO!"*4/qK_(_

This corresponds to the Glypho (shorthand) program ([eeeeeeeeeee] is a loop that never runs):

11+d+d+[1d+d+d+dddd+d+dd++++1-+dod1d+d+d++oo1-+d1d+-+*1d+-+o1-+][eeeeeeeeeee]
11+                                                                 stack: 2
   d+d+                                                             stack: 8 (loop counter)
       [                                                    1-+]    loop 8 times
        1d+d+d+                                                     stack: LC, 8
               dddd                                                 stack: LC, 8, 8, 8, 8, 8
                   +d+dd++++                                        stack: LC, 8, 112
                            1-+                                     stack: LC, 8, 111
                               do                                   output and keep 'o'
                                 d1d+d+d++                          stack: LC, 8, 111, 119
                                          oo                        output 'wo'
                                            1-+                     stack: LC, 7
                                               d1d+-+*              stack: LC, 35
                                                      1d+-+         stack: LC, 33
                                                           o        output '!'
                                                            1-+     stack: LC-1

In Somme, this corresponds to the following program after the columns are summed:

F1+7*1-::8+\3B*m,m,m,m,m,m,m,m,0;!fw'@9AH     `
F                                                   stack: 15
 1+                                                 stack: 16
   7*1-                                             stack: 111
       ::                                           stack: 111, 111, 111
         8+\                                        stack: 111, 119, 111
            3B*                                     stack: 111, 119, 111, 33
               m,                                   map output (,) over stack
                 m,m,m,m,m,m,m,                     ...eight times in total
                               0;                   exit with exit code 0
                                 !fw'@9AH     `     (never executed)

Only Glypho works:

[[4]?!?!?00?OwOw
o
oo  owoo
0 0o]]4[00wO<!!<w#w#?##?owow[44[?!?!?0?0OwwO

oooo 0wo
w0  0]44[00wO<!?<w##w?#?#owow[8[8?!!!??0wOwOw
oo
o o woow0 0 ]44]0ww0<!!!w###??#wowow[ww[?!?!?00wOwOw
##>o o woow00 o]44]0www<!??ww#""#w"owwo"4*4/q]]]]]]

This corresponds to the following Glypho (shorthand) program:

1d+dd+*[11+d+d+dd+\1-+*1-+dddo1d+d+d++oo1d+d*d*d+1+o!1-+]!n
1d+dd+*                                                       stack: 8
       [                                             1-+]     loop 8 times
        11+d+d+dd+                                            stack: LC, 8, 16
                  \1-+*1-+dd                                  stack: LC, 8, 111, 111, 111
                            do                                output and keep 'o'
                              1d+d+d++                        stack: LC, 8, 111, 111, 119
                                      oo                      output 'wo'
                                        1d+d*d*d+1+           stack: LC, 8, 111, 33
                                                   o          output '!'
                                                    !         discard 111
                                                     1-+      stack: LC-1
                                                         !n   discard; no-op

And also to the (gibberish) Somme program:

u>B-t$?@+@@v)IUnX'PFK;~{k**bj2Q1J02is?F}zRC/)mmU-U-w

This errors out immediately because u is not a command that exists.

Only Somme works:

if print("owO") then: #V
  print("Owo")
end
#e0;*~E>dbqAMz}+Gra=y:Pie
between each output call, do:
  print("!")     n[\@6l{: 0
end
repeat twice
X[*g20@"kW({4L-rSk$w.4})~*;Ke

This corresponds to the following Somme program:

F1+7*1-::8+\3B*r`,{`FF+2+*0;
F1+7*1-::8+\3B*                 same as previous
               r                reverse stack
                `,{`            push this string
                    FF+2+       push 32
                         *      execute that string 32 times
                                (once for each character)
                          0;    exit with exit code 0

And to the (gibberish) Glypho (shorthand) program:

eeeeee*eeeeeeeeee-!ee-e1e1e[neeee]]eeeeeeee

This errors out immediately due to e (execute) having no parameters.

Neither [A] nor [B] work:

Didn't need to spend too much time here, since the answer was probably fine without it.

print("owo!"*8)
#&7("owo!"-1)

Thanks for reading!

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

Python and PARI/GP, 48 bytes, Cracked by @Steffan

An easy one.

S is Cop

  1. Both A and B work
print("Cop")
  1. A only
print('Cop')
  1. B only
print('Cop)'
  1. Neither work
print("Cop)"
\$\endgroup\$
1
  • 1
    \$\begingroup\$ cracked \$\endgroup\$
    – naffetS
    Commented Aug 31, 2022 at 1:33
3
\$\begingroup\$

??? and ???, 54 bytes

String: 8356830650

Works in A and B (hex):

00000000: 300b 3366 b87e 0b00 247e e239 2a83 2a3b  0.3f.~..$~.9*.*;
00000010: 0fd6 30                                  ..0

Works in A (hex):

00000000: a4ac b3bb 762b 3a74 d6                   ....v+:t.

Works in B (hex):

00000000: 300b 01f9 3033 1f0b 3131 5ee2 8891 5ebb  0...03..11^...^.
00000010: 2d88 7661 8976 0bce 0000 0b2b            -.va.v.....+

Works in neither:

We're no strangers to love
You know the rules and so do I (do I)
A full commitment's what I'm thinking of
You wouldn't get this from any other guy

I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

We've known each other for so long
Your heart's been aching, but you're too shy to say it (say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it

And if you ask me how I'm feeling
Don't tell me you're too blind to see

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

(Ooh, give you up)
(Ooh, give you up)
(Ooh) Never gonna give, never gonna give (give you up)
(Ooh) Never gonna give, never gonna give (give you up)

We've known each other for so long
Your heart's been aching, but you're too shy to say it (to say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it

I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Or the empty program.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ Man, getting rickrolled in the places I least expect it. \$\endgroup\$
    – Aiden Chow
    Commented Aug 31, 2022 at 5:21
  • 2
    \$\begingroup\$ Why is it 54 bytes? It is 1961 bytes. \$\endgroup\$ Commented Aug 31, 2022 at 8:32
  • 1
    \$\begingroup\$ @NumberBasher "Or the empty program" \$\endgroup\$
    – emanresu A
    Commented Aug 31, 2022 at 9:30
  • \$\begingroup\$ that was a joke. \$\endgroup\$ Commented Sep 1, 2022 at 10:15
3
\$\begingroup\$

[A] and [B], 46 bytes, Cracked by @mousetail

S is 0

  1. Both A and B, 14 bytes
print('0')
out
  1. A but not B, 15 bytes
print('0')
out#
  1. B but not A, 17 bytes
print('0',)
out #
  1. Neither B nor A, 0 bytes

Yeah, I'm not wasting any bytes here :-)

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

??? and ???, 300 bytes

S = A\n (as in, A with a trailing newline)

  1. Works in A and B
puts A

n = A[ exit ]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
  1. Works in A but not B
puts 'A'

n = A[ exit ]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
  1. Works in B but not A.
puts A

n = A[exit]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
  1. Works in neither A nor B
n = A[ exit ]

puts A
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
\$\endgroup\$
3
\$\begingroup\$

[A] and [B], ACTUALLY 3 BYTES!!!, Cracked

S is 0

  • Both, 0 bytes:
  • Only A, 1 byte:
!
  • Only B, 1 byte:
r
  • Neither, 1 byte:
"
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Editted. Never gonna give you... \$\endgroup\$ Commented Aug 31, 2022 at 8:45
  • 1
    \$\begingroup\$ Vyxal and Jelly \$\endgroup\$
    – emanresu A
    Commented Aug 31, 2022 at 9:35
  • \$\begingroup\$ ... actually link to the crack? \$\endgroup\$
    – emanresu A
    Commented Sep 1, 2022 at 10:25
3
\$\begingroup\$

Lightlang and PDAsephone, 141 bytes, revealed

Explanation

My thought process for this approach was to choose two obscure esolangs with interpreters not on TIO. Since there are no interpreters online available, I recommend you download lightlang.py and PDASephone.java.

My strategy with this one was further devious. If you were hurriedly scanning through esolangs, and found this language, the program will not complete immediately. The _ command in Lightlang sleeps for one second, meaning the program takes about 13 seconds to complete.

Lightlang is a curious language which only has 1 bit of memory, whose implementation clocks in at 35 sloc. My solutions use the "interesting" parts of the language, bouncing, jumping, and conditional skipping, to produce varied output. The program otherwise is just a garden path through toggling a bit on and off and printing it occasionally.

PDAsephone is a language with a PDA (push-down automaton) datatype. Unfortunately, I didn't want to spend bytes (or mental energy) getting a non-trivial PDA functional in the language, especially when the other language is so simple that it would be hard to replicate any meaningfully complex behavior implemented in PDAsephone. Hence, I use it just for its stack-based capabilities, and most of the work done is to make it play nice with Lightlang.

S = 0110100

Both Lightlang and PDAsephone work:

__@;"1_&^"0^!^!.$$:.__/!^#&!^&$$:."0:v..^:..___

Only Lightlang works:

[*)`!$]^|>,=+!+/#(]+|!!-+)$'%)}|^!]>*].==`^{;"|

Only PDAsephone works:

'**"0-'})'"1=/:+?.`/:~'{++:.>.'+*/(:./:-./::'..

Neither Lightlang nor PDAsephone work: (the empty program)

Thanks for reading!

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

??? and ???, 43 bytes, safe

output: 2147483647

both -print /*"\r"%S #*/|2**31-1
only A -print %S
only B 2**31-1
neither

hint:
none of the languages are esoteric or recreational, both are practical and one of them is even quite popular, the other one is free open source but not available on any service like TIO, it's a script for a domain-specific tool

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

??? and ???, 406 bytes, cracked by Conor O'Brian

S=2

Both A and B:

# print("22222222222") //
!\print("22222222222")# 2
\\     ("11111111111")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;

A but not B:

# print("11111111110") //
!\print("11111111110")# 2
\\     ("11111111110")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;

B but not A:

print("22222222222") //
!\print("22222222222")# 2
\\     ("11111111111")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;

Neither A nor B:

# print("11111111111") //
!\print("11111111111")# 1
\\\    ("11111111111")>>n
;;;;;;;;;;;;;;;;;;;;;;;;;
\$\endgroup\$
8
  • \$\begingroup\$ Cracked. \$\endgroup\$ Commented Aug 31, 2022 at 21:33
  • 2
    \$\begingroup\$ It doesn't seem as though Conor O'Brien actually cracked this post, because Adapt prints the 2 with a trailing newline, which doesn't match your S. \$\endgroup\$
    – Aiden Chow
    Commented Sep 1, 2022 at 23:56
  • \$\begingroup\$ @AidenChow I'll get back to it then. Deleting until I figure it out truly. \$\endgroup\$ Commented Sep 2, 2022 at 0:37
  • \$\begingroup\$ @ConorO'Brien Seems the TIO version of the B implementation also outputs a trailing newline. So I think your answer is valid and you can ignore any trailing white-space. \$\endgroup\$ Commented Sep 2, 2022 at 6:44
  • 1
    \$\begingroup\$ In that case, I suspect the intended solution for B is BitCycle -u. \$\endgroup\$
    – Aiden Chow
    Commented Sep 3, 2022 at 1:52
1
\$\begingroup\$

Pyth and V, 11 bytes, Cracked by @Steffan

S = 3

Both:

l"aa3

Only A:

3

Only B:

dl3P1é3

None: (empty)

\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – naffetS
    Commented Aug 31, 2022 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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