Gamma's Code Brevity Contest

Online C++ programming contests.

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

Postby Darryl » Tue Feb 08, 2005 7:27 am

Beer Hunter wrote:
gamma wrote:3 in base 10 is 000 in base 1. Seems well-defined to me.
There's a zero in the ones column, a zero in the next ones column, and a zero in the third and final ones column. Still only sums to zero…


Lets count backwards from 3
3- 000
2- 00
1- 0
0- wtf?

8)
User avatar
Darryl
 
Posts: 1342
Joined: Wed Sep 01, 2004 10:50 am
Location: Cayman Islands

Postby gamma » Tue Feb 08, 2005 7:30 am

Darryl wrote:<snip>
Lets count backwards from 3
3- 000
2- 00
1- 0
0- wtf?
8)
Yes, my apologies. It doesn't make sense. My f*ckup. I imagined that the numbers of zeroes was the number you want so 3="000" and 0="". Have a good luagh about it :wink:
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 Togra » Tue Feb 08, 2005 7:48 am

Can we post our code now? Canwe-canwe-canwe? :)
BTW this thread should be splitted.

Back ontopic: we had lots of Obfuscated Code Contests, I never participated but had fun reading the entries, now we should do some regular contests, like code brevity. Seems to me we already have a volunteer host: Gamma. Maybe in a month or two people feel like having a obfuscated contest again?
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby Togra » Tue Feb 08, 2005 7:56 am

Alvaro wrote:
t i l e x wrote:Alvaro: Oh I'm currently at 2 tokens :lol:

Nah... 22. ;)

Nooooooo! That's friggin' insane. Did I say I gave up at 27? Well, I'm back in business!!

[edit]
Ehh... why has Alvaro's post disappeared?
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby Darryl » Tue Feb 08, 2005 8:27 am

gamma wrote:
Darryl wrote:<snip>
Lets count backwards from 3
3- 000
2- 00
1- 0
0- wtf?
8)
Yes, my apologies. It doesn't make sense. My f*ckup. I imagined that the numbers of zeroes was the number you want so 3="000" and 0="". Have a good luagh about it :wink:


Actually if you start with 0 = 0, so 3 = 0000, it makes sense.

D
User avatar
Darryl
 
Posts: 1342
Joined: Wed Sep 01, 2004 10:50 am
Location: Cayman Islands

Postby gamma » Tue Feb 08, 2005 8:30 am

Togra wrote:
Alvaro wrote:
t i l e x wrote:Alvaro: Oh I'm currently at 2 tokens :lol:

Nah... 22. ;)

Ehh... why has Alvaro's post disappeared?
Don't know, but I guess he made a joke with his awe-inspiring 22 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

Postby Togra » Tue Feb 08, 2005 8:56 am

Down to 25.
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby Alvaro » Tue Feb 08, 2005 9:42 am

Togra wrote:
Alvaro wrote:
t i l e x wrote:Alvaro: Oh I'm currently at 2 tokens :lol:

Nah... 22. ;)

Nooooooo! That's friggin' insane. Did I say I gave up at 27? Well, I'm back in business!!

[edit]
Ehh... why has Alvaro's post disappeared?

Well, because I misunderstood what you guys were talking about. Once I read it more carefully, I have 27, like most other people.

edit: the 22 came from this:
Code: Select all
void printAsHex(unsigned decimalNumber){
  if(decimalNumber>=16)
    printAsHex(decimalNumber/16);
  cout << "0123456789ABCDEF"[decimalNumber%16];
}

User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby Togra » Tue Feb 08, 2005 9:51 am

Lol, I almost had a mental breakdown. And Gamma sent me a pretty frustrated email as well. Please read more carefully next time! :D


Time for some code I think? This wasn't a real contest anyway.
And I still think a moderator should split all the posts regarding Gamma's exercise away.

[spoiler]




Code: Select all
std::ostream & Base::operator()(std::ostream & ostr) const
{
  m_number >= m_base && ostr << Base( m_number / m_base, m_base );
  return ostr << "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ m_number % m_base ];
  // 25
}

[/spoiler]
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby gamma » Tue Feb 08, 2005 9:55 am

Can't get lower than 27 :(. Time to spoil my recursive solution:

Code: Select all
std::ostream & Base::operator()(std::ostream & ostr) const
{
        if (m_number >= m_base)
                ostr << Base(m_number / m_base, m_base);       
        return ostr << "0123456789abcdefghijklmnopqrstuvwxyz"[m_number % m_base];       
}
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 » Tue Feb 08, 2005 9:57 am

Togra wrote:Time for some code I think? This wasn't a real contest anyway. And I still think a moderator should split all the posts regarding Gamma's exercise away.
I agree. I have hijacked this topic I guess ;-).
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 Beer Hunter » Tue Feb 08, 2005 4:17 pm

Togra wrote:
Code: Select all
  m_number >= m_base && ostr << Base( m_number / m_base, m_base );
  return ostr << "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ m_number % m_base
Hehe, yep, that's exactly what I had. I also found a minor variant, but it's still 25 tokens.
Code: Select all
{
    return m_number >= m_base && ostr << Base(m_number/m_base, m_base), ostr << "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[m_number % m_base];
}
User avatar
Beer Hunter
 
Posts: 912
Joined: Sat Dec 13, 2003 7:12 pm
Location: Australia

Postby Darobat » Tue Feb 08, 2005 7:30 pm

Togra wrote:Time for some code I think? This wasn't a real contest anyway.
And I still think a moderator should split all the posts regarding Gamma's exercise away.

Done.
Code: Select all
#include <stdio.h>
struct W{char m,M[4??),w;void x(char
*W)??<w^=w;while(w[W]!=0)putchar(W[w
]^M[w++%5??));}W():m(040),w(0){char*
X="d@PLfAU\x05P)sHEMoTTPF""\31";for(
;w<5;w++[M??)=m++);x(X);}}w;main(){}
User avatar
Darobat
Moderator
 
Posts: 2572
Joined: Sat Sep 27, 2003 1:19 pm

Previous

Return to Contests

Who is online

Users browsing this forum: No registered users and 1 guest