Contest 43: CyberClue

Online C++ programming contests.

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

Contest 43: CyberClue

Postby Ryan » Tue Aug 24, 2004 7:42 am

Contest 43: CyberClue
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!
Last edited by Ryan on Wed Sep 29, 2004 6:42 am, edited 2 times in total.
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby TheKidder » Tue Aug 24, 2004 7:54 am

haha :lol:
Good contest, sounds a lot like the animal competition going on. I might enter once I finish my RabidChipmunk 8)
w00t!
User avatar
TheKidder
 
Posts: 525
Joined: Mon Nov 24, 2003 7:57 pm
Location: MI

Postby Dante Shamest » Tue Aug 24, 2004 8:11 am

Shouldn't the abstract base class Player have a virtual destructor?
User avatar
Dante Shamest
Moderator
 
Posts: 3131
Joined: Wed Oct 22, 2003 10:29 pm
Location: Malaysia

Postby Ryan » Tue Aug 24, 2004 8:20 am

Dante Shamest wrote:Shouldn't the abstract base class Player have a virtual destructor?


I thought Dave Sinkula was the resident pedant.. ;)

In the framework I never delete a Player*, so there's no error in the framework per se. But yeah, you're probably right.
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby Dante Shamest » Tue Aug 24, 2004 8:34 am

Heh, sorry if I sounded pedantic. Just wanted to make sure. :)
User avatar
Dante Shamest
Moderator
 
Posts: 3131
Joined: Wed Oct 22, 2003 10:29 pm
Location: Malaysia

Postby Corsix » Tue Aug 24, 2004 11:42 am

Graphics Pack: 113 kb - here
Including:
ImageImageImage

EDIT: My 127th post - thats the highest value you can put in a signed char!
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 Ryan » Tue Aug 24, 2004 12:17 pm

Corsix wrote:Graphics Pack: 113 kb - here


:shock:

That may be the coolest thing I've ever seen.

So would you mind if I made a GUI out of your images? Or were yoy planning to do it yourself?

At any rate, way to go!

Oh, and Dante, no worries, I was just trying to be funny. Forum humor never quite works. :)
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby Corsix » Tue Aug 24, 2004 12:25 pm

Go ahead and do what you like with them! (Just put "Graphics by Corsix" somewhere in the GUI)

EDIT: They were done with a GUI in mind (eg. numbering is same as in the enumerations and they have magenta bits in the corners to become transparent) however as I am busy holding my own contest( and I havn't yet tried to understand your code) then feel free to make your GUI!
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 exomo » Thu Aug 26, 2004 12:45 am

Nice game. I'll try to do something when I'm ready with the animal contest.

Could we make something like a online game of it? That would be pretty much fun. Semething like grafix by Corsix GUI by Ryan and network stuff by exomo.
User avatar
exomo
 
Posts: 881
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Re: Contest 43: CyberClue

Postby Yvanhoe » Thu Aug 26, 2004 3:40 am

Ryan wrote: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.


Just a stupid question but i prefer to be sure : from what I understand, it is possible to move in two directions once the dice has been throwned (eg : a two from the ballroom can go into diningRoom or *stupid spam bots*) right ? Now, do I have the right to not throw the dice and stay where I am ? Can I throw the dice and depending on the result, chose between staying where I am or move ? and last but nor least : when I throw a 4, for instance, I suppose all my steps must be in one direction, i can't do forward, forward, backward, forward (or can i ?)

I hope i'll have time to do some code, 1st september is quite close when you have a day job...

Oh, btw... Hi everybody on this forum, there was a post on gamedev about this contest so I droped by...
Yvanhoe
 
Posts: 8
Joined: Thu Aug 26, 2004 3:29 am
Location: Paris, France

Re: Contest 43: CyberClue

Postby Ryan » Thu Aug 26, 2004 4:21 am

Yvanhoe wrote:Just a stupid question but i prefer to be sure : from what I understand, it is possible to move in two directions once the dice has been throwned (eg : a two from the ballroom can go into diningRoom or *stupid spam bots*) right ? Now, do I have the right to not throw the dice and stay where I am ? Can I throw the dice and depending on the result, chose between staying where I am or move ? and last but nor least : when I throw a 4, for instance, I suppose all my steps must be in one direction, i can't do forward, forward, backward, forward (or can i ?)

Good question. You have to roll and move, but all your steps do not have to be in the same direction. So if you roll a 2 or a 4, you can end up in the same place again.

There is a function in helpers.hpp that will list the valid destinations given a starting point and a dice roll.

Yvanhoe wrote:I hope i'll have time to do some code, 1st september is quite close when you have a day job...

It is close, and this isn't a very easy contest. I'd certainly push it back if needed.

Yvanhoe wrote:Oh, btw... Hi everybody on this forum, there was a post on gamedev about this contest so I droped by...

Welcome! Thanks for coming by.
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby Yvanhoe » Thu Aug 26, 2004 6:56 am

Thanks for the quick answers!
In the meantime I have come over a few more question (sorry for the nit-picking, i'm a bit of a rule-lawyer ;-))
1. Do all players start at thje same place or is it randomly chosen ?
2. When an other player makes a suggestion and an other player shows him evidence that he is wrong, do we know which player showed the evidence ?
3. Do we know where the other players are ?
4. Do we know what score they did with the dice ?

In an other category :
5. How many rounds will there be in the contest ? (i.e. is it a large number of plays (>1000) or a relatively small (<10) )
6. When a program makes a false accusation, is it disqualified for the round or for the entire challenge ? (interesting strategies in the first case but it also opens the door to riskier strategies where the luckiest wins)
7. Will the program be able to identify the program behind each of its adversaries ? (Will he see that Sgt. Brown uses the random program and that Mr Blue is Mark Johnson's program or is it 'anonymous' ?)
8. Will we have access to the logs of all rounds ?

Don't worry, it may look like I am trying to make a program which will analyze other moves but i don't think i will have the time for that. I would be happy enough to code something optimal without taking the other players into account... A dangerosity level for each opponent, maybe...
Yvanhoe
 
Posts: 8
Joined: Thu Aug 26, 2004 3:29 am
Location: Paris, France

Postby Ryan » Thu Aug 26, 2004 7:38 am

Yvanhoe wrote:Thanks for the quick answers!
In the meantime I have come over a few more question (sorry for the nit-picking, i'm a bit of a rule-lawyer ;-))

No worries, I appreciate questions like these. It helps clarify the contest for everyone.

Yvanhoe wrote:1. Do all players start at thje same place or is it randomly chosen ?

It's randomly chosen.

Yvanhoe wrote:2. When an other player makes a suggestion and an other player shows him evidence that he is wrong, do we know which player showed the evidence ?

Yes. Player::watchResponseToOther() is called when this occurs, and the playerResponding parameter identifies which player showed the evidence. Note that it doesn't reveal what card was shown, and that function is also called when a player responds to a suggestion by not showing a card. The boolean parameter lets you know whether a card was shown or not.

Yvanhoe wrote:3. Do we know where the other players are ?

Yes. The GameState structure contains a std::map with all the player's locations.

Yvanhoe wrote:4. Do we know what score they did with the dice ?

No, though you could track their movement through the structure I mentioned above. Also, players are moved when a suggestion involving them is made.

Yvanhoe wrote:5. How many rounds will there be in the contest ? (i.e. is it a large number of plays (>1000) or a relatively small (<10) )

A large number of plays, depending on how many entries there are. I'd like to run a few games with each possible combination of players.

Yvanhoe wrote:6. When a program makes a false accusation, is it disqualified for the round or for the entire challenge ? (interesting strategies in the first case but it also opens the door to riskier strategies where the luckiest wins)

A fale accusation is disqualified for that game only. Yeah, an interesting strategy could be to guess -- to make an accusation without being able to prove it yet.

Yvanhoe wrote:7. Will the program be able to identify the program behind each of its adversaries ? (Will he see that Sgt. Brown uses the random program and that Mr Blue is Mark Johnson's program or is it 'anonymous' ?)

Interesting question. You can't persist any information between rounds (ie, no saving info to a file), so it seems it would be impossible to learn anything. The only opponent you would have prior knowledge of is the included CluelessPlayer.

Let's say no. Treat everyone as anonymous. You can try to adapt to their strategies, but don't bring any prior information about specific opponents when a game starts.

Yvanhoe wrote:8. Will we have access to the logs of all rounds ?

Yes.
Ryan
Moderator
 
Posts: 323
Joined: Sat Jun 12, 2004 1:34 pm

Postby Corsix » Thu Aug 26, 2004 9:21 am

I really think that you should extend the deadline as alot of people are busy creating some animals in my contest.

BTW. Hows the GUI coming?
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 Darobat » Thu Aug 26, 2004 9:38 am

Corsix wrote:I really think that you should extend the deadline as alot of people are busy creating some animals in my contest.

BTW. Hows the GUI coming?


I don't think this contest willgo very far until Corsix finishes his.
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

Next

Return to Contests

Who is online

Users browsing this forum: No registered users and 0 guests