5 ms·
> The 1/100th of a second time limit used in this example is more than enough time for a bot that does not loop infinitely to terminate on any modern processor;
by philh 12y ago
> The 1/100th of a second time limit used in this example is more than enough time for a bot that does not loop infinitely to terminate on any modern processor; simple bots like cooperateBot or titForTat will terminate in less than 1/1000th of a second. For the purposes of this tournament, you can consider 1/100th of a second a safe upper bound on simulation time when writing your own bots. In addition, the time function itself costs slightly less than 1/100th of a second in overhead
This doesn't seem safe. Suppose I'm playing against JusticeBot, and simulate ver playing against me. Then ve simulates me playing against CooperateBot, and presumably sim-me simulates CooperateBot playing against me. The recursion ends there. But JusticeBot called time once directly, and vis simulation of me also called time, which means ve took more than 1/100 of a second to run in total.
- spimta 12y agoWhen you call the time function, it will cut off the simulation once that 1/100th of a second limit is reached, no matter what happens inside the simulation. So even if your opponent simulates you or performs some expensive computation or even goes into an infinite loop, time will terminate in the allotted number of seconds plus the overhead. If that happens, though, it will return Nothing, so you won't have gained any information about what your opponent will do.
- philh 12y agoI mean that it doesn't seem a safe upper bound - `time` will return, but there are situations where to get a useful result, you need to increase the limit; and it's easy to get in those situations even when neither bot is running lots of repeated simulations. This class of difficulty can't be completely eliminated, but it seems that being able to run bots for a long time relative to the overhead of `time` would reduce it.
- spimta 12y agoAh, I see what you mean now. This was deliberate--I want simulation time to be a precious resource that bots have to spend wisely. You can burn 4 seconds on one simulation that is more likely to give you valuable information, but then it's the only one you're going to get. Or you can do lots of small simulations that are less likely to return an answer. I agree that it's not very safe, which is somewhat unfortunate, but also serves to discourage bots that use precise timing as part of a strategy. Also, since timing out results in a defection rather than in some additional penalty, the risk isn't too large.