Jow Forumsoccc

Jow Forums obfuscated C code contest

Following the ancient ioccc.org tradition, I thought this would be a fun thing to try in Jow Forums.
For those of you who may not be familiar with it, the ioccc consists in writing the most obscure/obfuscated C code possible. To change it up a bit, I decided to make it the following way: A task will be given (i.e print the time) and you have to obfuscate that, so that we can compare results and see who is the most original.

A comment:
This is NOT a code golf (making the shortest code possible), although that is also welcome if it obfuscates the code.

RULES:
Submitted code must be made in C99 or earlier versions of the language
Submitted code MUST COMPILE with gcc file.c
Submitted code can have warnings of any kind as long as it compiles
The program CAN CRASH if the appropriate input arguments are not supplied
Code must succesfully perform the task in hand (obviously)
Code must be under 4096 bytes (Jow Forums post limit reasons)
Code must not use Windows-specific headers (#include )
Macros are ALLOWED

THE TASK:
Make a program that checks whether two given strings (via CLI ARGUMENTS) are an anagram (two words have the EXACT SAME letters in different order), and prints whether its an anagram or not via stdout. Example:
restful - fluster: anagram
funeral - real fun: NOT anagram (second word has a space)
forty five - over fifty: anagram

Example program (output doesnt have to be exactly like this):
$./ana restful fluster
anagram: yes

Attached: ioccc.jpg (429x665, 111K)

Other urls found in this thread:

pastebin.com/c6uUsCzx
twitter.com/SFWRedditGifs

bump

I am going to steal from ioccc

leggo

#include #include #define z while #define y for int main(int argc, char **argv) { int c = 0; int d[26] = {0}; int e[26] = {0}; z (argv[1][c] != '\0') { d[argv[1][c]-'a']++; c++; } c = 0; z (argv[2][c] != '\0') { e[argv[2][c]-'a']++; c++; } y (c = 0; c < 26; c++) { if (d[c] != e[c]) { puts("anagrams.\n"); _Exit(0); } } puts("not anagrams.\n"); _Exit(0); }

not work :(

just ascii?

yeah, otherwise c-strings wouldn't work as arguments

like i don't have anything better to do
enjoy your dead thread op

I gave up because it's starting to get tedious and boring but here is a partial solution. All that's left to do is to sum the results at *b to see if it's zero so it knows whether to branch to x or y.

#include


c(char*d,int e) {
f: if(*(d++))e++;else return e;
goto f;
}

main(int a,char**b) {

if(!(c(*b+1,0)^c(*(b+2),0)))goto x;
*b=calloc(26);
h: if(a=*(b+1))goto i;*b[(*(b+1)++)-'a']++;goto h;
i: a=c(*(b+2),0);
j: if(a-->0)goto k;*b[(*(b+2)++)-'a']--;goto j;
k:

x: puts("anagram: no");goto z;
y: puts("anagram: yes");
z: free(*b);return 0;
}

Here's a simple "Hello World" in C.

main(a,b,c) {a-=a;b-=b;c-=c;a=-~c;c=-~b;b=-~a;c*=b;b+=b;c*=b;b+=b;b+=b;b+=b;b+=b;b+=c;putchar(b);b-=c;b+=b;b-=c;b-=c;b-=c;b-=a;b-=a;b-=a;putchar(b);b+=c;b-=a;putchar(b);putchar(b);b+=a;b+=a;b+=a;putchar(b);a-=a;b-=b;c-=c;a=-~c;c=-~b;b=-~a;c*=b;b+=b;c*=b;b+=b;b+=b;b+=b;putchar(b);b+=b;b+=c;b+=c;b+=c;b-=a;putchar(b);c+=a;c+=a;b+=c;b+=c;b+=a;b+=a;b+=a;b+=a;putchar(b);a=-~a;c/=a;a=~-a;c-=a;b+=c;b-=a;putchar(b);c*=c;b-=c;a=-~a;c/=a;b+=c;b+=a;putchar(b);b-=c;putchar(b);a-=a;b-=b;c-=c;a=-~c;c=-~b;b=-~a;c*=b;b+=b;c*=b;b+=b;b+=b;b-=c;b+=a;b+=a; putchar(b);}

Well, color me retarded. I jumped the gun, thinking this was just an obfuscated C general. Completely missed the prompt.

its okay :) thats a nice hello world lol

>tfw not at home and can't join now
Wait for me guys

Bumping so this doesn't die while I obfuscate the shit out of a 10-line file.

now do fizzbuzz

rate
#include
#define i int
#define c char
void main(i _,c*__[]) {
i m[]={33752327,185405715,387784485,690695989,993870663,1229935449,1634035563};
c*d=(c*)m;i a=1,b=1,e=0;while(1[__][e]&&2[__][e]){a*=d[(e[__[1]]|0x20)-0x61];
b*=d[(__[2][e++]|0x20)-0x61];}putchar(!(a-b)+48);
}


bonus points: case insensitive

awesome, best one by far

>void main
0/10

still dont understand how this works after 10 mins lol, here's a more readable version:

void main(int argc,char*argv[]) {
int m[]={33752327,185405715,387784485,690695989,993870663,1229935449,1634035563};
char* d = (char*)m;
int a=1,b=1,e=0;

while(argv[1][e] && argv[2][e]) {
a *= d[(argv[1][e] | 0x20)-0x61];
b *= d[(argv[2][e] | 0x20)-0x61];
e++;
}
putchar(!(a-b)+48);
}

btw, I think the program fails with different lengths. ex:
./ana ana naan
gives 1

This, except I'm phoneposting from bed

ok I understand now lol, you set the bit corresponing to the case in ascii and then you subtract the index, and multiply it by a unique number in the array (7 ints = 7 * 4 = 28) and because mult is commutative you check the result being the same at the end

You don’t need to bump in Jow Forums

Not just unique numbers, but prime numbers. Fundamental theorem of arithmetic states that a product of primes gets you a unique number that's only divisible into those prime numbers. And thanks to the conmutative property, we can multiply these numbers in any order. So two words having the same letters in any order will always produce the same number.

>first year comp sci busy work project
nypa

Bump

Not the task given, but:
pastebin.com/c6uUsCzx
Here's the funny part: It wasn't meant to be obfuscated.
It's shitty code I wrote ages ago as a beginner.

that's really fucking smart

Enterprise tier code

bump