Timeline for A game of dice, but avoid number 6
Current License: CC BY-SA 4.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 5, 2019 at 19:35 | comment | added | DaniO | @ChristianSievers: I think the controller should have its own private instance, whether "secure" or not; and there would be ways (either by rules, or programmatically) to prevent bots accessing the controller's private instance. And I'd agree that maxb gave no guarantees about the controller's RNG. So if it were just changed to use (an instance of) random.SystemRandom rather than (the global) random.Random then the future results would be unpredictable by any of the bots (AFAWK!) even if they could access its internal state. | |
Jan 4, 2019 at 18:04 | comment | added | Christian Sievers |
@maxb I don't see how a cryptographically secure RNG helps when bots can reach into the internal state of the RNG. I'd still argue that you never made any guarantees about details of the controller and can use your own Random instance or just 7-randint(1,6) . Next time disallow it or make it impossible by using a different language or letting the bots be separate programs.
|
|
Jan 4, 2019 at 11:48 | comment | added | DaniO |
@MostlyHarmless: thank you :) I thought of obscuring the switch between local and global RNGs a bit more (as in Oracle ), but this isn't an obfuscated code challenge, so the 'roll a 6' is there in plain sight ;D
|
|
Jan 4, 2019 at 6:44 | comment | added | Mostly Harmless |
Actually, if sum(self.current_throws) > target + random.randint(1, 6): is the really interesting bit - you already counted to the point where you know it's a 6, the call to random eats the bad roll so you can keep bumping up your score if you think you need it. Clever...
|
|
Jan 4, 2019 at 5:11 | comment | added | Mostly Harmless | facedesk Why didn't I think of keeping my own instance of random and then copying the state over, would make things so much cleaner! (And avoid the state list rollover bug I never got around to ironing out.) I did consider adding some targeting logic, but with NeoBot being the first and clobbering everything at the time I figured it could stand as a "dumb" example of the approach. Very nicely done! | |
Jan 3, 2019 at 23:53 | history | edited | DaniO | CC BY-SA 4.0 |
Changed indent of `Oracle` as it's supposed to be a code example, not an actual submission!
|
Jan 3, 2019 at 21:24 | comment | added | DaniO |
@maxb: none of my bots are really fair competition; they all try to do something other than solve the logic of the dice game. TleilaxuBot (formerly WisdomOfCrowds ) copies someone else's strategy (often NeoBot 's!), KwisatzHaderach can out-Neo NeoBot by being very carefully selective about rolling the (shared) die, and HarkonnenBot just stomps everybody else into the sand ;D
|
|
Jan 3, 2019 at 21:08 | comment | added | DaniO | @maxb: I just updated the main post to explain the origin of the technique. I would have put it in a comment, but comments can't contain formatted code of even newlines, without which it's difficult to post readable python! | |
Jan 3, 2019 at 21:04 | history | edited | DaniO | CC BY-SA 4.0 |
Background on the breeding program that led to the `KwisatzHaderach`
|
Jan 3, 2019 at 20:56 | comment | added | maxb |
Something finally clicked, now I see exactly how this bot works. It's quite neat! As soon as I saw NeoBot , I realized that I should have used a cryptographically secure RNG. However, once that had been posted it was too late to change it. I just see it as a learning experience that will make the next KotH challenge better.
|
|
Jan 3, 2019 at 20:49 | comment | added | maxb |
I have looked through all of your bots. I have decided to treat KwisatzHaderach and HarkonnenBot the same way as NeoBot . They will receive their scores from a simulation with fewer games, and will not be in the official simulation. However, they will end up on the highscore list much like NeoBot . The main reason for them not being in the official simulation is that they will mess up other bot strategies. However. WisdomOfCrowds should be well suited for participation, and I'm curious about the new changes that you've made to that!
|
|
Jan 3, 2019 at 20:44 | comment | added | DaniO |
@ChristianSievers: unlike NeoBot (and HarkonnenBot ), KwisatzHaderach relies on only one detail of the implementation; in particular it doesn't need to know how random.random() is implemented, only that the controller uses it ;D
|
|
Jan 3, 2019 at 20:34 | comment | added | DaniO |
@maxb: HarkonnenBot doesn't touch the RNG; it doesn't care at all about random numbers. It just poisons all the other bots, then strolls up to the finish line as slowly as possible. Like many culinary delicacies, revenge is a dish best savoured slowly, after long and delicate preparation.
|
|
Jan 2, 2019 at 22:14 | comment | added | Christian Sievers |
Oh, on my first reading I didn't notice that this is not only nicer than NeoBot but also better! I also like how you give an example of what everything using randomness (especially the controller) here should do: use your own random.Random instance. Like NeoBot , this seems a bit sensitive to changes of unspecified implementation details of the controller.
|
|
Jan 2, 2019 at 13:13 | comment | added | maxb | It seems that this bot changes the state of the random number generator, to ensure that it avoids rolling 6, or at least anticipates it. Same goes for HarkonnenBot. However, I note that the win rate of these bots are much higher than that of NeoBot. Are you actively manipulating the random number generator in order to prevent it from rolling 6? | |
Jan 1, 2019 at 18:18 | history | edited | maxb | CC BY-SA 4.0 |
Fixed indentation
|
Jan 1, 2019 at 13:04 | history | answered | DaniO | CC BY-SA 4.0 |