Cantor
Score: 36.18 (pass)
#!perl
s//-
/;eval's/./$& $&/g;'x pop;print
|
Score: 36.18 (pass)
Poor obfuscation attempt :-(
#!perl
s,,-
,,eval's,.,$& $&,g,'x pop,print
|
Score: 36.18 (pass)
Funny, but with the same score and the same tiebreaker (argh!) :-(
#!perl
s//-
/;s/./$& $&/gfor($_)x pop;print
|
Score: 37.14 (pass)
Eugene, do you remember this one? ;)
Ton gave me this idea... Ton, you talk too much! :-X
Anyway, it doesn't matter since I can't improve my score with it...
#!perl
$\="-
";s/./$& $&/gfor($\)x pop;print
|
Score: 38.17 (pass)
well, let's play with tiebreak!
#!perl
s//-
/;for$$(1..pop){s/./$& $&/g}print
|
Score: 38.20 (pass)
Thanks to tpr01 ton's solution...
#!perl
s//-
/;for$a(1..pop){s/./$& $&/g}print
|
Score: 39.21 (pass)
do _not_ abuse switches! :)
#!perl
$_="-
";for$a(1..pop){s/./$& $&/g}print
|
Score: 41.22 (pass)
#!perl -l
$_="-";for$a(1..pop){s/./$& $&/g}print
|
Score: 46.26 (pass)
of course.
#!perl -l
$_="-";for$a(1..pop){$_.=$"x y///c.$_}print
|
Score: 47.23 (pass)
perlvar rocks!
#!perl -l
$_="-";for$a(1..pop){s/$/$"x$-[0].$`/e}print
|
Score: 47.26 (pass)
this time it's worth it...
#!perl -l
$_="-";for$a(1..pop){$_.=' 'x y///c.$_}print
|
Score: 49.22 (pass)
#!perl -l
$_="-";$_.=' 'x y///c.$_ while$ARGV[0]--;print
|
Score: 50.20 (pass)
I should really have found it before!
#!perl -l
$_="-";s/$/" "x y!!!c.$`/ewhile$ARGV[0]--;print
|
Score: 53.17 (pass)
#!perl -l
$_="-";s/$/" "x length().$`/ewhile$ARGV[0]--;print
|
Score: 55.18 (pass)
#!perl -l
$_="-";s/$/" "x length($_).$`/ewhile$ARGV[0]--;print
|
Score: 55.22 (pass)
#!perl -l
$_="-";for$a(1..pop){s/$/" "x length($_).$`/e};print
|
Score: 56.20 (pass)
#!perl -l
$a=pop;$_="-";s/$/" "x length($_).$`/ewhile$a--;print
|
Score: 57.21 (pass)
#!perl -l
$a=pop;$_="-";s/$/" "x length($_).$`/e while$a--;print
|
Score: 68.24 (pass)
#!perl -l
$_="-"x 3**pop;s/(-+)\1\1/$1." "x length($1).$1/e while/--/;print
|
Score: 81.14 (fail)
Intersting, maybe I'll be able to gain more chars later with this...
#!perl -l
($;,$")=@ARGV;print+map{push@$,($ARGV[$|--])x($.=--$_?$$[$_]||$":$;);$.}1..pop
|
Score: 1503.11 (pass)
!!Check it!! Here's a _trilingual_ solution of the Cantor problem.
You are to remove the shebang line, I only put it because pgas want a
properly formatted shebang line.
Once the shebang line is cut out, you can run the program:
- in perl, just type:
$ perl cantor.pl
- in C, compile it with:
$ gcc cantor.c -o cantor
and run it:
$ ./cantor
- in Befunge, you'll need a Befunge interpreter (such as the one I
provide with the Language::Befunge module):
$ jqbf98 cantor.bf
#!perl
#undef fff /* n 50fp 00ep a9+y >#v_ 0> \ : #v_ $v
" ^ < ^+-0'\*a\<
v <
> 1ep > 1eg 0eg - v q,a _ v# ! - '<
0 v-'<
> ^ 2 v ,< |-4 < :
$ e ^ '< g
p \
|! - ' : g + ge0 e ge2 < pe30 pe0 +1 ge0 _ 1eg f+ > : 2eg : 1+ 2ep ^
> :4\ > :! #v_ 3eg :1+ 3ep 0eg f+ p v
> $ 2eg 1+ 2ep ^
^ <
*/ //";
#include
#define ARGV argv
#define ord
#define $ /*
$code = <<'FOO';
unshift @ARGV, "foo";
"*/
main (int argc, char *argv[]) //";
{
char $ buf[8192];
char $ tmp[8192];
int $ i, $ j, $ offset;
$ buf[0] = '2';
$ buf[1] = 0;
for( $ i = 0; $ i < atoi( $ ARGV[1] ) ; $ i++ ){
$ offset = 0;
for( $ j = 0; $ buf[$ j] != 0 ; $ j++) {
$ tmp[ $ offset++ ] = $ buf[$ j];
$ tmp[ $ offset++ ] = '1';
$ tmp[ $ offset++ ] = $ buf[$ j];
}
$ tmp[ $ offset ] = 0;
for( $ j = 0; $ tmp[$ j] != 0 ; $ j++) {
$ buf[$ j] = $ tmp[$ j];
}
}
for( $ i = 0; $ buf[$ i] ; $ i++ ){
printf("%s", (ord( $ buf[$ i] )== 50) ? "-" : " ");
}
printf("\n");
}
#define FOO /*
FOO
$code =~ s/atoi\(([^)]+)\)/$1/g;
$code =~ s/char//g;
eval $code;
"*/ //";
|
Score: 1523.11 (pass)
Eugene required #include
As always, remove the #!perl line (shebang) only there because of pgas...
#!perl
#undef fff /* n 50fp 00ep a9+y >#v_ 0> \ : #v_ $v
" ^ < ^+-0'\*a\<
v <
> 1ep > 1eg 0eg - v q,a _ v# ! - '<
0 v-'<
> ^ 2 v ,< |-4 < :
$ e ^ '< g
p \
|! - ' : g + ge0 e ge2 < pe30 pe0 +1 ge0 _ 1eg f+ > : 2eg : 1+ 2ep ^
> :4\ > :! #v_ 3eg :1+ 3ep 0eg f+ p v
> $ 2eg 1+ 2ep ^
^ <
*/ //";
#include
#define ARGV argv
#define ord
#include
#define $ /*
$code = <<'FOO';
unshift @ARGV, "foo";
"*/
main (int argc, char *argv[]) //";
{
char $ buf[8192];
char $ tmp[8192];
int $ i, $ j, $ offset;
$ buf[0] = '2';
$ buf[1] = 0;
for( $ i = 0; $ i < atoi( $ ARGV[1] ) ; $ i++ ){
$ offset = 0;
for( $ j = 0; $ buf[$ j] != 0 ; $ j++) {
$ tmp[ $ offset++ ] = $ buf[$ j];
$ tmp[ $ offset++ ] = '1';
$ tmp[ $ offset++ ] = $ buf[$ j];
}
$ tmp[ $ offset ] = 0;
for( $ j = 0; $ tmp[$ j] != 0 ; $ j++) {
$ buf[$ j] = $ tmp[$ j];
}
}
for( $ i = 0; $ buf[$ i] ; $ i++ ){
printf("%s", (ord( $ buf[$ i] )== 50) ? "-" : " ");
}
printf("\n");
}
#define FOO /*
FOO
$code =~ s/atoi\(([^)]+)\)/$1/g;
$code =~ s/char//g;
eval $code;
"*/ //";
|
Score: 1840.09 (pass)
Wow, I made it! Once again, for your eyes pleasure, here's a
_quadrilingual_ solution of the Cantor problem. :)
You are to remove the shebang line, I only put it because pgas want a
properly formatted shebang line.
Once the shebang line is cut out, you can run the program:
- in perl, just type:
$ perl cantor.pl
- in C, compile it with:
$ gcc cantor.c -o cantor
and run it:
$ ./cantor
- in Befunge, you'll need a Befunge-98 compliant interpreter (such as
the one I provide with the Language::Befunge module):
$ jqbf98 cantor.bf
- in BrainFuck, I had to adapt a little, since Brainfuck does not
support command-line arguments. So run it through:
$ echo | aidbf kola.bfk
where aidbf is the BrainFuck interpreter that you can download here:
http://ailis.de/~k/projects/aidbf/aidbf-0.1.tar.gz
please note that I'm using non-buffered I/O
Have fun! :)
#!perl
#undef fff /*^>,--------------------------------------------
"---->>+++++++++++++++++++++++++++++++++++++++++++++<<[[>>[>
]>+<<[<]<-]>>[[>]>>>[>]+>++++++++++++++++++++++++++++++++>+[
<]<<<<[<]>[[>]>>>[>]<+<<+[<]<<<<[<]>-]>[>]>>>[>]<-<<-[<]<<<<
[<]>]>>-]>>[.>][-]++++++++++.[-][
*/ //";
#include
#define ARGV argv
#define ord
#include
#define $ /*
$code = <<'FOO';
unshift @ARGV, "foo";
"*/
main (int argc, char *argv[]) //";
{
char $ buf[8192];
char $ tmp[8192];
int $ i, $ j, $ offset;
$ buf[0] = '2';
$ buf[1] = 0;
for( $ i = 0; $ i < atoi( $ ARGV[1] ) ; $ i++ ){
$ offset = 0;
for( $ j = 0; $ buf[$ j] != 0 ; $ j++) {
$ tmp[ $ offset++ ] = $ buf[$ j];
$ tmp[ $ offset++ ] = '1';
$ tmp[ $ offset++ ] = $ buf[$ j];
}
$ tmp[ $ offset ] = 0;
for( $ j = 0; $ tmp[$ j] != 0 ; $ j++) {
$ buf[$ j] = $ tmp[$ j];
}
}
for( $ i = 0; $ buf[$ i] ; $ i++ ){
printf("%s", (ord( $ buf[$ i] )== 50) ? "-" : " ");
}
printf("\n");
}
#define FOO /*
FOO
$code =~ s/atoi\(([^)]+)\)/$1/g;
$code =~ s/char//g;
eval $code;
__DATA__
> n 50fp 00ep a9+y >#v_ 0> \ : #v_ $v
^ < ^+-0'\*a\<
v <
> 1ep > 1eg 0eg - v q,a _ v# ! - '<
0 v-'<
> ^ 2 v ,< |-4 < :
$ e ^ '< g
p \
|! - ' : g + ge0 e ge2 < pe30 pe0 +1 ge0 _ 1eg f+ > : 2eg : 1+ 2ep ^
> :4\ > :! #v_ 3eg :1+ 3ep 0eg f+ p v
> $ 2eg 1+ 2ep ^
^ <
^ <]*/
|