11
\$\begingroup\$

Background

The game Grand Theft Auto: San Andreas went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried them all!
One cheat is activated (on PC) typing in-game a secret keyword, and then boom, a jet pops out of thin air or perhaps all pedestrians look like Elvis Presley or some other rowdy effect...

They always come with this confirmation message:

enter image description here

Rockstar chose to store them hashed, so due to collisions, in addition to the intended ones there are many other strings that trigger each cheat.

Therefore I propose to solve this downside!

Task

Write a full program that prints CHEAT ACTIVATED if and only if the last part of a string is a cheat code.

Cheat codes

THUGSARMOURY
PROFESSIONALSKIT
NUTTERSTOYS
INEEDSOMEHELP
TURNUPTHEHEAT
TURNDOWNTHEHEAT
PLEASANTLYWARM
TOODAMNHOT
DULLDULLDAY
STAYINANDWATCHTV
CANTSEEWHEREIMGOING
TIMEJUSTFLIESBY
SPEEDITUP
SLOWITDOWN
ROUGHNEIGHBOURHOOD
STOPPICKINGONME
SURROUNDEDBYNUTTERS
TIMETOKICKASS
OLDSPEEDDEMON
DOUGHNUTHANDICAP
NOTFORPUBLICROADS
JUSTTRYANDSTOPME
WHERESTHEFUNERAL
CELEBRITYSTATUS
TRUEGRIME
ALLCARSGOBOOM
WHEELSONLYPLEASE
STICKLIKEGLUE
GOODBYECRUELWORLD
DONTTRYANDSTOPME
ALLDRIVERSARECRIMINALS
PINKISTHENEWCOOL
SOLONGASITSBLACK
FLYINGFISH
WHOATEALLTHEPIES
BUFFMEUP
LEANANDMEAN
BLUESUEDESHOES
ATTACKOFTHEVILLAGEPEOPLE
LIFESABEACH
ONLYHOMIESALLOWED
BETTERSTAYINDOORS
NINJATOWN
LOVECONQUERSALL
EVERYONEISPOOR
EVERYONEISRICH
CHITTYCHITTYBANGBANG
CJPHONEHOME
JUMPJET
IWANTTOHOVER
TOUCHMYCARYOUDIE
SPEEDFREAK
BUBBLECARS
NIGHTPROWLER
DONTBRINGONTHENIGHT
SCOTTISHSUMMER
SANDINMYEARS
KANGAROO
NOONECANHURTME
MANFROMATLANTIS
LETSGOBASEJUMPING
ROCKETMAN
IDOASIPLEASE
BRINGITON
STINGLIKEABEE
IAMNEVERHUNGRY
STATEOFEMERGENCY
CRAZYTOWN
TAKEACHILLPILL
FULLCLIP
IWANNADRIVEBY
GHOSTTOWN
HICKSVILLE
WANNABEINMYGANG
NOONECANSTOPUS
ROCKETMAYHEM
WORSHIPME
HELLOLADIES
ICANGOALLNIGHT
PROFESSIONALKILLER
NATURALTALENT
OHDUDE
FOURWHEELFUN
HITTHEROADJACK
ITSALLBULL
FLYINGTOSTUNT
MONSTERMASH

Input

  • A string \$s\$ over the alphabet:
    [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z]

Output

  • Print CHEAT ACTIVATED if there exists a cheat code \$c\$ such that \$c\$ is a suffix of \$s\$
  • Nothing otherwise

This is , so the shortest code wins.

\$\endgroup\$
5
  • 5
    \$\begingroup\$ Was there a reason you chose to override the default decision problem output choices? It doesn't appear to add much beyond being cute. The rules also seem to require that the input be all capital, and not allowed to be lower case - this is abnormal and you should probably draw more attention to it if you decide to keep it. \$\endgroup\$ May 26, 2020 at 20:01
  • 1
    \$\begingroup\$ @FryAmTheEggman Yes you've nailed it, I just like the idea of recreating the original reply of the game. I'm aware it adds almost nothing, nevertheless it's suitable to some clever "recycling" of the part of the program that checks the input. For the second part I originally thought to allow all characters and make it case insensitive, then I saw that limit the input could only make the things easier and foster optimization. (I left out one cheat 18HOLES because was the only one with digits) Beside being abnormal, show me what problem could it lead and I'm willing to change it \$\endgroup\$
    – Domenico
    May 26, 2020 at 20:30
  • 1
    \$\begingroup\$ @FryAmTheEggman Don't get me wrong, I've not justified a whim saying that it can be interesting to see how to handle that output. I really consider it can represent something different. Of course outside Code Golf this would only be a juxtaposition of a decision problem and the production of a specific string. And I totally agree that a good challenge is a dry one, one where everything is essential. But this doesn't want to be a default decision problem. And that output it's fundamental in it. \$\endgroup\$
    – Domenico
    May 26, 2020 at 21:24
  • 3
    \$\begingroup\$ That is fine, I'd just like to say that I think it is unlikely your choices will improve the solutions that you receive. Generally, giving the golfer more freedom to choose I/O increases the quality of the responses you get, in addition to improving the chances you get of getting responses at all. \$\endgroup\$ May 26, 2020 at 22:05
  • \$\begingroup\$ @FryAmTheEggman Ok thanks, I'll try to leave as it is, if it didn't get many responses I'll know why ahahah - Never mind, it's an experiment :) \$\endgroup\$
    – Domenico
    May 26, 2020 at 22:22

10 Answers 10

8
\$\begingroup\$

Python 3,  976  965 bytes

Saved 11 bytes thanks to @user202729

Nothing fancy here. This is a hand-crafted regular expression which was randomly shuffled to please zlib and save a few more bytes.

import zlib,base64,re
if re.search(zlib.decompress(base64.a85decode('''GaqK,9,=TU&D^"aoJ0#fKbc'=7=3*ZC@Sjrb9-nO,G4ij>guO6,*oNLi[tq[ZsOTo,XZG;oZsh/gQt)R:U?gtgs2QpS5&Cl,CM,c4B%`<W5ZEuN=Sb$f!,mP`%@TQ:&Dg(:q8*+N)Y?Q#F9kM'KZ&%\I2W`#7oOUp1-0Ge3]q_o8g@lWflG`*QMr*9[[`i?a`=U:auDF%8=66MDaNUUiPI8J#lO0\l@*E:%PS)VCHdD>/N`=l1`t*hVA<^ON+dhUtN/]3U\\tupZtkD$:DPFh-HW3PZ$AAiEFm(g;<YJ6I4"uMdQX16JBN/W.`>QFrON6O,^B%Jl3Mn<d^IObA<=$[b;g`-:O$Ga?$ch!SrhQNm;`Led6I;8/VCeIra;1&X%b)&*]\XB4+g3`FkTT#fc%HR8*)g95de$99CT;oVaps<Yn\im/BJu&A6-O8L3#Ha0p6]PKP2a7,,T6[K>'rQiC1R,U1_Ko/:-EAfrcS7ik6HfK>2:cMot]rkBY#!9d"ujd=<dn@]JT9h=mClIt.YL?*b"(ImA*!E/(\Gob*ghDs1dJ.;O"]CPGTo!=5g=9e2+caXT43.mu:*o8`ai!KoaLJ5',M&K[V8d'?J=ISEG?GUZMbWXJ[iCde,Mu[(,9nY8%-73jGpPZFWBXSOTGg5:U<P2"/=V(g[PZJodG+cZuag^64TE.>i4i"BRD8=mu,Jga5Ip(0Z34oicZ"d'bi@2Bqe/D6Y*)Cc-#tb7!E4Q']mZ0F2M]&qrpj]qLqg0MLln_4Q7QA[9<@I^3OJAJ)p1?+NpZH)nYYp(.J''*9mJUg?9h.]o72ZKgN)90W>0sIe(IqbdBCsfj<Ma5N''')).decode(),input()):print('CHEAT ACTIVATED')

Try it online!

Or See the uncompressed regex

\$\endgroup\$
15
  • \$\begingroup\$ (I assume that you are more familiar with JavaScript, in that case (JavaScript doesn't have builtin for compression?) you can simply specify some language such as "JavaScript+<zlib library>". For demonstration purposes it isn't very hard to copy-paste the library source code into the header part.) \$\endgroup\$
    – DELETE_ME
    May 27, 2020 at 6:22
  • 2
    \$\begingroup\$ @DomenicoModica The whole point of a decision problem challenge is to output either true or false, no matter the nature of the task. Given the background story of this question, asking to output 'CHEAT ACTIVATED' instead (or nothing at all) makes some sense, so I don't really have a problem with that. But generally speaking, overriding the default rules (such as this one and these ones) is a bad idea. It's quite likely to decrease the number of answers to your question. \$\endgroup\$
    – Arnauld
    May 28, 2020 at 0:26
  • 1
    \$\begingroup\$ @DomenicoModica I'm not sure to understand your point about the compression. It all depends on the language used anyway. That's why you should not make any assumption like that and just let the people decide. \$\endgroup\$
    – Arnauld
    May 28, 2020 at 9:03
  • 2
    \$\begingroup\$ @DomenicoModica If static data or other helper functions are defined outside the main function, it must definitely be counted in the total byte score. Doing otherwise would be blatant cheating. \$\endgroup\$
    – Arnauld
    May 29, 2020 at 23:36
  • 1
    \$\begingroup\$ @DomenicoModica I'm afraid it might be a bit too late for that challenge, but keep that it mind for the next ones. ;-) \$\endgroup\$
    – Arnauld
    May 30, 2020 at 19:03
6
\$\begingroup\$

05AB1E, 753 bytes

.•ćÉÞû9‚2¬ú@iH°<]ĆA~Qò†ø‚”Kƒćž»”‚ŸǝD6øZ\§HÔØΔÚÿþjv¤¼§….[Ωîužć“₅nÕbn`ιwU0›•#`’ÿ¨¥€´y ‡ªsíÃ ÝæÿŠ… i‚Û€ä€Ô ‹‡€¾€€š¢ ‹‡„‹€€š¢ À®ly©Ã …«Â£…ß ÿ‚Ž ‹€€†€ƒ‰Ï…Û ÏÏ€È‚Ã›Î…ì €º‚‰f´‹€‹ ŠÍ€•€¾ ¥€€•„‹ À¸ÿ€´Â° ‹®â¢€‰€á က‹Ýæÿ €º€„»áí„ „ÏŠÍ«™n ÿÝæ‡´i¦§ €–€‡‚ƶ¨ ‚‰‡Ü€ƒ‹®€á ‚Ãs€€¼§ ¨À‡‚ ‰¦ÿ €Ÿˆ™‚œÒÞ ¯š€É‚µ ©ß€èÿ ‚¿Þ¡ÿ‚ï ¬Í‡Ü€ƒ‹®€á €Ÿ¢ž€™žÜs ™Å€ˆ€€€¢îÁ ¸•ÿ®ísƒÏ °ä•Ç €Ðâ쀟€€Èšs Ó´f€á€¾ ÞŸ€ƒ‹ˆ ‡—ÿŠë œÆ€‚€€™¨‚… ‚ìsaˆÁ €É€¨€ˆï¶ …ç‹€¹¶s ÿ‰à „Ρ¤ÿ€Ÿ ŽÇ€ˆ—‹ ŽÇ€ˆ›Í c•»tyc•»ty±»±» cjƒ¿€¨ ïų• iƒ¾€„h‚Š ›ä€¯ƒ´€î—Ç ŠÍÿ ͈ˆ™ †æˆ×ÿ ¬Í‰€€†æ µ±Ž€ ³Ö€†€¯ÖÇ ÿ €¸€µ€©»å€á …Ž€šÿ ´Û‚œŠàëÌ ÕÕ…Ž i€·€œi‚µ •€‰ st±µ€èaÍÝ i€Ü‚ÒàŠ ‚‹€‚™‰ ©„‰à ƒ¶acŽÏ¼Ã ‚衹 iÅˈ¬€‹ ·ä‰à ÿ´™e Åˀ€¯³£ €¸€µ€©‹®€ª ÕÕ€¿ÿ º°€á Ÿ™£Í i€©‚œ€Ÿ†æ ‡ªÃ½ ˆÃ¼Î ŠçÞ® †ì¦³ˆ¦ •»€€†â—É €ç€ŸÅÍ °ä€„ÿ ±¹mÌ¢’u#Å¿à‘Ç¥Ù‡‘×

Try it online or verify all the cheat-codes.

Explanation:

.•ćÉÞ...U0›•   # Push compressed string "stunt hem hicksv atlantis kangaroo wler freak quer ninja suede nga cruel glue grime dough ters neighb dulldull ters thugs"
 #             # Split it on spaces to a list
  `            # Pop and push all strings separated to the stack
’ÿ¨¥...mÌ¢’    # Push dictionary string "ÿarmoury professionalskit nutÿtoys ineedsomehelp turnuptheheat turndowntheheat pleasantlywarm toodamnhot ÿday stayinandwatchtv cantseewhereimgoing timejustfliesby speeditup slowitdown roughÿourhood stoppickingonme surroundedbynutÿ timetokickass oldspeeddemon ÿnuthandicap notforpublicroads justtryandstopme wheresthefuneral celebritystatus trueÿ allcarsgoboom wheelsonlyplease sticklikeÿ goodbyeÿworld donttryandstopme alldriversarecriminals pinkisthenewcool soloÿsitsblack flyingfish whoateallthepies buffmeup leanandmean blueÿshoes attackofthevillagepeople lifesabeach onlyhomeisallowed betterstayindoors ÿtown loveconÿall everyoneispoor everyoneisrich chittychittybangbang cjphonehome jumpjet iwanttohover touchmycaryoudie speedÿ bubblecars nightproÿ dontbringonthenight scottishsummer sandinmyears ÿ noonecanhurtme manfromÿ letsgobasejumping rocketman idoasiplease bringiton stinglikeabee iamveryhungry stateofemergency crazytown takeachillpill fullclip iwannadriveby ghosttown ÿille wannabeinmygang noonecanstopus rocketmayÿ worshipme helloladies icangoallnight professionalkiller naturaltalent ohdude fourwheelfun hittheroadjack itsallbull flyingtoÿ monstermash",
               # where the `ÿ` are automatically filled with the strings on the stack
 u             # Convert it to uppercase
  #            # Split it on spaces
   Å¿          # Check for each word whether the (implicit) input-string ends with it
               # (1 if truthy; 0 if falsey)
     à         # Check if any are truthy by taking the maximum
      ‘Ç¥Ù‡‘   # Push dictionary string "CHEAT ACTIVATED"
            ×  # Repeat the string the integer amount of times
               # (so once for truthy; and it becomes an empty string for falsey)
               # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to use the dictionary? and How to compress strings not part of the dictionary?) to understand how compressed string .•ćÉÞ...U0›• and dictionary strings ’ÿ¨¥...mÌ¢’ and ‘Ç¥Ù‡‘ work.

\$\endgroup\$
5
\$\begingroup\$

Retina 0.8.2, 1094 1082 bytes

HE
g
Tg
y
ST
a
GO
b
TT
c
DO
d
IT
e
AS
f
LE
h
IN
i
AN
j
AR
k
LL
l
OU
m
RO
n
ES
o
ON
p
ER
q
ED
r
AT
s
HO
t
IC
u
jD
w
Al
x
ME
z
NIGHT
=
M`(THUGSkMmRY|PnFoSIpAL(SKe|KILhR)|(SURRmNDrBYNUcq|NUcqaOY|TIzTOKuKf|NOTFORPUBLunAD|CEhBReYasU|xDRIVqSkECRIMiAL|BEcqaAYidOR|BUBBhCk|SwiMYEk|MjFnMsLjTI)S|(DUlDUlDA|TIzJUaFLIoB|IAMNEVqHUNGR|asEOFEMqGENC|IWjNADRIVEB)Y|(aOPPuKibN|TRUEGRI|CJPHpEt|WORSHIP)z|(JUaT|dNc)RYwaOPz|NOpECj(aOPUS|HURTz)|iErSOzgLP|T(URN(UP|dWN)ygs|OODAMNtT|mCHMYCkYmDIE|AKEACHIlPIl)|PhfjTLYWkM|aAYiwWsCHTV|CjTSEEWgREIMbiG|S(PEr(FREAK|eUP)|LOWedWN|OLpGfeSBLACK|COcISHSUMMq)|RmGHNEIGHBmRtOD|OLDSPErDEMp|dUGHNUTHwuAP|WgRoyFUNqAL|xCkSbBOOM|(WgELSpLYPhf|auKLIKEGLU|IdfIPhf|aiGLIKEABE|OHDUD)E|bODBYECRUELWORLD|PiKISyNEWCOOL|FLYiG(TOaUNT|FISH)|WtsExyPIo|BUFFzUP|hjwzj|BLUoUroto|AcACKOFyVIlAGEPEOPh|LIFoABEACH|pLYtMIoxOWr|LOVECpQUqSx|EVqYpEIS(POOR|RuH)|(CHIcY){2}BjGBjG|JUMPJET|IWjcOtVq|=PnWhR|dNTBRibNy=|KjGkOO|hTSbBfEJUMPiG|nCKETM(j|AYgM)|BRiGep|(Gta|CRAZY)TOWN|NiJsOWN|FUlCLIP|HuKSVILh|WjNABEiMYGjG|glOLADIo|ujbx=|NsURALTAhNT|FmRWgELFUN|HeynADJACK|eSxBUl|MpaqMfH)$
0

1
CHEAT ACTIVATED

Try it online!

Verify all matches

This solution is based on the observation that many letter pairs repeat several times in different cheat codes. We can replace those common pairs with lowercase letters (since the input will be in all uppercase) before executing the main regex.

Common letter pairs were generated using this program

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Can't that map be used in any way to write CHEAT ACTIVATED as Cgs ACTIVsr? \$\endgroup\$
    – Domenico
    May 27, 2020 at 23:47
  • 2
    \$\begingroup\$ @DomenicoModica Unfortunately no. The lowercase letters are never converted back to the uppercase pairs that they represent \$\endgroup\$ May 28, 2020 at 0:15
2
\$\begingroup\$

Stax, 744 bytes

ú↓╒E╢≤3░ü(⌡▬α▲Kw~Eæ║aù≡╕↓╠ækîª♥J╠⌂ÿb╞╝ø└╫£φ├╡▌ê╔ê;y9¿¿¢Ö⌡D◘MB╡ú:¢▌BÇ!ÜÅ?╫-◙¥·╘hM┌ûoƒP墿δ╓x╓7╤½{α█hè▄ΔZ∙╙d≥♀'ô▼╘[πCò"┬╦•ù,╫▀╚╟TεÿRD°ß£{♠╕~>G╧ÜG⌠é~F~⌐?Iê→LA╟αa°♦V╔xhU∟δ¶╧▀Dïîc╫►τ8üîÄ╠⌂○╣*i☻▌ƒç╥¿ÇàM H─▬½÷`bû>miWπ∞*ü\σ¶REuü╚∙╠K┌ΦîΣ╫←▒╜A+░Ñ@)nφ₧∞'i╤Su@↑⌂¥ynΓv█e-0y╧ŧ∟8φ·k½▌↑ëK╡7╛ƒ └¥τ─~↕τ╫^sh<▀Ö¥4╟╔«▼»0┌▌ûÆ↨1ñFf┘ê▒}[d↔ätf,▀⌂qt‼≈Xⁿ←ìhà⌂ÇΦXDÿs═JéΔ♠ö╙═[═4○tºyBoz?e╔§▐Ñ│δ`♣m♠°⌐ñ▐b╙|I₧◙Çq╧WNÿ:hYⁿ╝Ö┤ Ö╟╗φW@‼¡Δ¥♥£<Mÿt·╛~Ö◘U3∞P♂πΩ○U÷₧ï↨75-]├╢▒║3#│‼8^7.♦▼2↨8├Fⁿ♥>º√√─Ö¥┌Æ☼;∙Δ;+ï♪≥àΔñö╢íhåhò╤7e╣D┼┌τ·▐\½N⌂se0░╖1NmQQChs╕ë╒┌≈Å■╓{]&§╦π◄▲┘#?◙èáK?A▲≤û}╥5V#(¢⌠ü,∟δ$:åΓ↑╟ΘΘ±○«╠j┐≈o,v♦ì9╜æ-K│↑♀fwß☻δA┐┼à◄?║H√╖¿Æ↨á░Ö╗╣ΩÄú╢Mé=Ä▌↔→a°◘^j►╡┐t'◄wΔh←▬╜δt♫¡ïù«○├α7♣G▼K]H┬>♥á»φ9öù|╜Δ╥Éﬡ.╚øKôªRø─Ç╞╗}₧4◙|`▓íâM ╥╨uⁿYéΔß☻¶∟ëæ┤,á╔∞₧Hæ}♪↑ßvâúy[>lu7▌z╒sóÄO:L▬╦íDq§φiIΔ═ûδ▓^ff▒

Run and debug it

It relies heavily on compressed string literals, and there's not too much interesting about it.

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

JavaScript, 1200 bytes

s=>/(ALL(CARSGOBOOM|DRIVERSARECRIMINALS)|ATTACKOFTHEVILLAGEPEOPLE|BETTERSTAYINDOORS|BLUESUEDESHOES|BRINGITON|BUFFMEUP|CELEBRITYSTATUS|DOUGHNUTHANDICAP|DULLDULLDAY|EVERYONEIS(POOR|RICH)|FLYING(FISH|TOSTUNT)|FOURWHEELFUN|FULLCLIP|GOODBYECRUELWORLD|HELLOLADIES|HICKSVILLE|IAMNEVERHUNGRY|INEEDSOMEHELP|ITSALLBULL|IWAN(NADRIVEBY|TTOHOVER)|JUMPJET|KANGAROO|LEANANDMEAN|LIFESABEACH|LOVECONQUERSALL|MANFROMATLANTIS|MONSTERMASH|NATURALTALENT|NIGHTPROWLER|NOONECAN(HURTME|STOPUS)|NOTFORPUBLICROADS|NUTTERSTOYS|OHDUDE|OLDSPEEDDEMON|ONLYHOMIESALLOWED|PINKISTHENEWCOOL|PLEASANTLYWARM|PROFESSIONAL(KILLER|SKIT)|ROCKETMA(N|YHEM)|ROUGHNEIGHBOURHOOD|SCOTTISHSUMMER|SLOWITDOWN|SPEED(FREAK|ITUP)|STA(TEOFEMERGENCY|YINANDWATCHTV)|STI(CKLIKEGLUE|NGLIKEABEE)|SURROUNDEDBYNUTTERS|TAKEACHILLPILL|THUGSARMOURY|TIME(JUSTFLIESBY|TOKICKASS)|TOODAMNHOT|TOUCHMYCARYOUDIE|TURN(DOWN|UP)THEHEAT|WHERESTHEFUNERAL|WHOATEALLTHEPIES|(HITTHEROADJ|SOLONGASITSBL)ACK|((CHITTY){2}BANGB|WANNABEINMYG)ANG|(BUBBLEC|SANDINMYE)ARS|(CANTSEEWHEREIMGO|LETSGOBASEJUMP)ING|(CJPHONEHO|(DON|JUS)TTRYANDSTOP|STOPPICKINGON|TRUEGRI|WORSHIP)ME|(DONTBRINGONTHE|ICANGOALL)NIGHT|(IDOASI|WHEELSONLY)PLEASE|(CRAZY|GHOST|NINJA)TOWN)$/.test(s)?'CHEAT ACTIVATED':''

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ It should be a complete program \$\endgroup\$
    – Domenico
    May 31, 2020 at 16:06
2
\$\begingroup\$

JavaScript (Node.js), 996 bytes

a=0n;process.argv[2].match(require(`zlib`).unzipSync(Buffer("\"T93)OC8m{J84WLB/+&GTui0kf`VU#jJp;3(nOUQ))1b/-^*.t&O'V58#/0;D$- /te\"l_)RiO<j]tu=ck_:{b,bL^?Gm'^`%I5M;I{g\\GA-\\kud?RvYIH8=nvGq|{S l-zt5?.(zt9thR%m.v=[|hJZW7^/1RYRTJ8+)_>V-k!)[c2y1Ra5];'BM+#+!n-2\\nl;libQ7NmmYjG*0$n=S;=<W)dm/(vF=Q'zuYjfx2p,OBrqGc%upq28Y65rxj`@+]P6@s^O#A9G==H*bCz3G'rNADJOFs{8k~8#8.&Y|1=soo(JS>iVRy?Gj})\"?t NCjVmoUUDo*B98e-`xYyA#X#El;vqDjJwNb8cE|~@N).v3TT{?Kk*M1zw`y:}{$\\DPj\\GVv0lgP;5satf1\"K}4G:Jc1xt]OXCu^$#u&4?NA:Od)v+!+'1=TrUBx2vfh'~HFyXZ1BzK4(Dh_-_';/A}:SxM` !3\"4qXIjrCu$]]r+$P,6_+PqH#IU9,><UJ4U#[wEb`<,f%X*dr<#2V_U\"BjiPA]En0Ls\\yt61u #m@3rm6e]NMBR_\\La.7|9^)uh/$Ef.w^7{mn;~ug\\w`3MDQPb$IR}_2A3qkc:V>rC9|xC/0g:_A'nuV<Q ugVj|`1<(]*a~.jFlp$'Mw[gDF<E]5I$tbg\\10'xvwUBeWBk8g2( XjBhu*Y(KK}Yzu}(,YY6.5TcF)u9'=M[Lb4^ /g#<P$$3*>i}.Y4]m$2e1@c\\>dAW?O`DdexO=jB$7!bJ'/|O:X,}]|qQ%zs;xVStjz[4~8?>\"m \"yR5 L+5)\\&(jZD6$<-<mb>^;j2<").map(n=>[a=a*95n+BigInt(n-32)]).map(n=>[(a>>=8n)%256n])))&&console.log('CHEAT ACTIVATED')

Try it online!

a=0n;                                   // Init
process.argv[2]                         // Take Input
.match(                                 // Check
  require(`zlib`).unzipSync(            // Uncompress
    Buffer("...")                       // For each char
    .map(n=>[a=a*95n+BigInt(n-32)])     // Add info to a
    .map(n=>[(a>>=8n)%256n])       // and take bytes out
  )                       // [] convert BigInt to Number
)&&console.log('CHEAT ACTIVATED')       //Output

First time using Node for full program

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

C (Linux GCC)

Count: 1584

void f(char*s){char c[][30]={"THUGSARMOURY","PROFESSIONALSKIT","NUTTERSTOYS","INEEDSOMEHELP","TURNUPTHEHEAT","TURNDOWNTHEHEAT","PLEASANTLYWARM","TOODAMNHOT","DULLDULLDAY","STAYINANDWATCHTV","CANTSEEWHEREIMGOING","TIMEJUSTFLIESBY","SPEEDITUP","SLOWITDOWN","ROUGHNEIGHBOURHOOD","STOPPICKINGONME","SURROUNDEDBYNUTTERS","TIMETOKICKASS","OLDSPEEDDEMON","DOUGHNUTHANDICAP","NOTFORPUBLICROADS","JUSTTRYANDSTOPME","WHERESTHEFUNERAL","CELEBRITYSTATUS","TRUEGRIME","ALLCARSGOBOOM","WHEELSONLYPLEASE","STICKLIKEGLUE","GOODBYECRUELWORLD","DONTTRYANDSTOPME","ALLDRIVERSARECRIMINALS","PINKISTHENEWCOOL","SOLONGASITSBLACK","FLYINGFISH","WHOATEALLTHEPIES","BUFFMEUP","LEANANDMEAN","BLUESUEDESHOES","ATTACKOFTHEVILLAGEPEOPLE","LIFESABEACH","ONLYHOMIESALLOWED","BETTERSTAYINDOORS","NINJATOWN","LOVECONQUERSALL","EVERYONEISPOOR","EVERYONEISRICH","CHITTYCHITTYBANGBANG","CJPHONEHOME","JUMPJET","IWANTTOHOVER","TOUCHMYCARYOUDIE","SPEEDFREAK","BUBBLECARS","NIGHTPROWLER","DONTBRINGONTHENIGHT","SCOTTISHSUMMER","SANDINMYEARS","KANGAROO","NOONECANHURTME","MANFROMATLANTIS","LETSGOBASEJUMPING","ROCKETMAN","IDOASIPLEASE","BRINGITON","STINGLIKEABEE","IAMNEVERHUNGRY","STATEOFEMERGENCY","CRAZYTOWN","TAKEACHILLPILL","FULLCLIP","IWANNADRIVEBY","GHOSTTOWN","HICKSVILLE","WANNABEINMYGANG","NOONECANSTOPUS","ROCKETMAYHEM","WORSHIPME","HELLOLADIES","ICANGOALLNIGHT","PROFESSIONALKILLER","NATURALTALENT","OHDUDE","FOURWHEELFUN","HITTHEROADJACK","ITSALLBULL","FLYINGTOSTUNT","MONSTERMASH"};for(int i=0,j=0,k=0;i<87;i++){j=strlen(c[i]);k=strlen(s);if(k<j||strncmp(s+(k-j),c[i],j))continue;printf("CHEAT ACTIVATED\n");}}

Count w/out cheats themselves: 143

void f(char*s){for(int i=0,j=0,k=0;i<87;i++){j=strlen(c[i]);k=strlen(s);if(k<j||strncmp(s+(k-j),c[i],j))continue;printf("CHEAT ACTIVATED\n");}}

So if I wanted to improve mine, I'd need to find a better way to represent that data

\$\endgroup\$
2
  • \$\begingroup\$ 1544 bytes \$\endgroup\$
    – ceilingcat
    May 29, 2020 at 17:35
  • 2
    \$\begingroup\$ Why don't you use a single string with a delimiter rather than a list of separate strings? For example, the first part could be "THUGSARMOURY/PROFESSIONALSKIT/NUTTERSTOYS..." \$\endgroup\$ May 30, 2020 at 18:04
1
\$\begingroup\$

Japt, 823 bytes

`Ö„t aå¡ê*`pUè`(kžo|â‘(adjack|(g—¡|cŸzy|nˆja)Èu|fÒàg(‘Ð|t|f‰h)|Ü…hnÔAÌap|Ü‹(簁GÊght|â2Øop´)|ÂlckÆøevÅNgepeop¤|¦fƒa¼a®|i(°n(nÃqveby|t‘—v€)|amšv€Ë¡ry|ÖÁoa¥night|tÑ¡ÞÑ|㔐”lp)|æˆrQtÓƒ‰|n(å
…ys|otfŽèFŠÞads|Çʯn(ˆ´|¡op«)|Âxत|ightpžw¤r)|ʵsvÅH|àP‰(Îr|poŽ)|è	wal(kÅHr|skŠ)|s(Ö-‰hsum´r|å€dbynÔjrs|áʉkts½ack|pe‚(fœak|Ä¿)|t(…ee´rgcy|Ãà„d°t®tv|Å­ikeglue|Äikea¼e|áⶨg´)|Óqtܵ|ÂnÛŒrs)|Î…hšighÞ€—od|goodbyecruelwŽld|b(ub½eÖÜ|Áªã §€ÇÔ|ãˆ
E|luàÂoƒ|uff´up)|jÔÍã­€…p´|fŒr؇Óô|c(jpÊÊÊà|Ê•yÖ’tyßAßA|e¤ßŠyÐa«|„t eØ€e‹goˆg)|è0b$ew¬ol|t(ruegÎX|‹e(j«tf¦ƒby|‘kick†s)|oo»mn—t|aê‚ZUpi¥|˯‡Ú€y|Æ2myÖÝŒ¹e|¨n(ܵ|up)eÊ!)|ž×Fµ(n|y”m)|Ò „dÚ |§Êãà!»d|fªlc¦p|è "ç°rm|ÚŽ’rÚR|jumpjet|oldspe‚¸¶n|w(Æ¢ip´|„na¼ˆmyg„g|—ÂT¥epiƒ|†fÕal)|love¬nquÀ&¥|ohdu¸|Ê)oÓ©ƒ|(iº†i|؇ls§)pÒ"e|a¥(ÖÜgoÞ¼|d㎀›e×ˈals)|ç9é»y|¤tsgoßPjuÛpg)$`u¹u

Try it online!

Explanation

`...`pUè`...`u¹u
`...`          u  // Compressed version of "CHEAT ACTIVATED"
     p            // Repeat the string
      Uè          // Number of matches of the regex on the input
        `...`u    // Compressed version of regex from the python solution

The regex is from this python solution

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

JavaScript, no compression, 1356 1351 bytes

a=T=>~"THUGSARMOURY,PROFESSIONALSKIT,NUTTERSTOYS,INEEDSOMEHELP,TURNUPTHEHEAT,TURNDOWNTHEHEAT,PLEASANTLYWARM,TOODAMNHOT,DULLDULLDAY,STAYINANDWATCHTV,CANTSEEWHEREIMGOING,TIMEJUSTFLIESBY,SPEEDITUP,SLOWITDOWN,ROUGHNEIGHBOURHOOD,STOPPICKINGONME,SURROUNDEDBYNUTTERS,TIMETOKICKASS,OLDSPEEDDEMON,DOUGHNUTHANDICAP,NOTFORPUBLICROADS,JUSTTRYANDSTOPME,WHERESTHEFUNERAL,CELEBRITYSTATUS,TRUEGRIME,ALLCARSGOBOOM,WHEELSONLYPLEASE,STICKLIKEGLUE,GOODBYECRUELWORLD,DONTTRYANDSTOPME,ALLDRIVERSARECRIMINALS,PINKISTHENEWCOOL,SOLONGASITSBLACK,FLYINGFISH,WHOATEALLTHEPIES,BUFFMEUP,LEANANDMEAN,BLUESUEDESHOES,ATTACKOFTHEVILLAGEPEOPLE,LIFESABEACH,ONLYHOMIESALLOWED,BETTERSTAYINDOORS,NINJATOWN,LOVECONQUERSALL,EVERYONEISPOOR,EVERYONEISRICH,CHITTYCHITTYBANGBANG,CJPHONEHOME,JUMPJET,IWANTTOHOVER,TOUCHMYCARYOUDIE,SPEEDFREAK,BUBBLECARS,NIGHTPROWLER,DONTBRINGONTHENIGHT,SCOTTISHSUMMER,SANDINMYEARS,KANGAROO,NOONECANHURTME,MANFROMATLANTIS,LETSGOBASEJUMPING,ROCKETMAN,IDOASIPLEASE,BRINGITON,STINGLIKEABEE,IAMNEVERHUNGRY,STATEOFEMERGENCY,CRAZYTOWN,TAKEACHILLPILL,FULLCLIP,IWANNADRIVEBY,GHOSTTOWN,HICKSVILLE,WANNABEINMYGANG,NOONECANSTOPUS,ROCKETMAYHEM,WORSHIPME,HELLOLADIES,ICANGOALLNIGHT,PROFESSIONALKILLER,NATURALTALENT,OHDUDE,FOURWHEELFUN,HITTHEROADJACK,ITSALLBULL,FLYINGTOSTUNT,MONSTERMASH".split`,`.findIndex(E=>0<=T.indexOf(E)&T.indexOf(E)>=T.length-E.length)?"CHEAT ACTIVATED":""

Attempted using min<var<max in the array callback, but that resulted fale positives.

Pretty straightforward otherwise; I preferred not to use compression; can't be shorter that way.


5 bytes spared by @KevinCruijssen and my reading to JS golfing.

\$\endgroup\$
5
  • \$\begingroup\$ Doesn't seem to work at all. Maybe something like this: Try it online! (the comment is not long enough to hold the whole string). \$\endgroup\$
    – Neil
    May 27, 2020 at 19:06
  • \$\begingroup\$ @Neil for the record, I tested with Deno and that one didn't let me create the function a without var that I left here out for brevity. But otherwise, console.log(a("AAAAAAAAAATOODAMNHOT")) works, for example. \$\endgroup\$ May 27, 2020 at 19:47
  • \$\begingroup\$ Wait, sorry, there was an error indeed. Thanks \$\endgroup\$ May 27, 2020 at 20:01
  • 1
    \$\begingroup\$ @KevinCruijssen thanks, single-mark operator was fine but 0<= is equivalent to -1<, not 1< - zero-inclusion is crucial because with indexOf returns, 0 is perfectly valid. \$\endgroup\$ May 28, 2020 at 13:32
  • \$\begingroup\$ I know you don't want to use compression but you can save 70 bytes by getting rid of the commas (this is an edited version so that the link fits in a comment). \$\endgroup\$
    – Arnauld
    May 28, 2020 at 23:58
0
\$\begingroup\$

Erlang (escript), 1322 bytes

a(X)->lists:any(fun(I)->lists:suffix(I,X)end,string:split("THUGSARMOURY
PROFESSIONALSKIT
NUTTERSTOYS
INEEDSOMEHELP
TURNUPTHEHEAT
TURNDOWNTHEHEAT
PLEASANTLYWARM
TOODAMNHOT
DULLDULLDAY
STAYINANDWATCHTV
CANTSEEWHEREIMGOING
TIMEJUSTFLIESBY
SPEEDITUP
SLOWITDOWN
ROUGHNEIGHBOURHOOD
STOPPICKINGONME
SURROUNDEDBYNUTTERS
TIMETOKICKASS
OLDSPEEDDEMON
DOUGHNUTHANDICAP
NOTFORPUBLICROADS
JUSTTRYANDSTOPME
WHERESTHEFUNERAL
CELEBRITYSTATUS
TRUEGRIME
ALLCARSGOBOOM
WHEELSONLYPLEASE
STICKLIKEGLUE
GOODBYECRUELWORLD
DONTTRYANDSTOPME
ALLDRIVERSARECRIMINALS
PINKISTHENEWCOOL
SOLONGASITSBLACK
FLYINGFISH
WHOATEALLTHEPIES
BUFFMEUP
LEANANDMEAN
BLUESUEDESHOES
ATTACKOFTHEVILLAGEPEOPLE
LIFESABEACH
ONLYHOMIESALLOWED
BETTERSTAYINDOORS
NINJATOWN
LOVECONQUERSALL
EVERYONEISPOOR
EVERYONEISRICH
CHITTYCHITTYBANGBANG
CJPHONEHOME
JUMPJET
IWANTTOHOVER
TOUCHMYCARYOUDIE
SPEEDFREAK
BUBBLECARS
NIGHTPROWLER
DONTBRINGONTHENIGHT
SCOTTISHSUMMER
SANDINMYEARS
KANGAROO
NOONECANHURTME
MANFROMATLANTIS
LETSGOBASEJUMPING
ROCKETMAN
IDOASIPLEASE
BRINGITON
STINGLIKEABEE
IAMNEVERHUNGRY
STATEOFEMERGENCY
CRAZYTOWN
TAKEACHILLPILL
FULLCLIP
IWANNADRIVEBY
GHOSTTOWN
HICKSVILLE
WANNABEINMYGANG
NOONECANSTOPUS
ROCKETMAYHEM
WORSHIPME
HELLOLADIES
ICANGOALLNIGHT
PROFESSIONALKILLER
NATURALTALENT
OHDUDE
FOURWHEELFUN
HITTHEROADJACK
ITSALLBULL
FLYINGTOSTUNT
MONSTERMASH","
",all)).

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Fine, but it should be a complete program and the output: CHEAT ACTIVATED / <null> \$\endgroup\$
    – Domenico
    May 31, 2020 at 16:00

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.