18
\$\begingroup\$

Some time after this incident

There are some of us who are against this defiling order of jQuery. It is an unholy presence, of which must be exterminated. I therefore call on you, the loyal to The New Kingdom of Reformation, to create a program that will eliminate such resistance. All code must be validated and searched for ANY and EVERY trace of jQuery. And, of course, your submission needs to be short (there has been another budget cut, and, unfortunately, it was in the storage department). And it cannot have defiling characters.

To get you up to speed, a defiling character is any of the following characters: jJqQuUeErRyY$x0. As has been said, the use of these characters is strictly prohibited, even in your own program. So don't use them. ALSO we're okay with dollar signs in numbers. So, anything of the form n+(.nn)*$ is O.K. (You still shouldn't use 0.)

Your program/code/etc. must validate an input program. If it contains any defiling characters, you must output This programmer is guilty of Heresy. He must be burnt.; if no such characters are found, you must output Program validated. Clearance level 2 given..

Bonuses and Penalties

  • I personally admire the character the character ~. For every two you use, I'll give you -1 byte. (i.e., every other ~ is free.)
  • You may choose precisely one character from the excluded; you may then use this character in all of it's cases, HOWEVER: there is a +50% byte initial penalty, and then a +5 byte penalty for every instance of that character.
  • -90% if you do not use any of the characters adjacent to jquery (just to be super safe) in your source code. These are (in addition): iIkKpPsSzZXdDfF
  • -20% if, when given an invalid string, along with outputting the aforementioned text, you replace all invalid characters with - for a run of 1, * with a run less than 10, and [] with any longer run.
  • -50 bytes if you do not find JavaScript/i or Simplex as having defiling characters.

Reference Implementation

function validate() {
  var str = document.getElementById("input").value;
  var str2 = str.replace(/[jquery0]/gi,"").replace(/x/g,"").replace(/(\d+\.*\d*\d*\$)|\$/g,"$1"); // thanks Doorknob!
  var val;
  if (str2 == str) {
    val = "Program validated. Clearance level 2 given.";
  } else {
    val = "This programmer is guilty of Heresy. He must be burnt.";
  }
  document.getElementById("output").value = val;
}
textarea{width: 600px;}
<textarea id="input" onkeyup="validate()"></textarea>
<br><br>
<textarea id="output" disabled></textarea>

\$\endgroup\$
  • 1
    \$\begingroup\$ The Ee restriction will be tough... \$\endgroup\$ – LegionMammal978 Oct 27 '15 at 1:29
  • 11
    \$\begingroup\$ Wait... the output sentences contain defiling letters - HYPOCRISY!!! \$\endgroup\$ – Mama Fun Roll Oct 27 '15 at 1:44
  • 6
    \$\begingroup\$ @molarmanful It is only the programs that cannot contain these evil letters. We mean not to impede the speech of men towards others, rather, impede the use of characters which have been classified as detrimental to the holy quality of programming. Those who are blind cannot see, those who are deaf cannot speak. Those who use jQuery cannot be tolerated. \$\endgroup\$ – Conor O'Brien Oct 27 '15 at 1:46
  • 26
    \$\begingroup\$ -1 not enough jQuery \$\endgroup\$ – Doorknob Oct 27 '15 at 2:17
  • 5
    \$\begingroup\$ -1 for continually editing the challenge bonuses. \$\endgroup\$ – AdmBorkBork Oct 27 '15 at 16:24
20
\$\begingroup\$

CJam, 160 139 13.4 bytes

0000000: 22 cf 97 d9 87 d1 85 82 89 8d d1 db 8d 80 a8 af b3 a3  ".................
0000012: b0 b7 82 8e 80 bd c3 ca 89 85 d6 89 84 80 b2 c6 c7 d1  ..................
0000024: 7e ce d0 cd c5 d0 bf cb cb c3 d0 7e c7 d1 7e c5 d3 c7  ~..........~..~...
0000036: ca d2 d7 7e cd c4 7e a6 c3 d0 c3 d1 d7 8c 7e a6 c3 7e  ...~..~.......~..~
0000048: cb d3 d1 d2 7e c0 c3 7e c0 d3 d0 cc d2 8c 80 80 ae d0  ....~..~..........
000005a: cd c5 d0 bf cb 7e d4 bf ca c7 c2 bf d2 c3 c2 8c 7e a1  .....~..........~.
000006c: ca c3 bf d0 bf cc c1 c3 7e ca c3 d4 c3 ca 7e 90 7e c5  ........~.....~.~.
000007e: c7 d4 c3 cc 8c 80 9d 22 7b 39 33 7e 2b 7d 25 7e        ......."{93~+}%~

The above is a hexdump that can be reversed with xxd -r -c 18. Try it online.

The code itself consists of 142 bytes. It contains a total of sixteen ~ characters (-8 bytes), but no jQuery-adjacent characters (-90%).

How it works

The match n+(.nn)*$ really boils down to a digit followed by a dollar sign.

First of all,

"<bunch of characters>"{93~+}%~

adds -94 to all code points of that string and evaluates the result.

The executed code is:

q       e# Read all input from STDIN.
9{      e# For each I in [0 ... 8]:
  )s    e#   Increment and cast to string.
  '$+   e#   Append a dollar sign.
  /s    e#   Split the input at occurrences. Flatten the result.
}/

"JQUERY$0"

_el+'x+ e# Append a lowercase copy and "x" to that string.
&       e# Intersect with the modified input.

"This programmer is guilty of Heresy. He must be burnt."
"Program validated. Clearance level 2 given."

?       e# Ternary if; select the corresponding message.
\$\endgroup\$
  • \$\begingroup\$ That's good. Wow. \$\endgroup\$ – Conor O'Brien Oct 27 '15 at 2:22
  • \$\begingroup\$ Good job. Sorry for the grief of bonuses. Didn't realize it would have a detrimental effect on you et all \$\endgroup\$ – Conor O'Brien Oct 27 '15 at 18:24
6
\$\begingroup\$

Minkolang 0.9, 346-3 = 343 bytes

Longest program yet.

#66*68*d5*2:88*5+d5+d7+d1+d3+d4+6[3i+c48*+]2c"N"11-p(od4&k13w35*[dic=,5&kk11w] )
 725*35*48*68*3+5[66+c2~g2p]27*48*1-d2+d6+d8+5[9c2~g2p]37*67*d8+3[67+c2~g2p]55*57*2[77+c2~g2p]X11-2w
"This p og amm   is g ilt  of H   s . H  m st b  b  nt."(O).
 X2546*3[66+c2~g4p]44*d6+47*d3+d2+d8+6[9c2~g4p]X11-4w
"P og am validat d. Cl a anc  l v l 2 giv n."(O).

Try it here.

Explanation

The first line does three things: 1) build up the stack with the forbidden characters, 2) put a much-needed x in the right place (the space at the end), and 3) loop through the input, jumping to the appropriate line.

The second and fourth lines do the same thing: replace every gap in the succeeding line with the appropriate character. They jump to the next line at the end.

The third and fifth lines simply push the required string on the stack and print it out.

\$\endgroup\$
  • \$\begingroup\$ Cooooooooooool! \$\endgroup\$ – Conor O'Brien Oct 27 '15 at 3:26
5
\$\begingroup\$

PHP, (204*1.5 + 5) * .1 = 31.1

<?=eval(~šœ—.ß..š˜ ’ž‹œ—×ØФ•ŽŠš.†££Û‡Ï¢Ð–ØÓ..š˜ .š.“žœš×ØФÎÒÆ¢Ô×££Ñ¤ÎÒÆ¢„Í‚ÖÀ££ÛÐØÓÝÝÓÛž.˜‰¤Î¢ÖÖÀØ«—–Œß...˜.ž’’š.ß–Œß˜Š–“‹†ß.™ß·š.šŒ†Ñß·šß’ŠŒ‹ß.šß.Š.‘‹ÑØÅد..˜.ž’߉ž“–›ž‹š›Ñß¼“šž.ž‘œšß“š‰š“ßÍߘ–‰š‘ÑØÄ);

This dump was made using gnuwin32 hexdump. Reverse with hex2bin.

00000000: 3C 3F 3D 65 76 61 6C 28 - 7E 9A 9C 97 90 DF 8F 8D |<?=eval(~       |
00000010: 9A 98 A0 92 9E 8B 9C 97 - D7 D8 D0 A4 95 8E 8A 9A |                |
00000020: 8D 86 A3 A3 DB 87 CF A2 - D0 96 D8 D3 8F 8D 9A 98 |                |
00000030: A0 8D 9A 8F 93 9E 9C 9A - D7 D8 D0 A4 CE D2 C6 A2 |                |
00000040: D4 D7 A3 A3 D1 A4 CE D2 - C6 A2 84 CD 82 D6 C0 A3 |                |
00000050: A3 DB D0 D8 D3 DD DD D3 - DB 9E 8D 98 89 A4 CE A2 |                |
00000060: D6 D6 C0 D8 AB 97 96 8C - DF 8F 8D 90 98 8D 9E 92 |                |
00000070: 92 9A 8D DF 96 8C DF 98 - 8A 96 93 8B 86 DF 90 99 |                |
00000080: DF B7 9A 8D 9A 8C 86 D1 - DF B7 9A DF 92 8A 8C 8B |                |
00000090: DF 9D 9A DF 9D 8A 8D 91 - 8B D1 D8 C5 D8 AF 8D 90 |                |
000000a0: 98 8D 9E 92 DF 89 9E 93 - 96 9B 9E 8B 9A 9B D1 DF |                |
000000b0: BC 93 9A 9E 8D 9E 91 9C - 9A DF 93 9A 89 9A 93 DF |                |
000000c0: CD DF 98 96 89 9A 91 D1 - D8 C4 29 3B             |          );|
000000cc;

(I'm confused about the order in which to apply the bonus/penalty, so I assumed order as written.)

Uses the character "e" in eval. Thanks to PHP string inversion magic, this manages to avoid all the other jquery and near-jquery characters.

The inverted string contains this code (formatted for clarity)

echo preg_match('/[jquery\\$x0]/i',
  preg_replace('/[1-9]+(\\.[1-9]{2})?\\$/',"", $argv[1]))
  ? 'This programmer is guilty of Heresy. He must be burnt.'
  : 'Program validated. Clearance level 2 given.';

Since this code doesn't have a return statement, eval returns null so <?=eval doesn't do anything. (It's just to avoid <?php)

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you can simplify it a bit with [jquery$x0] and [1-9]+(\.[1-9]{2})?\$. By the way, capital X should not be considered defiling character, so the second regex should be changed to '/[1-9]+(\.[1-9]{2})?\$|X/'. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Oct 27 '15 at 7:24
  • \$\begingroup\$ Add first, then multiply. Actual score:31.35 \$\endgroup\$ – ev3commander Oct 27 '15 at 19:33
4
\$\begingroup\$

><>, 184 bytes

"/6VO+K;[.N'G|(p
~<.1+f9o*-21-*5-1' ';!?l<"K),4):.{%:/27:'67m{X/6:):-86{/6%6/{i{42%6-m"
f +1.>"m'-)&9{69{'(&.{6S{m"'"(6)6S{5,{"'"'/2&4{(2{)6..:)4,)+{(23G"8
!^ag?/i:1+?
p>l?!^1' '5*@@-a

This can be a bit shorter with unprintables, but here's a printable version just for fun. Won't work with the online interpreter since it does puts outside of the codebox.

This program encodes both strings as

G32({+),4):..6){2({4&2/'"{,5{S6)6("m{S6{.&('{96{9&)-'m
K),4):.{%:/27:'67m{X/6:):-86{/6%6/{i{42%6-m

which is each code point subtracted from 155. Similarly,

6V/O+K;[.N'G|(p

encodes the forbidden characters, with code points subtracted from 160.

The last line merely sets the coordinates (forbidden char, 10) to 1, forming a lookup table. The fourth line then checks each input char using the lookup table, outputting the heresy message if 1 else continuing on. On EOF, we move up to output the clearance message.

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

"Javascript" 840*2+14*5=1750 ;)

I'm soooo close, just need to find a way to get rid of the r's

Stack isn't letting me paste the code in here as there are several non printing ASCII characters in the strings, so here's a hexdump from xxd

0000000: 6576 616c 2868 3d27 272c 643d 5b7b 613a  eval(h='',d=[{a:
0000010: 5b2e 2e2e 2770 5b6c 1a6d 375e 695d 6f67  [...'p[l.m7^i]og
0000020: 5f68 6e28 5d6c 5f5b 6e5f 3f66 5f67 5f68  _hn(]l_[n_?f_g_h
0000030: 6e22 1c6d 5d6c 6327 5d2c 623a 367d 2c7b  n".m]lc'],b:6},{
0000040: 613a 5b27 7e27 5d2c 623a 2d31 347d 2c7b  a:['~'],b:-14},{
0000050: 613a 5b2e 2e2e 276e 1c23 356d 286d 6c5d  a:[...'n.#5m(ml]
0000060: 371c 2929 5d69 5e5f 2864 6b6f 5f6c 7328  7.))]i^_(dko_ls(
0000070: 5d69 6729 646b 6f5f 6c73 5c27 2c28 2b28  ]ig)dko_ls\',(+(
0000080: 2e28 646d 1c26 5e69 5d6f 675f 686e 285c  .(dm.&^i]og_hn(\
0000090: 5c69 5e73 285b 275d 2c62 3a36 7d2c 7b61  \i^s(['],b:6},{a
00000a0: 3a5b 277e 272c 277e 275d 2c62 3a2d 3134  :['~','~'],b:-14
00000b0: 7d2c 7b61 3a5b 2e2e 2e27 5f68 5e3d 6263  },{a:[...'_h^=bc
00000c0: 665e 226d 2326 1e22 1c1d 696f 6e1c 2328  f^"m#&."..ion.#(
00000d0: 705b 6622 686f 6666 1b37 1e22 1c1d 6368  p[f"hoff.7."..ch
00000e0: 1c23 2870 5b66 2223 286d 275d 2c62 3a36  .#(p[f"#(m'],b:6
00000f0: 7d2c 7b61 3a5b 277e 275d 2c62 3a2d 3134  },{a:['~'],b:-14
0000100: 7d2c 7b61 3a5b 2e2e 2e27 6663 6e22 1c1c  },{a:[...'fcn"..
0000110: 2328 6c5f 705f 6c6d 5f22 2328 6469 6368  #(l_p_lm_"#(dich
0000120: 221c 1c23 2867 5b6e 5d62 2229 275d 2c62  "..#(g[n]b")'],b
0000130: 3a36 7d2c 7b61 3a5b 277e 275d 2c62 3a2d  :6},{a:['~'],b:-
0000140: 3335 7d2c 7b61 3a5b 2e2e 2e27 6444 6b4b  35},{a:[...'dDkK
0000150: 6f4f 5f3f 6c4c 7353 1e2a 7257 7656 1e22  oO_?lLsS.*rWvV."
0000160: 391b 2227 5d2c 623a 367d 2c7b 613a 5b2e  9."'],b:6},{a:[.
0000170: 2e2e 275b 312d 395d 5b31 2d39 5d5c 5c2e  ..'[1-9][1-9]\\.
0000180: 293f 5b27 5d2c 623a 312d 317d 2c7b 613a  )?['],b:1-1},{a:
0000190: 5b2e 2e2e 272b 5c27 3357 2329 6123 391c  [...'+\'3W#)a#9.
00001a0: 275d 2c62 3a36 7d2c 7b61 3a5b 277e 275d  '],b:6},{a:['~']
00001b0: 2c62 3a2d 3436 7d2c 7b61 3a5b 2e2e 2e27  ,b:-46},{a:[...'
00001c0: 6c69 616c 5b67 1a70 5b66 635e 5b6e 5f5e  lial[g.p[fc^[n_^
00001d0: 281a 3d66 5f5b 6c5b 685d 5f1a 665f 705f  (.=f_[l[h]_.f_p_
00001e0: 661a 2c1a 6163 705f 6828 1c34 1c4e 6263  f.,.acp_h(.4.Nbc
00001f0: 6d1a 275d 2c62 3a36 7d2c 7b61 3a5b 277e  m.'],b:6},{a:['~
0000200: 275d 2c62 3a2d 3134 7d2c 7b61 3a5b 2e2e  '],b:-14},{a:[..
0000210: 2e27 6c69 616c 5b67 675f 6c1a 636d 1a61  .'lial[gg_l.cm.a
0000220: 6f63 666e 731a 6960 1a42 5f6c 5f6d 7328  ocfns.i`.B_l_ms(
0000230: 1a42 5f1a 676f 6d6e 1a5c 5c5f 1a5c 5c6f  .B_.gomn.\\_.\\o
0000240: 6c68 6e28 1c23 275d 2c62 3a36 7d5d 2e6d  lhn(.#'],b:6}].m
0000250: 6170 2864 3d3e 2876 3d27 272c 773d 642e  ap(d=>(v='',w=d.
0000260: 612e 6d61 7028 633d 3e53 7472 696e 672e  a.map(c=>String.
0000270: 6672 6f6d 4368 6172 436f 6465 2863 2e63  fromCharCode(c.c
0000280: 6861 7243 6f64 6541 7428 292b 642e 6229  harCodeAt()+d.b)
0000290: 292c 772e 666f 7245 6163 6828 287a 2c69  ),w.forEach((z,i
00002a0: 2c61 293d 3e7b 6966 2869 2532 2976 3d76  ,a)=>{if(i%2)v=v
00002b0: 2e63 6f6e 6361 7428 615b 692d 315d 2e63  .concat(a[i-1].c
00002c0: 6f6e 6361 7428 7a29 297d 292c 762e 636f  oncat(z))}),v.co
00002d0: 6e63 6174 2877 2e6c 656e 6774 6825 323f  ncat(w.length%2?
00002e0: 772e 706f 7028 293a 2727 2929 292c 642e  w.pop():''))),d.
00002f0: 666f 7245 6163 6828 287a 2c69 2c61 293d  forEach((z,i,a)=
0000300: 3e7b 6966 2869 2532 2968 3d68 2e63 6f6e  >{if(i%2)h=h.con
0000310: 6361 7428 615b 692d 315d 2e63 6f6e 6361  cat(a[i-1].conca
0000320: 7428 7a29 297d 292c 682e 636f 6e63 6174  t(z))}),h.concat
0000330: 2864 2e6c 656e 6774 6825 323f 642e 706f  (d.length%2?d.po
0000340: 7028 293a 2727 2929 0a                   p():'')).
\$\endgroup\$
  • 1
    \$\begingroup\$ It is customary to include a byte count in your header ;) \$\endgroup\$ – Conor O'Brien Nov 23 '15 at 4:20

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.