• 9
• 10
• 10
• 11
• 16

# RoShamBo Programming Competition

This topic is 4774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Also, right now, you could beat the random bot perfectly because you can generate the exact same random numbers it does and then just play the better move. When I get back, I'll update the RNG to have some kind of 'reseed' function (maybe an arg to reset) that allows you to have multiple random number generators. It will be a rules requirement that you use a fixed seed so the game will run the same each time (and multiple matches versus the same bot must have exactly the same outcome as long as both bot's "reset" function is called between matches).

##### Share on other sites
GCC complains about a few minor things:

- No newline at the end of any of the files.
- [Rock|Random|Rotator]Bot::RegisterResult(): p_ThrowResult not used for anything.

A Makefile plus the above minor changes to compile it in Linux using GCC. Also the newline characters sequences have been mangled. Hope nobody tries to read it using Notepad.

##### Share on other sites
Well, I spent way more time on this than I should have, but I think it's an improvement.

Includes API reference and snazzy new results output:
+--------------------+--------------------+----------+|Contestant          |Challenger          |     Score|+--------------------+--------------------+----------+|RockBot             |RandomBot           |      -131||RockBot             |AntiRandomBot       |        69||RockBot             |UnityBot            |        62||RockBot             |RotatorBot          |        -1||RockBot             |CrazySpinBot        |         0||RockBot             |CopyBot             |         0||RockBot             |CounterBot          |    -10000||RockBot             |ThirdBot            |         0||RandomBot           |AntiRandomBot       |    -10000||RandomBot           |UnityBot            |     10000||RandomBot           |RotatorBot          |      -110||RandomBot           |CrazySpinBot        |       -59||RandomBot           |CopyBot             |       -52||RandomBot           |CounterBot          |       103||RandomBot           |ThirdBot            |       -49||AntiRandomBot       |UnityBot            |    -10000||AntiRandomBot       |RotatorBot          |        65||AntiRandomBot       |CrazySpinBot        |        67||AntiRandomBot       |CopyBot             |       -51||AntiRandomBot       |CounterBot          |       104||AntiRandomBot       |ThirdBot            |        75||UnityBot            |RotatorBot          |        45||UnityBot            |CrazySpinBot        |        -8||UnityBot            |CopyBot             |       -53||UnityBot            |CounterBot          |       105||UnityBot            |ThirdBot            |        14||RotatorBot          |CrazySpinBot        |      5000||RotatorBot          |CopyBot             |     10000||RotatorBot          |CounterBot          |         0||RotatorBot          |ThirdBot            |     -9999||CrazySpinBot        |CopyBot             |         0||CrazySpinBot        |CounterBot          |        -1||CrazySpinBot        |ThirdBot            |        37||CopyBot             |CounterBot          |     -5000||CopyBot             |ThirdBot            |    -10000||CounterBot          |ThirdBot            |     -3380|+--------------------+--------------------+----------++--------------------+---------------+|Bot                 |    Final Score|+--------------------+---------------+|ThirdBot            |          23302||CounterBot          |          11309||RotatorBot          |           5002||AntiRandomBot       |            191||UnityBot            |             41||RandomBot           |            -36||CrazySpinBot        |          -4964||RockBot             |         -10001||CopyBot             |         -24844|+--------------------+---------------+

It's asciilicious. Also includes AntiRandomBot, which will always win against RandomBot, and UnityBot to keep things fair between Random and AntiRandom.

Oh, and lastly a new random number generator class, based on the Mersenne Twister. The old one is gone. I killed it. *Evil Laugh*

##### Share on other sites
Quote:
 Original post by smart_idiotWell, I spent way more time on this than I should have, but I think it's an improvement.Includes API reference and snazzy new results output:[...]It's asciilicious. Also includes AntiRandomBot, which will always win against RandomBot, and UnityBot to keep things fair between Random and AntiRandom.Oh, and lastly a new random number generator class, based on the Mersenne Twister. The old one is gone. I killed it. *Evil Laugh*
I've been planning on turning the results into CVS format because its easy to plug in to anything (like the HTML results page that will be put up) whereas your format is nice to look at in text mode but takes more work to import into various places. Also, I'll never include MT in the my version because I don't like the license (I was never quite sure I understood the legalese part, and having to put the notice on the website {the only real documentation I was planning} wouldn't be nice). I'd implement my own version from the paper, but it isn't simple and I don't really feel it's worth the time. I was planning on tweaking the random number generator, but I had to leave so hadn't had the time yet.

I think your change to WrapThrow is invalid, because I don't think modding a negative number is guaranteed by the standard to work a certain way, but maybe it just doesn't work the way I expected it to..?

Also, I'm thinking about changing a lot of the interface for much of the program now that I've had some time to consider everything (after getting some sleep). It will probably break bots, but it shouldn't be more than a few lines that need modification.

Thanks for running it through GCC and fixing those warning, and I do like some of the changes you made (new types is a good thing). I'll have to go over your modifications in more detail when I have more time (just got in and I have to be up early tommorow).

[Edited by - Extrarius on March 20, 2005 11:51:51 PM]

##### Share on other sites
From the source code - "Who really cares about time anyway?"
Well, I do, but only because I don't want to dedicate my computer to judging for the next 10 years =-)

I chose 5ms because 10000(num trials per matchup) * 0.005sec (max length of one throw decision) * 2 (num opponents) = ~1.7 minutes per match
That seemed like a reasonable limit, especially with some changes I'm making in the match format (10 rounds of 10k throws with a different inital random seed for each of the 10 rounds).

I probably shouldn't have bothered with a date until I had finalized the foundation, but at the time I was really tired and these changes shouldn't make much difference to strategy or code except that you won't be able to always beat random any more. If anybody is actually working on this and feels the date should be changed after I decide to 'freeze' everything for this iteration, I'll probably change it.

##### Share on other sites
That comment was directed towards my frustration with gettimeofday(), which isn't used in the Windows version so you don't have to worry. The program seemed to spend way more time in that function than it did running the competition.

I'm sure it wouldn't seem nearly so bad once the bots actually start doing something complex, though.

##### Share on other sites
Quote:
 Original post by smart_idiotThat comment was directed towards my frustration with gettimeofday(), which isn't used in the Windows version so you don't have to worry. The program seemed to spend way more time in that function than it did running the competition.I'm sure it wouldn't seem nearly so bad once the bots actually start doing something complex, though.
I think what I'll probably do is merely time an entire match (all 10k throws) with the clock() function, and if it takes too long I'll report the entire match as a tie (0 for both sides) and print that the match took too long. The lack of precise timing in general makes anything else not really viable. Perhaps if a bot times out in too many matches (say 5 matches), it'll be disqualified until the author can rectify the problem. Even with only ~16ms accuracy (on windows I presume that's what it'd be anyways), it's still precise enough to see if 10k throws takes minutes or not. Really, I don't care if one round takes 10 minutes, as long as the average is less than 2 or so minutes.