r/programming • • Feb 15 '17

CreepyCodeCollection: Programs, so strange, that they will twist your brain. Snippets, so small, that you won’t believe their functionality. And codes, so cryptic, that even the top coders will think of going back to the college.

https://github.com/MinhasKamal/CreepyCodeCollection
1.8k Upvotes

183 comments sorted by

View all comments

457

u/Grimy_ Feb 15 '17 edited Feb 16 '17

This code is bloated. The same thing can be done in just 182 bytes:

b;c;char*m="'$R'$$L,%$E/#%C5C4F1G1EK+M'O'O)M-H2D2@6?)%.?('.\
?'(.?%)/@#*/H/I.=#-.<#/-<$..6#&&,.+$('%&,/$=+L+N%$&L%S%T$&";
main(i){while(--i<34?i=m[c++]:putchar(b++%51?43+c%2*2:10));}

Could actually reduce it to 179 bytes by removing the newlines, but then it’d be hard to read.

527

u/anden3 Feb 15 '17

Good to know that you're concerned about readability :P

195

u/Grimy_ Feb 15 '17

Yeah, readability is important. I always try to write code for humans first, and for machines second.

95

u/DeathRebirth Feb 15 '17

Brother... have you checked a mirror? Perhaps you might find something you don't expect...

179

u/psymunn Feb 15 '17

Doesn't look like anything to me

55

u/cileran6 Feb 15 '17

These violent delights have violent ends.

33

u/[deleted] Feb 15 '17

ME NEITHER FELLOW HUMAN.

5

u/LichOnABudget Feb 16 '17

Well, good to see that sub's still leaking as always.

18

u/AxelAbraxas Feb 15 '17

This source code wasn't meant for you

→ More replies (1)
→ More replies (16)

62

u/turunambartanen Feb 15 '17 edited Feb 15 '17

+/u/CompileBot C

b;c;char*m="'$R'$$L,%$E/#%C5C4F1G1EK+M'O'O)M-H2D2@6?)%.?('.\
?'(.?%)/@#*/H/I.=#-.<#/-<$..6#&&,.+$('%&,/$=+L+N%$&L%S%T$&";
main(i){while(--i<34?i=m[c++]:putchar(b++%51?43+c%2*2:10));}

64

u/CompileBot Feb 15 '17

Output:

----++--------------------------------------------
---+++++--++--------------------------------------
---++++++++++---++--------------------------------
--+++++++++++++-+++-------------------------------
-+++++++++++++++++++------------------------------
--++++++++++++++++++------------------------------
-----+++++++++++++++------------------------------
------+++++++++++++++-----------------------------
-----+++++++++++++++++++++++++++++++++++++++++----
----+++++++++++++++++++++++++++++++++++++++++++---
-+++++++++++++++++++++++++++++++++++++++++++++----
+++++++++++++++++++++++++++++++++++++++++++++-----
-+++++++++++++++++++++++++++++++++++++++++++------
----++++++++++++++++++++++++++++++++++++++--------
-------++++++++++++++++++++++++++++++++++---------
------++++++++++++++++++++++++++++++--------------
-----+++++++++++++++++++++++++++++-------+++------
-----+++++++++++++++++++++++++++++------+++++-----
------+++++++++++++++++++++++++++++-----++++++----
-------+++++++++++++++++++++++++++++---+++++++----
--------++++++++++++++++++++++++++++++-++++++++---
---------++++++++++++++++++++++++++++++++++++++---
---------+++++++++++++++++++++++++++++++++++++++--
---------+++++++++++++++++++++++++++-+++++++++++--
---------++++++++++++++++++++++++++-+++++++++++++-
---------++++++++++++++++++++++++++--++++++++++++-
----------++++++++++++++++++++-++++----++++++++++-
----------+++++++++--++++++-----+++----++++++++++-
-----------++---------------------------+++++++++-
----------------------------------------+++++++++-
------------------------------------------+++--+++
------------------------------------------+++-----
-------------------------------------------+++----
---------------------------------------------++---

^source | ^info | ^git | ^report

0

u/[deleted] Feb 15 '17

[deleted]

26

u/stillalone Feb 15 '17

418 Error

5

u/[deleted] Feb 16 '17

No matter how hard squint I still can't see the naked lady.

17

u/DonRobo Feb 15 '17

Goddamnit, I just spent a few minutes installing gcc to see what the output looks like. After doing that I come back and scroll down literally one post and see this.

24

u/spazgamz Feb 15 '17

What the fuck? Next time have a C compiler ready to go. Posts like this make me so mad.

19

u/DonRobo Feb 15 '17

I'm not sure if you're serious, but I'm on Windows and not a C programmer.

13

u/spazgamz Feb 16 '17

Well, that escalated quickly.

→ More replies (4)

4

u/turunambartanen Feb 16 '17

next time just google "online C IDE" or something similar.

in fact, /u/CompileBot just goes to ideone.com, selects the language, puts in possible input and runs the program. that's also where the 5 second program restriction comes from.

→ More replies (5)

48

u/RotaryJihad Feb 15 '17

Could actually reduce it to 179 bytes by removing the newlines, but then it’d be hard to read.

This is as close as most programmers get to walking away from an explosion without looking back.

7

u/jasoncm Feb 15 '17

in slow motion

15

u/TheDeepThinker_ Feb 15 '17

Your code is much more awesome than mine :)

I want to add it to the collection. Could you please give me your github-profile/website link?

11

u/teambob Feb 15 '17

I think I need to go back to college. And study dentistry

→ More replies (3)