mirror of
https://github.com/PoetryInCode/1337cc.git
synced 2025-04-19 11:27:14 -04:00
Its finished! Muahahaha!!! Maybe?
This commit is contained in:
parent
5327fbce63
commit
2cd361ef5b
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
./main
|
||||
|
||||
./main.c
|
||||
|
||||
./primes
|
||||
|
||||
./primes.c
|
28
1337cc.pl
28
1337cc.pl
@ -5,6 +5,13 @@ use warnings;
|
||||
my $vowel = qr/[aeiou]/;
|
||||
my $cons = qr/[bcdfghjklmnpqrstwxz]/;
|
||||
|
||||
sub fixbin {
|
||||
my $bin = $1;
|
||||
$bin =~ tr/il/1/;
|
||||
$bin =~ tr/o/0/;
|
||||
return $bin
|
||||
}
|
||||
|
||||
while (<>) {
|
||||
# Step 1: Get stupid macros out of the way (substitutions)
|
||||
s/\|-\|/h/g;
|
||||
@ -16,9 +23,9 @@ while (<>) {
|
||||
s/\b0([0-7]+)\b/__OCT[$1]OCT__/g;
|
||||
|
||||
# Convert it to binary
|
||||
s/__OCT\[(.*)\]OCT__/"__BIN[" . sprintf("%b", oct($1)) . "]BIN__"/eg;
|
||||
s/__OCT\[(.*?)\]OCT__/"__BIN[" . sprintf("%b", oct($1)) . "]BIN__"/eg;
|
||||
|
||||
tr/0574v3/ostaue/;
|
||||
tr/0574v36/ostaueb/;
|
||||
|
||||
# We guess wether its an "i" or an "l" based on common english patterns
|
||||
if (/\b1($cons)/) {
|
||||
@ -33,16 +40,13 @@ while (<>) {
|
||||
s/1/l/;
|
||||
}
|
||||
|
||||
if (/__BIN\[(.*?)\]BIN__/) {
|
||||
tr/li/1/;
|
||||
tr/o/0/;
|
||||
}
|
||||
|
||||
s/__BIN\[([01]+)\]BIN__/0b$1/g;
|
||||
|
||||
s/1/i/g;
|
||||
|
||||
open my $cmd, "|-", "gcc -E -" or die "Failed: $!";
|
||||
print $cmd $_;
|
||||
close $cmd;
|
||||
# Fix the binaries after they got mangled by 1 translations
|
||||
s/__BIN\[(.*?)\]BIN__/ my $bin = fixbin($1); "__BIN[$bin]BIN__"/eg;
|
||||
|
||||
# Convert them back into a C-friendly format
|
||||
s/__BIN\[([01]+)\]BIN__/0b$1/g;
|
||||
|
||||
print $_
|
||||
}
|
||||
|
14
Makefile
Normal file
14
Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
1337CC=./1337cc.pl
|
||||
|
||||
all: build
|
||||
|
||||
./primes.c: ./pr1m35.c1337
|
||||
$(1337CC) <$< >$@
|
||||
|
||||
./main.c: ./m41n.c1337
|
||||
$(1337CC) <$< >$@
|
||||
|
||||
./primes: ./primes.c
|
||||
./main: ./main.c
|
||||
|
||||
build: ./main ./primes
|
22
pr1m35.c1337
Normal file
22
pr1m35.c1337
Normal file
@ -0,0 +1,22 @@
|
||||
#1nc1vd3 <57d10.|-|>
|
||||
|
||||
#d3f1n3 m4x 0144
|
||||
|
||||
1n7
|
||||
m41n()
|
||||
{
|
||||
1n7 4 = m4x;
|
||||
f0r(1n7 1=01; 1<4; 1++) {
|
||||
1n7 pr1m3 = 01;
|
||||
f0r(1n7 x=02; x*x<=1; x++) {
|
||||
1f(1%x == 00) {
|
||||
pr1m3 = 00;
|
||||
6r34|<;
|
||||
}
|
||||
}
|
||||
|
||||
1f(pr1m3) {
|
||||
pr1n7f("\7%1\n", 1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user