|
![]() |
#1 |
FFR Simfile Author
![]() ![]() |
![]() Alternate subtitle: Ruby is small, Java is hueg
Here's the site: http://golf.shinh.org/ It's pretty simple, write code that produces the correct output for each input and make it as short as possible; your score is equal to the number of bytes in your program and, like golf, the lower the better. It has interpreters for a ridiculous number of languages (c,java,python,ruby,php,even befunge) so if you already know how to code yours is probably supported. I've been dabbling in a bit, only know Java though so all my solutions are enormous, haha. I don't mind though because it's all relative, and if I can make things short in Java I'm learning the same type of thinking I'll need for terseness in any language. The oldest problems are at the top, the newest are at the bottom. You can submit to any of them but you may as well start with the newest or any that catch your eye. You can add your own problems, but for the love of god don't screw up the sample input/output. Also, make sure at least one of the samples requires a large amount of output compared to how much you'll need to write for a valid solution so that an 'embedded' program where the output is hardcoded isn't the shortest way. To start things off, here's my definitely-not-optimal solution for 'numof 1 bits in 0 to 255' using java: Code:
class A{public static void main(String[]a){for(int i=0,j,k,l=256;i<l;i++){k=0;for(j=1;j<l;j*=2){if((i&j)>0)k++;}System.out.print(k);}}}
__________________
Patashu makes Chiptunes in Famitracker: http://soundcloud.com/patashu/8bit-progressive-metal-fading-world http://img.photobucket.com/albums/v216/Mechadragon/smallpackbanner.png Best non-AAAs: ERx8 v2 (14-1-0-4), Hajnal (3-0-0-0), RunnyMorning (8-0-0-4), Xeno-Flow (1-0-0-3), Blue Rose (35-2-0-20), Ketsarku (14-0-0-0), Silence (1-0-0-0), Lolo (14-1-0-1) http://i231.photobucket.com/albums/ee301/xiaoven/solorulzsig.png |
![]() |
![]() |
![]() |
#2 |
FFR Player
Join Date: Nov 2005
Age: 34
Posts: 853
|
![]() I made yours shorter instead of looking at the site, but only by two characters:
Code:
class A{public static void main(String[]a){for(int i=0,j,k,l=256;i<l;i++){k=0;for(j=1;j<l;j*=2)if((i&j)>0)k++;System.out.print(k);}}}
__________________
www.freerice.com |
![]() |
![]() |
![]() |
#3 |
FFR Simfile Author
![]() ![]() |
![]() Ooh, thanks.
EDIT: Also, I undid an earlier attempt that added two bytes (allocating 256 to a variable, l) so now it's at 131: Code:
class A{public static void main(String[]a){for(int i=0,j,k;i<256;i++){k=0;for(j=1;j<256;j*=2)if((i&j)>0)k++;System.out.print(k);}}}
__________________
Patashu makes Chiptunes in Famitracker: http://soundcloud.com/patashu/8bit-progressive-metal-fading-world http://img.photobucket.com/albums/v216/Mechadragon/smallpackbanner.png Best non-AAAs: ERx8 v2 (14-1-0-4), Hajnal (3-0-0-0), RunnyMorning (8-0-0-4), Xeno-Flow (1-0-0-3), Blue Rose (35-2-0-20), Ketsarku (14-0-0-0), Silence (1-0-0-0), Lolo (14-1-0-1) http://i231.photobucket.com/albums/ee301/xiaoven/solorulzsig.png Last edited by Patashu; 04-22-2009 at 04:21 AM.. |
![]() |
![]() |
![]() |
#4 |
I am leonid
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 35
Posts: 8,080
|
![]() Dude, that's way too nerdy.
![]() |
![]() |
![]() |
![]() |
#5 |
The Chill Keeper
![]() |
![]() Oh wow. This is awesome!
|
![]() |
![]() |
![]() |
#6 |
FFR Simfile Author
![]() ![]() |
![]() it's okay, I teach advanced theory about placing coloured arrows to music and then play them, I already have my nerd quotient filled out
__________________
Patashu makes Chiptunes in Famitracker: http://soundcloud.com/patashu/8bit-progressive-metal-fading-world http://img.photobucket.com/albums/v216/Mechadragon/smallpackbanner.png Best non-AAAs: ERx8 v2 (14-1-0-4), Hajnal (3-0-0-0), RunnyMorning (8-0-0-4), Xeno-Flow (1-0-0-3), Blue Rose (35-2-0-20), Ketsarku (14-0-0-0), Silence (1-0-0-0), Lolo (14-1-0-1) http://i231.photobucket.com/albums/ee301/xiaoven/solorulzsig.png |
![]() |
![]() |
![]() |
#7 |
davai
![]() Join Date: Dec 2006
Age: 33
Posts: 2,765
|
![]() Interesting, I'll try my hand at a few later today.
I will probably end up using C# because I'm a fail boat. |
![]() |
![]() |
![]() |
#8 |
FFR Player
|
![]() dammit, miranda isn't supported
just to show how cheap miranda is for this, the first one is Code:
p="Hello, world!"
__________________
Last edited by Tokzic: Today at 11:59 PM. Reason: wait what |
![]() |
![]() |
![]() |
#9 |
Everybody gets one.
![]() Join Date: Jul 2006
Location: Fuckin space bro
Posts: 1,008
|
![]() What in the God forsaken hell is this?
|
![]() |
![]() |
![]() |
#10 |
FFR Player
![]() |
![]() ^ I lol'd
This really is ridiculous |
![]() |
![]() |
![]() |
#11 |
No fucks
![]() Join Date: Dec 2006
Location: Everywhere
Posts: 2,440
|
![]() I wanna be a nerd!!
Code:
shutdown -s -t 2 -c "Hi Patashu" |
![]() |
![]() |
![]() |
#12 |
FFR Player
![]() |
![]() Code:
lol |
![]() |
![]() |
![]() |
#13 |
Network Security Analyst
![]() ![]() |
![]() This is cool, but I hate programming. After working in assembly, I hope to never have to work with it again.
|
![]() |
![]() |
![]() |
#14 |
FFR Player
Join Date: Mar 2008
Posts: 479
|
![]() Purely awesome, I'll try my hand at it...
__________________
=__=' My sig was 22 pixels too tall, so this is here instead... |
![]() |
![]() |
![]() |
#15 |
davai
![]() Join Date: Dec 2006
Age: 33
Posts: 2,765
|
![]() I tried my hand at the Hexagon problem, but I finished at 80 lines (not stacked, but rofl massive), and with it being very inefficient.
EDIT: How do I shot algorithms. Last edited by Kekeb; 04-22-2009 at 06:24 PM.. |
![]() |
![]() |
![]() |
#16 |
FFR Simfile Author
![]() ![]() |
![]()
It's tricky, but you should be able to express its arithmetic in just a few nested functions, abusing % and substrings and stuff
__________________
Patashu makes Chiptunes in Famitracker: http://soundcloud.com/patashu/8bit-progressive-metal-fading-world http://img.photobucket.com/albums/v216/Mechadragon/smallpackbanner.png Best non-AAAs: ERx8 v2 (14-1-0-4), Hajnal (3-0-0-0), RunnyMorning (8-0-0-4), Xeno-Flow (1-0-0-3), Blue Rose (35-2-0-20), Ketsarku (14-0-0-0), Silence (1-0-0-0), Lolo (14-1-0-1) http://i231.photobucket.com/albums/ee301/xiaoven/solorulzsig.png |
![]() |
![]() |
![]() |
#17 |
FFR Player
|
![]() <h1>Do i win?</h1>
EDIT: wait no this // do i win now?
__________________
Last edited by chidori!; 04-22-2009 at 06:09 PM.. |
![]() |
![]() |
![]() |
#18 |
FFR Player
|
![]() I only know a little bit of Java.
I'm more fluent in VB... so, yeah, I'll just leave this thread before I get humiliated...
__________________
![]() Twilight Sparkle's Ponyville Group ![]() Thanks justin_ator and megamon88 for making my sig 20% cooler. |
![]() |
![]() |
![]() |
#19 |
Snek
![]() ![]() Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
![]() I might try it for c#.
|
![]() |
![]() |
![]() |
#20 |
FFR Player
Join Date: Mar 2008
Location: North
Age: 33
Posts: 263
|
![]() quite interesting, tho it makes me feel like a total noob.
*pretends he knows 'code speak'... |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|