Forgot your password?
typodupeerror
User Journal

Journal: Username switch

Journal by Spy Hunter

I haven't posted anything in a while, and that's because I decided to be modeless instead. But now I think I'll switch back. This account has a lot of history. I'll keep using modeless elsewhere (on Digg, for example), but on Slashdot I'll be Spy Hunter.

In case for some reason you desire more information about my nick choice, here's the deal: I chose Spy Hunter as a reference to the original game, specifically the Commodore 64 version. Since the release of the Spy Hunter remake games, this nick has gotten more popular and I can't get it most places, so I wanted something less common as my online persona.

Modeless is a user-interface term. I always prefer modeless dialog boxes over modal ones, and I can't stand it when dialogs are modal for no good reason. For instance, web browser option dialogs which lock the window used to open them, though every other browser window continues to work just fine. Plus modeless is not in most dictionaries and not already registered at most sites, except hotmail. I think everything has been registered at hotmail.

User Journal

Journal: sig update 1

Journal by Spy Hunter
Thanks largely to Alsee, the size of the code snippet has been reduced again, to 73 characters this time (not counting the slashcode-mandated space that can be removed):

main(c,r){for(r=32;r;) printf(++c>31?c=!r--,"\n":c<r?" ":~c&r?" `":" #");}

It's still a complete self-contained C program, ready for compilation.

I also tried the following (to move the first space closer to the middle to thwart slashcode's evil inserted space):

main(c,r){for(r=32;r;)printf(++c<32?c<r?" ":~c&r?" `":" #":c=!r--,"\n");}

But unfortunately, that version doesn't compile on either GCC or VS.NET. I'm not sure exactly why this version is different. To me it seems like either both should compile, or neither should. Which is it?

OK, I'm thinking this is about it. Maybe one more character can be optimized out somehow, but I can't believe there are any significant optimizations left to do here. Somebody prove me wrong.

User Journal

Journal: new new .sig

Journal by Spy Hunter
Yeah, so I finally found a new sig I think is cool. First person to figure out what it does gets a free lollipop!

for(int r=-1,c=0;r!=38;c++){if(c>r){r++;printf("\n"); for(c=38;c!=r;c--)printf(" ");c=0;}printf(~r&c?" `":" #");}

So of course it needs to be in a file to be compiled. You have to include stdio.h and make a main function, so the whole file is like so:

#include <stdio.h>
int main()
{
for(int r=-1,c=0;r!=38;c++){if(c>r){r++;printf("\n"); for(c=38;c!=r;c--)printf(" ");c=0;}printf(~r&c?" `":" #");}
}

Then simply compile with "g++ -o foo foo.cpp" and run. (It is actually C++ code, not C, due to the variable declaration inside the for statement, which is illegal in C.) I think it's a pretty neat example of compressed code. I actually have an even shorter version but due to Slashdot .sig limits it wouldn't fit in the sig box (when converted to HTML it has more than 120 chars due to all the <> signs).

for(int r=-1,c=0;r<65;c++){if(c>r){r++; cout<<endl;for(c=65;c>r;c--)cout<<' ';c=0;}cout<<(~r&c?" `":" #");}

That's 106 characters of C++ code (without the space in between r++; and cout<<endl required by Slashcode). If anyone can figure out how to make it smaller, I want to know about it.

Update (2/15/04): The input of several slashdotters has led to the following new extremely short (82 characters) pure C version, which as a bonus can be compiled as-is, no extra wrapping required:

main(r,c){for(r=-1,c=0;r<39;c++)printf(c<0?" ":c>r?c=r++-38,"\n":~r&c?" `":" #");}

Thanks to joe_bruin and another slashdotter whose post I have lost. I'm still not convinced this is the absolute smallest it can be, so we'll see if anyone else can improve it.

User Journal

Journal: new .sig 2

Journal by Spy Hunter
Hmmmm. Let's see what kind of moderation this .sig gets me :-)
_______________________
"You should do what God says because God will torture you otherwise"
User Journal

Journal: Obligatory first journal entry

Journal by Spy Hunter
Testing, testing, 1,2,3. Hello? Is this thing on? [tap tap tap]

Oh! Ahem.

Yeah, so this is my first journal entry, just like every other first journal entry, just to prove I can do it. Exciting, huh?

Well, since you came to the trouble of visiting, I'll at least give you an interesting link or two for your time. Try out How Stuff Works and Sodaplay if you haven't already. You'll thank me later.

You could also visit the website of my college even though I don't think it's particularly interesting.

People are always available for work in the past tense.

Working...