1 <div class="statement-body">
3 <div class="statement-section statement-goal">
5 <span class="icon icon-goal"> </span>
8 <div class="statement-goal-content">
9 Don't get destroyed by the troll.
13 <div class="statement-section statement-rules">
15 <span class="icon icon-rules"> </span>
18 <div class="statement-rules-content">
19 If you have stones, shoot <const>1</const> or more of them.
21 If you don't have stones, shoot <const>0</const> exactly.
24 <div class="statement-section statement-warning">
26 <span class="icon icon-warning"> </span>
27 <span>Rule Evolution</span>
29 <div class="statement-warning-content">
30 The following ideas are still in flux, waiting for some
31 opinions. Please drop a word on the
32 <a href="https://www.codingame.com/contribute/view/507070b7925f661e2d2835c14f950b9d157e">contribution's page</a>
34 <a href="https://forum.codingame.com/t/troll-vs-castles-brainstorm/184827?u=jbm">
39 Is it even worth publishing? can the problem be totally solved?
42 More maps? (a map is a {road length} × {initial stone count} pair)
43 → Yes, there will be more maps.
49 single small map, cheating is tolerated, boss plays tit
50 for tat (9/10) or cheats (1/10)
53 rock troll and ice troll unlocked; multiple rounds;
54 four maps available; no cheating; boss plays well but
58 all races unlocked; map continuum, no boss but default
60 <!-- I've actually got plans on a generic way to do
61 that. It's going to need many many hacks and a
62 viewer module. It's not planned for too soon. -->
65 For the WIP phase of this draft, I'll likely merge the last
66 two leagues into one because we need data on what makes the
70 <s>Fog of war?</s> Cancelled. Not in this game.
73 Praise for my artistic skillz. There can never be enough
82 <div class="statement-victory-conditions">
83 <div class="icon victory"></div>
85 <div class="title">Victory Condition</div>
86 <div class="text">Your opponent loses.</div>
89 <div class="statement-lose-conditions">
90 <div class="icon lose"></div>
92 <div class="title">Defeat Condition</div>
94 <li>The troll reaches your castle.</li>
95 <li>When no player has stones left, the troll is closer to your castle.</li>
99 <div class="statement-section statement-protocol">
101 <span class="icon icon-protocol"> </span>
102 <span>I/O Protocol</span>
104 <div class="statement-protocol-content">
105 <p style="margin-bottom: 1em">
106 This place used to read: “Just read the sample code. You can
107 figure this out.” Here are the formalities for <em>that
108 other</em> part of the audience.
111 <div class="title">Map Input</div>
114 Your first line of input contains three space-separated
116 <var>roadLength</var> <var>initialStones</var> <var>seed</var>
118 <dl style="margin: 1em;">
120 <dd style="margin-left: 6em;">
121 distance between both castles, between <const>6</const>
122 and <const>14</const>.
124 <dt>initialStones</dt>
125 <dd style="margin-left: 6em;">
126 number of stones a castle starts the day with,
127 between <const>0</const> and <const>50</const>.
130 <dd style="margin-left: 6em;">
131 the game's seed. The game AIs use it to provide you
132 with reproducible matches even when they use stochastic
133 algorithms, and you're encouraged to do the same! See
134 examples section below for simple ways to achieve that.
140 <div class="title">Turn Input</div>
143 At each turn, you are provided with the following three
144 space-separated values:
145 <var>trollDistance</var>
147 <var>opponentStones</var>
149 <dl style="margin: 1em;">
150 <dt>trollDistance</dt>
151 <dd style="margin-left: 6em;">
152 distance between the troll and your castle
155 <dd style="margin-left: 6em;">
156 number of stones you have left
158 <dt>opponentStones</dt>
159 <dd style="margin-left: 6em;">
160 number of stones your opponent has left
166 <div class="title">Turn Output</div>
169 After having received your turn input, you are to output
170 a single integer <var>stones</var>: the number of stones
171 you wish to throw at the troll.
173 <p style="margin-top: 1ex">
174 You may optionally provide a <em>message</em> you wish
175 your castle to yell at the troll or at your opponent.
176 Just append it to your output, being sure to separate it
177 with at least one space.
178 <!-- It has no incidence on the game whatsoever. Unless
179 you're god, that is. -->
184 <div class="title">Timing Considerations</div>
187 You're currently allowed the default SDK timings. I
188 think it's one second for the first turn and 50 ms
189 then, but don't quote me on this.
195 <div class="statement-section statement-expertrules">
197 <span class="icon icon-expertrules"> </span>
198 <span>Expert rules</span>
200 <div class="statement-expert-rules-content">
202 In the lower leagues, the following maps are currently
203 available and randomly yet extremely fairly (you wouldn't
204 believe the effort that went into this) chosen uniformly at
205 random among the following:
207 <table style="margin: 1ex">
209 <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Road length</th>
210 <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Stones</th>
213 <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
214 <td style="border-bottom: 1px dashed #f2bb13"><const>15</const></td>
217 <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
218 <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
221 <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
222 <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
225 <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
226 <td style="border-bottom: 1px dashed #f2bb13"><const>50</const></td>
230 You can also override them via game
231 settings <var>roadLength</var> and <var>initialStones</var>,
232 so long as you remember you won't be choosing them for
237 <div class="statement-section statement-protocol">
239 <span class="icon icon-protocol"> </span>
240 <span>Change Log</span>
243 I'm not maintaining the full changelog here anymore as the
244 <a href="https://troll.desast.re/troll.git">game's source
245 repository</a> is now publicly available. I'll just make note
246 of the single latest change, so you can know how far behind you
247 were lagging. Patches welcome, BTW.
250 This draft's last change is:
252 game seed is sent in inputs.
256 <div class="statement-story-background">
257 <div class="statement-story"
258 style="position: relative; min-height: min-content">
259 <div class="story-text">
260 <div style="text-align: center">
261 “Trolls simply detest the very sight of dwarves (uncooked).”
263 <div style="text-align: right">
264 — J.R.R. Tolkien, <i>The Hobbit</i>
267 <div class="story-text" style="margin-top: 4em">
269 Based on an involuntary suggestion by
270 <span class="card" cg-codingamer-card-popup=""
271 userid="user.codingamer.userId">
273 href="/profile/dbfa96e0ac9b77a3db679628f27224ae8509333"
274 title="Zaap38">Zaap38</a>
276 on the #Fr channel. The original appears to be by
277 <a href="http://andre.lovichi.free.fr/teaching/ea/2015-2016/cours/troll/Trolls_et_chateaux.pdf">
278 Romain André-Lovichi