Beginners Brevity Contest: BUZZ

Online C++ programming contests.

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

Postby Corsix » Mon Oct 03, 2005 1:47 pm

Dante Shamest wrote:
Corsix wrote:14 actually


Seriously? I honestly believe you're better than most of my fellow undergraduates in my University.
Yup, seriously (but I'm getting ~1/31557600th closer to 15 every second)
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby c2.0 » Mon Oct 03, 2005 4:18 pm

Nice one Corsix, congrats.
Here's my 105 token one. No string trickery, might try some of that next time :)

[syntax="cpp"]
#include "sstream"

using namespace std;

struct c2_0 : player
{
string init(int player_position, int num_of_players)
{
distanceToCurrent = --player_position;
playerCount = num_of_players;
currentNumber = 0;

return "c2_0";
}

string respond(string last_response)
{
stringstream ss;
ss << ++currentNumber;
ss >> last_response;

if(currentNumber % 7 * currentNumber % 11 * last_response.find_first_of("7") < 0x7fffffff)
distanceToCurrent *= 0xffffffff, last_response = "buzz";

return distanceToCurrent-- % playerCount ? "" : last_response;
}

int playerCount, distanceToCurrent, currentNumber;
};

[/syntax]
c2.0
 
Posts: 43
Joined: Sun Nov 07, 2004 5:50 pm
Location: Scotland

Postby taymo2020 » Mon Oct 03, 2005 8:35 pm

Corsix wrote:
Dante Shamest wrote:
Corsix wrote:14 actually


Seriously? I honestly believe you're better than most of my fellow undergraduates in my University.
Yup, seriously (but I'm getting ~1/31557600th closer to 15 every second)

....I don't know how you do it. Whoa I'm also getting ~1/31557600th closer to my birthday every second (I'm 15). Crazy stuff :lol: :lol:
taymo2020
 
Posts: 998
Joined: Mon Mar 07, 2005 5:39 pm
Location: On the pot..

Postby Safari » Tue Oct 04, 2005 1:49 am

Alvaro wrote:
Code: Select all
left *= "\1\377"[last_response=="buzz"]

Clever! I would never had thought of that!



Wenn Engel hassen
stürzen sie wie Steine aus dem Himmelszelt;
wenn Engel hassen
fliegen sie als dunkle Vögel in die Welt;
wenn Engel hassen
landen sie als schwarzer Schatten der uns quält
und nehmen Rache
an den Menschen, die gefallen sind wie sie.

My german suck.
When angles *something* *something* stones on heaven (?) ... (havn't read german in 3 years). :p

Btw, you said your starting reading informatik soon, then your probably as old as me (18?) (I just started reading and going to read _alot_ math (basically every math course that hasn't anything to do with becoming a math teacher or economics, or maybe some math courses that has to do with modelling + economics) and physics. Homer: Theory of Integration and Modelling with neural nets, grrrrrr ahhhhhh, sounds juicy Image)



btw, where's dantes and exomos? I downloaded the zip-file again and it wasn't there
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby exomo » Tue Oct 04, 2005 2:30 am

Safari wrote:
Wenn Engel hassen
stürzen sie wie Steine aus dem Himmelszelt;
wenn Engel hassen
fliegen sie als dunkle Vögel in die Welt;
wenn Engel hassen
landen sie als schwarzer Schatten der uns quält
und nehmen Rache
an den Menschen, die gefallen sind wie sie.

My german suck.
When angles *something* *something* stones on heaven (?) ... (havn't read german in 3 years). :p

It is something like "When angels hate, they fall like stones [out of] heaven"

Safari wrote:Btw, you said your starting reading informatik soon, then your probably as old as me (18?) (I just started reading and going to read _alot_ math (basically every math course that hasn't anything to do with becoming a math teacher or economics, or maybe some math courses that has to do with modelling + economics) and physics. Homer: Theory of Integration and Modelling with neural nets, grrrrrr ahhhhhh, sounds juicy Image)

Correct, I start 18th this month. I'm 20. "Abitur" at age of 19 and 1 year civil service (is this a good word?). For the start we have "simple" courses like "basics of informatik" and linear algebra and analysis. And there will be a contest on peer-to-peer-systems, perhaps I will ask you guys for help^^, but I hope it's not too hard right at the beginning

Safari wrote:btw, where's dantes and exomos? I downloaded the zip-file again and it wasn't there

I'm sure nobody wants to see my entry, it's the "straight forward" one, but here it is anyway: (it has 2 tokens less than the one I sent in)
[syntax="cpp"]
#include <sstream>
using namespace std;

class exomo_player : public player
{
int counter, direction, player_turn, pos, num;

string init(int player_position, int num_of_players)
{
pos = player_position-1;
num = num_of_players;
counter = 0;
player_turn = direction = -1;
return "Exomo";
}

string respond(string last_response)
{
player_turn = (player_turn - direction + num) % num;
stringstream bla;
bla << ++counter;
if ( !(counter%7 && counter%11) || bla.str().find('7') + 1)
direction = -direction, bla.str("buzz");
return player_turn == pos ? bla.str() : "";
}
};
[/syntax]

EDIT: corrected tags
Who needs a signature anyway.
User avatar
exomo
 
Posts: 880
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Safari » Tue Oct 04, 2005 5:25 am

[syntax="cpp"]return left = player_position, num = num_of_players, "Safari";[/syntax]
Exactly what happens here? Exactly why doesn't it return left and num too? Or are they returned (but what happens then to them? Are they placed in the heap?)? So many questions
:)
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby Alvaro » Tue Oct 04, 2005 6:37 am

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

Postby t i l e x » Tue Oct 04, 2005 6:46 am

Safari wrote:[syntax="cpp"]return left = player_position, num = num_of_players, "Safari";[/syntax]
Exactly what happens here? Exactly why doesn't it return left and num too? Or are they returned (but what happens then to them? Are they placed in the heap?)? So many questions
:)
When you use the comma operator, only the last element will be used for operations:
Code: Select all
int i = 0;
std::cout << ((i+=1), i); //Didn't test, but should output 1
User avatar
t i l e x
 
Posts: 3604
Joined: Wed Dec 03, 2003 3:59 pm
Location: Québec (Canada)

Postby Dante Shamest » Tue Oct 04, 2005 11:41 am

Safari wrote:btw, where's dantes and exomos? I downloaded the zip-file again and it wasn't there


Nothing special in mine.

Code: Select all
#include "sstream"
using namespace std;

struct dante : player
{
  int round, pos, playerCount, turn, direction;

  string init(int player_position, int num_of_players)
  {
    round = turn = 0;
    direction    = 1;
    pos          = player_position ;
    playerCount  = num_of_players;
    return "Dante" ;
  }
 
  string respond(string ret)
  {
    stringstream ss;
    ss << ++round ;
    ss >> ret ;

    turn = ((turn += direction) %= playerCount) ? turn : playerCount ;

    if (round%7 && round%11 && ret.find('7')==UINT_MAX)
      ;
    else
      direction =- direction,
      ret = "buzz";

    return turn==pos?ret:"";
  }       

};
User avatar
Dante Shamest
Moderator
 
Posts: 3131
Joined: Wed Oct 22, 2003 10:29 pm
Location: Malaysia

Postby Safari » Fri Oct 07, 2005 11:52 am

Does someone have the source code for tokxx? I need it on my unix machine :)
http://contests.cpp-home.com/39/tokxx-0.4.zip
the link is broken
你 好!
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

Postby ^-^ » Fri Oct 07, 2005 1:07 pm

Safari wrote:Does someone have the source code for tokxx? I need it on my unix machine :)
http://contests.cpp-home.com/39/tokxx-0.4.zip
the link is broken

Yes, if you private message me a e-mail address. I will send you the zip file.
^-^
 
Posts: 353
Joined: Thu Sep 16, 2004 1:34 pm

Previous

Return to Contests

Who is online

Users browsing this forum: No registered users and 0 guests