Beginners Brevity Contest: BUZZ

Online C++ programming contests.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard, raimo

Postby Safari » Fri Sep 30, 2005 7:35 am

Corsix wrote:Daryll, can you state if entries that rely on the one milion limit are valid?

Maybe we could split this up. Those entries that are made of hyper strings should compete internally.

I think Darryl should make an ultimate solution, one that contains the best parts from the entries :wink:
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby Darryl » Fri Sep 30, 2005 8:12 am

I am only going to test to 1 million, since it's so late in the game and that's what I said early on. So basically I will take a don't ask, don't tell stance on it, but, it would be idea if the entries ran to INT_MAX and I may still publish a separate list of those that do. (Sort of as gamma suggest with the two categories).

For future reference though, IMHO, I think the hyper-string lookups are getting out of hand and before I hold another brevity contest, I think maybe it should be discussed. I can cleary see what led to the rules about the lookup-tables. While I think banning switch statements / small lookups are a bit restrictive, hyper-strings I feel are good candidates for banning. Honestly, what I would like to see is a new token counter that takes into account for long strings. My suggestion would be every 80 chars counts as 1 token. After all a 25 meg source file hardly qualifies as brief.
User avatar
Darryl
 
Posts: 1342
Joined: Wed Sep 01, 2004 10:50 am
Location: Cayman Islands

Postby Emery » Fri Sep 30, 2005 8:21 am

My suggestion would be every 80 chars counts as 1 token. After all a 25 meg source file hardly qualifies as brief.
I think you should just make each character in the string a token.
--~~~~
User avatar
Emery
 
Posts: 4313
Joined: Sat Mar 19, 2005 9:16 am

Postby Togra » Fri Sep 30, 2005 9:13 am

80 chars == 1 token... I like that ratio. This madness should end indeed!
Nonetheless, I'm sending you a 77 token solution.

I'll spend some more time in my clean solution, which is now 107 tokens (pff!), uses a little table of about 150 chars, and can ofcourse go beyond 1 million.
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby Safari » Fri Sep 30, 2005 10:52 am

Togra wrote:I'll spend some more time in my clean solution, which is now 107 tokens (pff!), uses a little table of about 150 chars, and can ofcourse go beyond 1 million.

Wooot, I'm just 2 tokens behind you (your clean and my clean version)?!... Can you feel my breath? I'm coming :p

How many tokens are BeerHunter at?And RITZ, have you pulled off? Lol, doing this contest and math at the same time really stimulates the brain :D


Edit: hmmm, I've improved all aspects of my code from the start to now, all things have been done to this ultimate condition (well, as ultimate as I can) except the part that checks if it should return buzz or the number. But now only that part is left, and there's no chanse I'll be able to improve it. I guess you win Togra (bah, you will probably, before the contest is over, get even lower tokens). :wink:
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby Emery » Fri Sep 30, 2005 11:09 am

Safari wrote:And RITZ, have you pulled off?
Too busy. After hours and still juggling between 122 working(I think) and 105ish not working I realised it would take alot longer than I originally anticipated. You'll see what I've been busy with soon. I'm going to post here when I release beta.

I stopped after remembering you can do "direction=-direction" instead of "direction |= (~direction & 0x80000000)" .......... >.> yeah, that illustrates the point rather well.

I was running a brute forcer for days on my server to find patterns between all number < a million that fit (!counter%7 || !counter%11 || str.find("7")) in hopes of using some magic.
--~~~~
User avatar
Emery
 
Posts: 4313
Joined: Sat Mar 19, 2005 9:16 am

Postby Safari » Fri Sep 30, 2005 11:23 am

C'mon, the last day. You must give it a try.
RITZ wrote:I stopped after remembering you can do "direction=-direction" instead of "direction |= (~direction & 0x80000000)" .......... >.> yeah, that illustrates the point rather well.

hehe, the "direction-solution". I had that one too, it was 20 tokens ago :wink:

And this part:

Code: Select all
(!counter%7 || !counter%11 || str.find("7"))

Is very much how mine looks like (with some adjustments). I'm dying to see how others have solved this part.

I've looked for so many patterns in so many different bases :x
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby Safari » Fri Sep 30, 2005 11:49 am

Monolog:
Safari wrote:Edit: hmmm, I've improved all aspects of my code from the start to now, all things have been done to this ultimate condition (well, as ultimate as I can) except the part that checks if it should return buzz or the number. But now only that part is left, and there's no chanse I'll be able to improve it. I guess you win Togra (bah, you will probably, before the contest is over, get even lower tokens). :wink:

Shut up!
I made this really REALLY, REALLY ugly thing with the code, BUT:

tokens -= 2

That means I'm at ... tamtamtam ... 107 and 96 tokens

I know I shouldn't say that because now Togra will do everithyng in his power to beat me, and I wouldn't have a chanse. But I cant help my self :wink:
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby Emery » Fri Sep 30, 2005 11:57 am

Safari wrote:I've looked for so many patterns in so many different bases
I did come up with one thing. Instead of (str.find("7") != string.npos) you should be able to do (!string.find("7")+1) because string.npos is 0xffffff so if it is returned, +1 will integer overflow and default to 0. It would then be best to change the polarity of that whole if statement and remove the not operators.
--~~~~
User avatar
Emery
 
Posts: 4313
Joined: Sat Mar 19, 2005 9:16 am

Postby gamma » Fri Sep 30, 2005 1:34 pm

Togra wrote:I suck at timezones.
EST = GMT - 5, right now it's about 1PM GMT, so the deadline is in 16 hours?? (= 5AM GMT = 7AM in The Netherlands). Please correct me if I'm wrong.
Behold the power of command line utils:
Commandline function date wrote:gamma@fear:~$ date --date="September 30, 2005 11:59PM EST"
Sat Oct 1 06:59:00 CEST 2005
That is Central European Summer Time.

Commandline function date wrote:gamma@fear:~$ date --date="September 30, 2005 11:59PM EST" --utc
Sat Oct 1 04:59:00 UTC 2005
UTC (GMT) version
while (true){sleep(28800);work(57600);}
"Free" as in speech is so much better than "free" as in beer.
User avatar
gamma
 
Posts: 178
Joined: Mon Dec 01, 2003 9:16 am
Location: The Netherlands

Postby Darryl » Fri Sep 30, 2005 1:38 pm

RITZ wrote:
Safari wrote:I've looked for so many patterns in so many different bases
I did come up with one thing. Instead of (str.find("7") != string.npos) you should be able to do (!string.find("7")+1) because string.npos is 0xffffff so if it is returned, +1 will integer overflow and default to 0. It would then be best to change the polarity of that whole if statement and remove the not operators.


Instead of using string::npos, you could just use the literal value:
str.find("7")!=4294967295
User avatar
Darryl
 
Posts: 1342
Joined: Wed Sep 01, 2004 10:50 am
Location: Cayman Islands

Postby gamma » Fri Sep 30, 2005 1:42 pm

Darryl wrote:str.find("7")!=4294967295
Or strchr(c_string, '7'). It returns 0 (NULL actually) if it does not contain 7, so you can use the outcome as a boolean. Might save a(nother) token.
while (true){sleep(28800);work(57600);}
"Free" as in speech is so much better than "free" as in beer.
User avatar
gamma
 
Posts: 178
Joined: Mon Dec 01, 2003 9:16 am
Location: The Netherlands

Postby gamma » Fri Sep 30, 2005 1:53 pm

RITZ wrote:I stopped after remembering you can do "direction=-direction"...
If you know 'direction' can be only 1 or -1, you can even save a token here!
while (true){sleep(28800);work(57600);}
"Free" as in speech is so much better than "free" as in beer.
User avatar
gamma
 
Posts: 178
Joined: Mon Dec 01, 2003 9:16 am
Location: The Netherlands

Postby Emery » Fri Sep 30, 2005 2:05 pm

gamma wrote:
RITZ wrote:I stopped after remembering you can do "direction=-direction"...
If you know 'direction' can be only 1 or -1, you can even save a token here!
You have to go in the opposite direction that you are currently going.


str.find("7")!=4294967295 is one more token than str.find("7")++
--~~~~
User avatar
Emery
 
Posts: 4313
Joined: Sat Mar 19, 2005 9:16 am

Postby gamma » Fri Sep 30, 2005 2:10 pm

RITZ wrote:
gamma wrote:
RITZ wrote:I stopped after remembering you can do "direction=-direction"...
If you know 'direction' can be only 1 or -1, you can even save a token here!
You have to go in the opposite direction that you are currently going.
Yes, but what I'm saying is that when you denote one direction by -1 and one by +1, then you can save a token on the code "direction=-direction". It can be done in three tokens.
while (true){sleep(28800);work(57600);}
"Free" as in speech is so much better than "free" as in beer.
User avatar
gamma
 
Posts: 178
Joined: Mon Dec 01, 2003 9:16 am
Location: The Netherlands

PreviousNext

Return to Contests

Who is online

Users browsing this forum: No registered users and 1 guest