When you email it in, I will assign you a number and email you that number back. If in future weeks you alter your bot and resubmit it, then when resending, please send the file with your entry number appended like skeleton5.c or skeleton12.cpp - that is your bot's "Shirt Number" in soccer or football parlance! You can give your bot a name, up to 20 characters; just alter the text in the GetBotName() function, but please keep names clean. Naughty or bad names will be disqualified before they get a chance to show what they're made of.
You must download this file- skeleton.zip (updated 28 Aug 2007) which contains skeleton.h and both skeleton.c and skeleton.cpp so you can choose your preferred programming language. These have been set up to make life easier for you.
There are 5 functions that you need to flesh out. The first four are purely for reporting purposes. It's the fifth one GetMove() that needs all the work.
GetMove must return a single uppercase character
#define SKELETON_API __declspec(dllexport) SKELETON_API char * __cdecl GetBotName(void) ; // returns name of your Bot SKELETON_API char * __cdecl GetPlayerDetails(void) ; // returns name of your Bot SKELETON_API char * __cdecl GetBotDate(void) ; // return date of your bot (ie last change). SKELETON_API float __cdecl GetBotVersion(void) ; // return version of your bot SKELETON_API char GetMove(char * Moves,char * MyMoves);
- 'R' for Rock
- 'S' for Scissors
- 'P' for Paper
The parameter Moves is a string that contains a list of the opponent's previous hands - each a character 'R', 'S', 'P' or ' ' (a single space for forfeit hands). As each hand is played (there are 100 hands per match), the hand played from each player is appended to a string and passed in to the GetMove() call.
E.g. After 5 hands have been played the string might look like this: Moves : RSPRR
Don't forget, on the first hand, Moves will be 0 length. Moves is a zero byte terminated, i.e. char * (i.e. a text string) or an an array of bytes.
Please do not change anything that would break the code. In particular do not add any calling conventions to functions as that will hide the functions.
- For a bit of background, you can read a mini tutorial about Calling Conventions but they aren't needed for this. All the functions use cdecl.
The scores are then sorted, with a point added here or there so no two players have exactly the same score and that determines the ranking for next week which will be published. Whoever is in first place will have their code made available for download. Although it's a ladder, the position is determine purely by the number of hands won and lost. You can submit a new bot whenever you like but please try and limit it to once per week. New bots (only one per player) can join the contest at any time.
ForefeitingA hand is forfeit if your bot cannot return a move: 'R', 'S' or 'P' within three seconds.
Devising a strategyYou could pick a move randomly, or perhaps use your opponent's last but one move, or try and analyze all their previous moves and attempt to anticipate the next one.
Testing Your DLLDownload this zip file (Updated 29 Aug 2007). It contains an Win 32 exe (compiled by me on a virus free PC) which you should extract to a folder. It is for Windows, 2000, XP. It has not been tested on Microsoft Vista but if anyone can test it and let me know it's ok or not.
When you run it, select the folder where your skeleton.dll is located. It will call each of the 4 Information functions first. Then it will call GetMove() ten times with random moves and output the results to a text file called results.txt and will look like this. My sample dll's GetMove() just returns 'R'.
If any function, say GetBotName() is misspelt, you'll see lines output like this:
Botname = MyBot Date = 2007/08/10 Version = 1.0 Player Details = David Bolton(UK) Aged 48 Move 1 = R Move 2 = R Move 3 = R Move 4 = R Move 5 = R Move 6 = R Move 7 = R Move 8 = R Move 9 = R Move 10 = R
That usually means you've put the name in wrong or added a calling convention.
Unable to find GetBotName
If it runs ok, you can submit the source code file. To email@example.com?subject=RSP Contest Entry