Mini sfide limitate Discussione di Cop


33

Discussione di ladro

Il tuo compito come poliziotti è selezionare tre cose:

  • Un linguaggio di programmazione

  • Una sequenza OEIS

  • Un set di byte

Devi quindi scrivere segretamente un programma in quella lingua che calcola l'ennesima sequenza di termini usando solo i byte nell'insieme. Rivelerai le tre informazioni in modo che i ladri possano provare a capire il programma.

Le risposte verranno assegnate in base al numero di byte nel set di byte, con un punteggio maggiore che va bene. Le risposte incrinate hanno un punteggio automatico di 0. Se la tua risposta non viene incrinata dopo una settimana, puoi rivelare il programma desiderato e contrassegnare la risposta come "sicura".

Le risposte devono essere in grado di calcolare ogni termine nei file b della sequenza, ma non sono tenuti a calcolare nessun termine successivo.

Le sequenze possono essere 1 o 0 indicizzate sia per poliziotti che per ladri.

Ecco uno script Python che verifica se il codice corrisponde al set di byte specificato.


1
Il punteggio più basso è migliore? O più alto? Quindi, in sostanza, stiamo cercando di trovare un set di caratteri limitato che renda difficile per qualcun altro creare un programma nella lingua scelta, dopo che abbiamo già elaborato una soluzione?
BradC,

1
Dobbiamo usare tutti i byte nel nostro set? Immagino di sì, ma probabilmente dovrebbe essere specificato nella sfida.
Shaggy,

1
@Shaggy generalmente no, puoi includerne altri per le aringhe rosse, ma i ladri possono usare tutto
Stephen

1
I ladri possono usare lo stesso byte due o più volte?
Mr. Xcoder,

2
@Azulflame I b-file sono file associati a ciascuna sequenza a cui è possibile accedere sostituendo Acon a be aggiungendo a .txt. Ad esempio oeis.org/b4.txt accederà ai file b per quella sequenza.
Wheat Wizard

Risposte:


11

Haskell , A209229 , ( rotto )

11 caratteri (inclusa la nuova riga):

s<=[ ]
how!

Emette Vero / Falso come funzione indicatore per potenze di 2:

1 => True
2 => True
3 => False
4 => True
5 => False
6 => False
7 => False
8 => True
9 => False
...

Gli input sono numeri interi positivi.


0 dà Falso?
H.Piz,

@ H.PWiz Il mio codice non funziona per 0, il tuo crack può fare quello che vuoi.
xnor

Cracked! Molto intelligente ~
Lynn,

@Lynn Ben fatto!
xnor


5

Haskell, A000045 ( rotto )

Ho deciso, penso che mi piaccia di tpiù s.

Quindi usiamo questi 30 byte (inclusa la nuova riga) invece:

abcdeFgh|jklmnopqrtTuvwxyz
=()

Nota che la descrizione della sfida generale lo richiede

Le risposte devono essere in grado di calcolare ogni termine nei file b della sequenza [...].

In questo caso, il file b arriva al 2000 ° numero, che è molto al di là di ciò che può essere calcolato usando Int.





4

Haskell, A000045 ( Cracked )

A tutti piacciono i numeri di Fibonacci, mi piace Haskell ...

Ho selezionato 30 byte per voi: le lettere minuscole, ad eccezione f, ie t, si ottiene le lettere maiuscole Fe Te il simbolo pipe |, invece, e i tre simboli =(), e ritorno a capo. Eccoli di nuovo:

abcdeFgh|jklmnopqrsTuvwxyz
=()



4

Haskell, A009056 ( rotto )

Un altro semplice, ora di nuovo con abbastanza lettere da far sembrare Haskell ordinario e forse per farmi stupire trovando una soluzione completamente diversa dalla mia.

La sequenza è Numbers> = 3 e il set di caratteri è composto da questi 30 byte:

{[abcdefghijklmnopqr uvwxyz]}.

Il crack ha alcune belle tecniche. Stavo solo pensando a questo:

head . flip drop [ floor pi .. ]



3

C (C99), A000005 , 25 byte #, incrinato!

Questi sono i byte per un problema completo, accetta n come argomento della riga di comando e restituisce output a stdout (lo spazio è incluso in bytecount).

<=>,;!"()*%+acdfhimnoprt 

ok mi stavo chiedendo lol. come argomento da riga di comando?
Conor O'Brien,

Sì, lo renderò più chiaro
dj0wns

1
Cracked! è stato divertente: D
Conor O'Brien il

3

Unario , A002275, 1 Byte

Set di byte:

0

Ho dovuto almeno provarlo: 3

(Non penso che sarà particolarmente difficile visto che tutti i comandi nella lingua sono disponibili)


1
Why not include all of the bytes to maximize your score? You have scored the lowest amount possible, when it would make no difference to include all of the bytes.
Wheat Wizard

I thought we were going for a low score (sorry, I'm new here).
sonar235

1

@muddyfish Is input as a character allowed for brainfuck?
sonar235

@sonar235 In general we do allow input as character for brainfuck. Although since values here exceed 255, I don't think an answer that uses them can be valid.
Wheat Wizard



3

Hexagony, A057077, 77 bytes

Periodic sequence 1, 1, -1, -1. As a list:

a(0) = 1
a(1) = 1
a(2) = -1
a(3) = -1
a(4) = 1
a(5) = 1
a(6) = -1
   ...

Character set (edited), which includes a newline and a space character:

!%&(),0123456789;?@ABCDEFGHIJKLMOPQRSTUVWXYZ^abcdefghijklmnopqrstuvwxyz[]#. 

Try it online!


Any reason you modified the character set?
Poke

1
@Poke apparently the higher the byte count the better, so I just added a bunch of non-useful commands.
Adnan

3

Haskell, A000045 (cracked)

It's cracked, and I won't start a new version, but if you want to play more: it's possible without y, and it's possible to be efficient.


I apologize for leading you in wrong directions by giving a g. Let's do the same without!

Here are the 29 remaining bytes (including newline):

abcdeFh|jklmnopqrtTuvwxyz
=()

Again, remember that Int won't be enough to compute the 2000th Fibonacci number which is needed because it is in the b-file.



3

Haskell, A000045 (cracked)

This is kindof (as announced) not a new version, but completely different. (Right?)

I still hope I can make you rediscover my nice little observation.

This time you are asked to implement the Fibonacci sequence using a charset of size 17, which (as far as I know) contains only one two unneeded chars:

eilnt=(,).[ ]_:0!

Note that there is no newline (but feel free to show a version which has them for readability) and remember that you have to be able to compute the 2000th Fibonacci number.



3

Cubix, A000027 (SAFE) 17 points

!&')-/0;@Oiru.NSQ

My solution:

!O!;i)!/u&!!r-)0'u;;!@

watch it online here

I originally did this without .NSQ but I figured I could add them safely.

Explanation:

This sequence is just "The Positive Integers". However, Cubix has three input commands, i, which reads in a single char (pushing -1 if input is empty), A, which reads in the rest of the input as chars (pushing a -1 to the bettom of the stack), and I, which reads the next number off the input (pushing 0 if there isn't a match). So naturally, I only provided i which reads in digits as their ascii value. uh-oh. Additionally, -1 is the usual marker for end of input, in conjunction with ? so I got rid of ?, forcing me to use ! (skip next instruction if TOS is not zero) for control flow. Finally, I thought I needed & to concatenate digits for printing with O (which outputs the top of stack as a number), but I realize now that that wasn't necessary either!

Another part of the challenge was originally to not have . the no-op character, but you can use pairs of ! instead if you're careful:

    ! O
    ! ;
i ) ! / u & ! !
r - ) 0 ' u ; ;
    ! @
    . .

i) : read input, increment.

!/ : if top of stack is zero (end of input), turn left

left: ;O.@ : pop top of stack, output as number, halt.

otherwise:

u'0: push char code of 0 to top of stack

)-r: increment, subtract, and rotate

;; : pop top of stack twice

u& : concatenate digits

!! : net zero effect, now we are at i) again.


Cubix has some noop characters right? Why don't you add those to increase your score? Or is part of the challenge that there are no noops.
Wheat Wizard

@WheatWizard I decided to be merciful and add . but it can be done without it.
Giuseppe

3

Seed, A005408 (Odd Numbers) - Safe

Here's a slightly more challenging one. You may use any characters valid in Seed:

[0-9 ]

You shouldn't be able to brute force this one in a week unless you have a monster of a computer. Good luck! It's crackable.

Hint

This is the Befunge-98 program used in my solution: 9&2*1-.@ (the 9 can be removed, but my solution just happens to have

Solution

8 47142938850356537668025719950342285215695875470457212766920093958965599014291682211474803930206233718243166021324700185443274842742744297183042397910454208210130742260519105651032450664856693714718759816232968955289663444878636053035645231246428917992493766505872029989544065894418166685284738859999912471659057565000392419689361271972485444731284404987238803115210428572945108908191097214978382112218242627719651728712577306652405452922782307249485947045215982784790396555726144526602778473387279897334709142853151393812930171163300904436548870603006549005515709074682843356844201220668045057407146751793470423217099467145255174198241606814578351260769359571053755888106818197239116973006365593563235361647743411341624822052103816968153274122434280200888824954875622811325064255818154979564925710534165572852442761249176778416688044630942040966271963723430245979221181930857841829694362184653939393940015797332978459794253176110314873994228261888801228999293570329618551223457182420746927212801550646743152754821640064626761542582557138452651970009253770914346130172884305622027370793496993281847017017643506435562229916984107083951938286577012273222191422054315198157936674247934699496471202544270325061352014830137178245082445717253260177560449757186762445707057028987371278573629077370632470496186218574320801798046510846708620502139560277546345198686675095078255875594169064796673074708822106659920187882062247609587560174781170641367430722951002242213604709887062481149928551745163110045572994991844223216663621203042075294195007458339984527333125093390189721042315604498435269143549420166732177200370228527273606218617171975362431824163269672003982537382982066136613799403024924018145511099557720492305303748099327810811511080314262364010281851651151072957475365629128068033597559560186625877942054704386175359499573139930378099420149452745731809033737756051947913924265484582800618244473333957173960222243311738522875022546610298627492222587971756897328087719407454153248557203886421828643453889090192355970705084245312184441674098515659253482621260617211786550204852895652236768886852209506535523414991099331857674826373947830587028494510697603296607361093480842935154672353288419699354739650168309017848485131553416956405911683526896232046773861961911767319373432460217755874481607587604361758089936007730253450733375831228127106295259261723611771334468553746160739548375950046831923765023329346333968732796413192682936767133122325481273354810124729664400173367781325488656859581438769940474229394692089519981810909719628263357284973442177568041416363386891516725592952892168077523560584005586276794967492051823290615767599202657060820223928678900774601616908031321346819422162123048834532926372862962159255934240435694566497798544870186550219886342379298214007368081326725550763589917206162393892085506551547475259270513853987294911388226039365971184089828739349642347312302559286882065147953715607221387657413593069535573044067517274676745306396611760657091792151803798859781616126637075577936361782593546481811651450365118155866449850474140044293772144065341051900055416408240857348697564252386403719942197789892382627153382011984996644288495699209129097948405810551134169739499539470610790009272281731894550593600643079188663110695127017324336488487580799309995227054576681630676222848231145106058050452439356753552872060820230589152143268436210090733908507724084889788244157692417246691477400856716677564609725979550100138132944851304473466485128295568194188600539248624248078558656162635444219199062786468487219220160009464328883337821175254405764395407405891483810757405446047244460754827113527540703326714751461178900155717130399854358953609995319006890674085682111514072508440632941090209366005504352890092326935445829213294943731517698438648298921337375443947066950275955144209037675013663600062205168551851984361951824731229113379464426979717688372371011461890139087487634586087688796134318950140718824105959727161482389914414206768064990410615468858520426399188835467970981786227122743162945627167772066100574532803061925537235491026486409948728571706557098859331941260622260924660292578136091523126589085799981416326395824628987154802653126685882440760385315869346960183809644486238810912663304360284449610976505715001267334297285036791711464142665122000857666018757370925847113798258537503747803972255591351740843663253694303946089997282812556281486820325652814785261116697261899511762129550421005941055852897451832731304151488058522478260009347144486599715629242208891126238083949281490804191584238425634093683587199278186505945727829025071885767559828670803412582690901456978557379916793144695491189633486065077294485660840922713748873840986104486221528464294334436081663106336911265802650605150347413103936140565054608396116572669757269475369570465915381045895991937087068526458273755454602799814909213983801968791431574508976448235055061998715636460946550584682626461010298101802277643570201189324102499951196290880892383380284543173390448406975616650185808619832614403133944687275834716343817926764699295672501869876060896683204343897481630037607159476461359111190545646447421653872016775582115425356868533678655969328210255235050133718364831289991244684695035034122861927276046255405376531096051541299607470934463981741370397268760811035606321455156217990078359217247117349544774085111287345436916077577032709684005131011429476229617901273007027774182864475737502587896225475248267937497254066190335088823904767397814233350286976811901982274477445433872253983823904938249655089770642137858608313524715533520654523880832056453080193644871440738737277389718589793074725139142291918837706550037934799585495183374639955887618135803388399608755212147742199481865453122900714456703147150994585431640652462593333773031385396586933380738103697887063571042512186708015948688088011290197524699274772775288900864690592106393483764109837848793374117655194139018455509931621247697015323332300969105814058088442693320033876473960017819576425062784644138417943454576404265382986995583045527928832

How did you generate this?
Christopher

@2EZ4RTZ Painfully, and with Python's source as a reference. It can probably be golfed a lot though.
TehPers



2

cQuents, A000027, Cracked


 !"#%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

That's right! You get all of ASCII! Wait... there's no $... what's $ again in cQuents? Oh, yeah, the index builtin. Well, tough luck :/

Intended Solution:

#|A:A

Try it online!



@Adnan yup that works, I guess I shouldn't have opened it up as much as I did :P I couldn't think of any different ways to do it, good job. Added intended solution.
Stephen




2

R, A000290, (cracked)

Byte set:

()%cfinotu

no c, but everything else for function? That's horrifying. I know how to do this except for reading in input...
Giuseppe

@Giuseppe woops, the a shouldve been a c. sorry.
JAD

1
This is what I get for doing this shit manually...
JAD

No worries; this is tough enough!
Giuseppe



2

cQuents, A000217, Cracked

Byteset:

$:=1;
\-

Note that this uses a feature that I haven't pushed the documentation for yet, so I'll push that tonight, if you wait until then. (Or you can slop through my source code... have fun). Documentation pushed. Would be a byte less if a recent bugfix was on TIO.

Intended solution:

=1-1:--\1$ ;$

Try It Online!



2

JavaScript (ES6), 13 10 bytes, A000045, Cracked

This should be easy.

This is the Fibonacci sequence: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

Byte set:

$()-:<=>?[]_~

Edit:

It can be even done with the following 10 bytes:

$()-:=>?_~


1
This isn't [code-golf]: "Answers will be scored by the number of bytes in the byte set with score being good." More bytes are better.
LarsW

@LarsW on the other hand, more bytes also makes it easier to crack :)
JAD




2

R, A105311, (cracked)

'%(),:=acdeginpstx

Let's try this without the l or o.

Since this has been cracked, the intended solution:

cat(diag(diag((a=scan()))%x%diag((a==a):a)),sep=''). diag is an interesting function, that can be used in three different ways. When presented with a single integer (diag(n)), it creates a NxN matrix with 1 on the diagonal. When presented with a vector (diag(1:n)), it creates an NxN matrix with the vector on the diagonal. When presented with a matrix (diag(diag(n))), it returns the diagonal as a vector. %x% computed the Kronecker product of two matrices, where each element in matrix 1 is multiplied with each element in matrix 2 separately. Doing this with a length n identity matrix and a 1:n diagonal matrix, creates a length n^2 diagonal matrix with 1:n repeated n times. diag extracts that again, and cat prints.


1
this'll be even more fun :)
Giuseppe

does this include a newline?
Giuseppe

@Giuseppe No newlines
JAD

1
@Giuseppe and I just double double checked, this byteset is correct
JAD

[cracked! ](codegolf.stackexchange.com/a/136457/67312) -- I (incorrectly) used %o% before I realized that %x% existed. I guess I could have done 'i'=='i' for 1 but either way works, so.
Giuseppe
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.