Player (201)
Joined: 7/6/2004
Posts: 511
I think it would be very difficult to figure out what it does without running it. Also I did not come up with this on one my own. There were others who have made really short programs to do this, but I just made it shorter (by about 20 characters). It would be interesting to try and see which language can do it in the shortest, because it certainly isn't c.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Former player
Joined: 3/19/2004
Posts: 710
Location: USA
Hehe. I was certainly planning on running it. I'm not that crazy. :p Anyway, what do you mean by shortest? Is that before compiling or after? If its the first, I can make a zero byte program that does it in my own language :) Edit: What language is it btw? Its not c.
Player (201)
Joined: 7/6/2004
Posts: 511
I mean shortest before compiling. There are some really short assembly programs that do this though. How can you make a zero byte program that does anything? It is c, although it breaks a few rules it still compiles under gcc.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Former player
Joined: 3/19/2004
Posts: 710
Location: USA
I didn't say it was in c. You said c wasn't the best, and I agree. I can make a language where if the program is blank, it just happens to output the same binary that yous does when compiled. I just have to write my own compiler. Mostly consisting of: if(program_is_blank) filewrite(binary_that_your_program_makes) else printf("Syntax Error"); See? A zero line program would make your exact program when compiled. Maybe you should be more specific next time. :) Anyway, I didn't try and compile, but it seems wrong. How can you printf without including any libraries? Oh, and this is horribly off topic. So, to keep it on topic, why hasn't anyone purchased me some controllers yet??
Player (67)
Joined: 3/11/2004
Posts: 1058
Location: Reykjaví­k, Ísland
why hasn't anyone purchased me some controllers yet??
Maybe you've been too naughty this year.
Player (201)
Joined: 7/6/2004
Posts: 511
Oh true I realized that after I posted, so lets say whats the best language that is standard. You can just do printf without any libraries because some libraries are automatically linked in even if you don't include them. Try making a program that is simply nothing main(){} for me it is 11kb, that is almost all from automattically linked libraries. I don't know why it works this way though. I would say its still good practice to include stdio.h anyways. Sorry about off topic also.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Joined: 5/31/2004
Posts: 464
Location: Minnesota
Hey I am glad you got your controllers. I am very happy with mine. I have been playing River City Ransom SERIOUSLY! Sorry to invade on your big code debate. :-P
JXQ's biggest fan.