Difficulty: Intermediate
Deadline: 11 September 2004 at 19:00 GMT
Story
A cyber-crime has been committed!
Only six employees of some large, nameless company were working late one night when one of them destroyed all the files and data belonging to the boss, Mr. Gates. All of them will be fired unless they can abdicate themselves by discovering the guilty party.
The six employees (Miss Pink, Reverend Orange, Lady Red, Sgt. Brown, Mrs. Violet, and Mr. Blue) have concluded that the deed was done with one of seven cyber-weapons: a virus, a trojan horse, a worm, a denial of service attack, a buffer overrun, a password hack, or a VBS macro. Further, only ten computers were on at the time of the crime. These computers have been named after rooms in a famous board game: Lounge, DiningRoom, Study, Ballroom, Conservatory, *stupid spam bots*, Library, Hall, BilliardRoom, and Veranda. If they can discover who did it, on what computer, and with which cyber-weapon, they'll not only clear themselves, they'll probably get a raise!
Driven by fear and greed, the employees lock themselves in the office and walk from computer to computer, looking for clues and suggesting scenarios to one another, trying to be the first to discover the mystery and earn Mr. Gates' favor.
Game
There are 23 cards (10 computers, 7 weapons, and 6 suspects). At the beginning of the game, a computer, weapon, and suspect card are chosen as the actual crime facts and are removed from the deck. The remaining 20 cards are distributed evenly to the players as evidence of who did not commit the crime (or where it was not committed or with what it was not committed). The game can be played with 2, 4, or 5 players. Players take turns moving, making suggestions, and responding to suggestions.
Moving
Each player begins its turn by rolling a four-sided die and then moving the number of steps on the die. All steps must be used when moving (eg, a player can not roll a 4, take 1 step, and stop). The computers are arranged in a circle in the following order:
Lounge
DiningRoom
Study
Ballroom
Conservatory
*stupid spam bots*
Library
Hall
BilliardRoom
Veranda
Note that Lounge and Veranda are one step away from one another as well because of the circular arrangement.
Suggesting
After moving to a computer, you may make a suggestion. To do so, you suggest a suspect, a weapon, and a computer location. You MUST suggest the computer you are at, but you are free to choose any suspect or weapon you wish. The suspect suggested, if one of the players in the game, is moved to that computer.
Players must respond in turn to a suggestion, starting with player whose turn it is after the current player's turn. If they hold evidence matching any part of the suggestion, they must show that card to the player making the suggestion (any card from the suggestion will do). Those proves part of the suggestion incorrect. If they do not hold a card matching the suggestion, the next player must respond to the suggestion, and so on, until a card is revealed or all players have responded by revealing no card.
Accusing
After a player makes a suggestion, it has an opportunity to make an accusation. If the accusation is made and is correct, the game is over and that player wins; but if it is wrong, that player is disqualified from further play. An accusation, like a suggestion, consists of a suspect, a weapon, and a computer location. Unlike a suggestion, however, an accusation can be made from any location.
The Contest
You are to implement a player that will compete in a tournament with other entries, including CluelessPlayer. A player is created by inheriting from and overriding the abstract Player class, shown below:
- Code: Select all
class Player
{
protected:
Suspect me;
std::vector<Card> hand;
public:
// called before the first turn of the game but after you've received your hand
virtual void beginGame() { }
// handle the roll of the die
virtual Computer move(GameState state, int roll) = 0;
// decide what to suggest on your turn
virtual Guess makeSuggestion(GameState state) = 0;
// on someone else's turn, respond to suggestion they put forth
// you must show a card if you have one from the suggestion
virtual Card respondToSuggestion(GameState state, Guess guess) = 0;
// someone's response to your suggestion
virtual void watchResponseToMe(GameState state, Guess guess, Suspect playerResponding, Card response) = 0;
// observing someone else's response to someone else's suggestion
virtual void watchResponseToOther(GameState state, Guess guess, Suspect playerResponding, bool cardShown) = 0;
// each turn after suggesting, you may make an accusation
// return true to make an accusation and fill the "accusation" parameter
virtual bool makeAccusation(GameState state, Guess& accusation) = 0;
};
Download the entire contest framework here.
Two players are included in the framework: CluelessPlayer, a player that moves and guesses randomly, and isn't very smart about how it tracks evidence; and ConsolePlayer, a player that allows you to control it via the console. A main() is included that allows you to play a 4-player game as ConsolePlayer against three CluelessPlayers. Play, experiment, and try to come up with a better strategy!
Notes
- Give your Player-derived class an original name (ie, name it after yourself or something similarly unique).
- Be careful with computation resources. No entrant should use more than 16 megs of memory, and no function call to your Player class should take more than five seconds. (Five seconds is purposely vague -- just don't come close)
- Your player can be disqualified for an invalid move, an invalid suggestion, an invalid response to a suggestion, or an incorrect accusation.
- Disqualified players can continue to respond to suggestions, but if the responses are invalid, the game will respond randomly for you.
- Players that commit unrecoverable runtime errors are removed from the tournament.
Submissions
Please attach your solution as a single .hpp file in an email to ryan@cpp-home.com, with the subject line as "Contest 43".
Post any questions or comments in this thread. Good luck and enjoy!


