This place used to read: “Just read the sample code. You can figure this out.” Here are the formalities for that other part of the audience.
This section's HTML gets messed up somewhere in the SDK pipeline. I reported it there; and there you'll be able to find a readable representation of this block. Sorry about the inconvenience…
Your first line of input contains five space-separated parameters: roadLength initialStones gameSeed gameSide reserved
gameSeed
to have a
(reproducible) random that doesn't mecessarily draw
when it plays against itself.
At each turn, you are provided with the following three space-separated values: trollDistance stones opponentStones
After having received your turn input, you are to output a single integer stones: the number of stones you wish to throw at the troll.
You may optionally provide a message you wish your castle to yell at the troll or at your opponent. Just append it to your output, being sure to separate it with at least one space.
You're currently allowed the default SDK timings. I think it's one second for the first turn and 50 ms then, but don't quote me on this.
Language Family | Sample |
---|---|
JVM |
long mySecretSalt = 0x4242424242424242L; |
C, C++, Perl… |
srand(gameSeed ^ gameSide ^ 0xdeadb33f); |
Other | Unachievable until proven otherwise |
In the lower leagues, the following maps are currently available and randomly yet extremely fairly (you wouldn't believe the effort that went into this) chosen uniformly at random among the following:
Road length | Stones |
---|---|
You can also override them via game settings roadLength and initialStones, so long as you remember you won't be choosing them for ranking play.
I'm not maintaining the full changelog here anymore as the game's source repository is now publicly available. I'll just make note of the single latest change, so you can know how far behind you were lagging. Patches welcome, BTW.
This draft's last change is: early game termination.
Based on an involuntary suggestion by Zaap38 on the #Fr channel. The original appears to be by Romain André-Lovichi .