Deadline: September 30, 2005 11:59PM EST
Introduction:
This brevity contest is based on the Drinking game of Buzz. It should be fairly simple and straight forward to implement with a low token count, which is why I am calling it a beginners brevity, but I still encourage all to participate.
Programming Task:
You will derive a player from the provided player class that plays the game of Buzz as described in the link above. Your player must keep track of whose turn it is as well as direction of play during the game. Each turn the "Game" will give you the last reply and you will respond with one of the following:
-if it is your turn respond with current number or "buzz".
-if it is not your turn return empty string.
If a player responds incorrectly, they will be eliminated and a new game is started with remaining players(which means init() will be called again and your player may get a new seat number). Game play will continue until there is either 1 player remaining or the game has reach INT_MAX in the count.
Judging
All entries the remain in the game up to INT_MAX will be judged based on code brevity using tokxx.
Rules/Restrictions:
You must submit 1 source file, with a .h or .hpp extension.
Your entry may not use any input files.
No macos / asm
For the init() you can return any unique name, but I would suggest your cpphome screen name.
Submit entries to my gmail address, username littled
I will not be providing a test framework because it contains solutions to the problems you are solving since it must determine right and wrong answers and I don't want it to affect your creativity, however I will let you know if there are any technical problems with your entry if they are submitted early enough.
Here is the class to overide:
- Code: Select all
#include <string>
class player
{
public:
virtual std::string init(int player_position, int num_of_players)=0;
// Return your players unique name
// player_position is your "seat" position starting with 1
// player 1 goes first, then 2 etc, player 1 goes after last player
// play direction switches after a "buzz", highest player then goes after player 1
virtual std::string respond(std::string last_response)=0;
//if it is your turn, respond with the current number or "buzz"
//there should be no leading/trailing spaces in the number
//if it is not your turn, return empty string so string.empty() will give true;
//the first last_response to start game is empty string
};
Your file will be included after my player class definition therefore you do not need to #include "player.h" but simply just: class Your_Player : public player
Have fun and good luck to all.
