05a95cfc6037a03e1b644d9ca06e66b285fd2784
[troll.git] / config / statement_en.html
1 <div class="statement-body">
2    <!-- GOAL --> 
3    <div class="statement-section statement-goal"> 
4      <h2> 
5        <span class="icon icon-goal">&nbsp;</span> 
6        <span>The Goal</span> 
7      </h2> 
8      <div class="statement-goal-content"> 
9        Don't get destroyed by the troll.
10      </div>
11    </div> 
12    <!-- RULES --> 
13    <div class="statement-section statement-rules"> 
14      <h2> 
15        <span class="icon icon-rules">&nbsp;</span> 
16        <span>Rules</span> 
17      </h2> 
18      <div class="statement-rules-content">
19        If you have stones, shoot <const>1</const> or more of them.
20        <br>
21        If you don't have stones, shoot <const>0</const> exactly.
22      </div>
23    </div>
24    <div class="statement-section statement-warning">
25      <h2>
26        <span class="icon icon-warning">&nbsp;</span>
27        <span>Rule Evolution</span>
28      </h2>
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>
33        or
34        <a href="https://forum.codingame.com/t/troll-vs-castles-brainstorm/184827?u=jbm">
35          on the forum
36        </a>
37        <ul>
38          <li><s>
39            Is it even worth publishing? can the problem be totally solved?
40          </s></li>
41          <li>
42            More maps? (a map is a {road length} × {initial stone count} pair)
43            → Yes, there will be more maps.
44          </li>
45          <li>
46            Leagues
47            <ol>
48              <li>
49                single small map, cheating is tolerated, boss plays tit
50                for tat (9/10) or cheats (1/10)
51              </li>
52              <li>
53                rock troll and ice troll unlocked; multiple rounds;
54                four maps available; no cheating; boss plays well but
55                not perfect
56              </li>
57              <li>
58                all races unlocked; map continuum, no boss but default
59                AI doesn't lose.
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.  -->
63              </li>
64            </ol>
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
67            games interesting.
68          </li>
69          <li>
70            <s>Fog of war?</s> Cancelled.  Not in this game.
71          </li>
72          <li>
73            Praise for my artistic skillz.  There can never be enough
74            of that.
75          </li>
76          <li>
77            Other remarks?
78          </li>
79        </ul>
80      </div>
81    </div>
82    <div class="statement-victory-conditions">
83      <div class="icon victory"></div>
84      <div class="blk">
85        <div class="title">Victory Condition</div>
86        <div class="text">Your opponent loses.</div>
87      </div>
88    </div>
89    <div class="statement-lose-conditions">
90      <div class="icon lose"></div>
91      <div class="blk">
92        <div class="title">Defeat Condition</div>
93        <ul>
94          <li>The troll reaches your castle.</li>
95          <li>When no player has stones left, the troll is closer to your castle.</li>
96        </ul>
97      </div>
98    </div>
99    <div class="statement-section statement-protocol">
100      <h2>
101        <span class="icon icon-protocol">&nbsp;</span>
102        <span>I/O Protocol</span>
103      </h2>
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.
109        </p>
110        <div class="blk">
111          <div class="title">Map Input</div>
112          <div class="text">
113            <p>
114              This section's HTML gets messed up somewhere in the SDK
115              pipeline.  <a href="https://forum.codingame.com/t/misleading-html-in-the-sdk-skeleton/184828/8?u=jbm">I reported it there;</a> and there
116              you'll be able to find a readable representation of this
117              block.  Sorry about the inconvenience&hellip;
118            </p>
119            <p>
120              Your first line of input contains five space-separated
121              parameters:
122              <var>roadLength</var> <var>initialStones</var>
123              <var>gameSeed</var> <var>gameSide</var>
124              <var>reserved</var>
125            </p>
126            <dl style="margin: 1em;">
127              <dt>roadLength</dt>
128              <dd style="margin-left: 6em;">
129                distance between both castles, between <const>6</const>
130                and <const>14</const>.
131              </dd>
132              <dt>initialStones</dt>
133              <dd style="margin-left: 6em;">
134                number of stones a castle starts the day with,
135                between <const>0</const> and <const>50</const>.
136              </dd>
137              <dt>gameSeed</dt>
138              <dd style="margin-left: 6em;">
139                the game's seed.  The game AIs use it to provide you
140                with reproducible matches even when they use stochastic
141                algorithms, and you're encouraged to do the same!  See
142                examples section below for simple ways to achieve that.
143              </dd>
144              <dt>gameSide</dt>
145              <dd style="margin-left: 6em;">
146                which side you're on, as <const>-1</const>
147                or <const>1</const>.  It's not supposed to make a
148                difference to how you handle the rest of the game, but
149                you can XOR it to your <code>gameSeed</code> to have a
150                (reproducible) random that doesn't mecessarily draw
151                when it plays against itself.
152              </dd>
153              <dt>reserved</dt>
154              <dd style="margin-left: 6em;">
155                reserved for future use, ignore for now
156              </dd>
157            </dl>
158          </div>
159        </div>
160        <div class="blk">
161          <div class="title">Turn Input</div>
162          <div class="text">
163            <p>
164              At each turn, you are provided with the following three
165              space-separated values:
166              <var>trollDistance</var>
167              <var>stones</var>
168              <var>opponentStones</var>
169            </p>
170            <dl style="margin: 1em;">
171              <dt>trollDistance</dt>
172              <dd style="margin-left: 6em;">
173                distance between the troll and your castle
174              </dd>
175              <dt>stones</dt>
176              <dd style="margin-left: 6em;">
177                number of stones you have left
178              </dd>
179              <dt>opponentStones</dt>
180              <dd style="margin-left: 6em;">
181                number of stones your opponent has left
182              </dd>
183            </dl>
184          </div>
185        </div>
186        <div class="blk">
187          <div class="title">Turn Output</div>
188          <div class="text">
189            <p>
190              After having received your turn input, you are to output
191              a single integer <var>stones</var>: the number of stones
192              you wish to throw at the troll.
193            </p>
194            <p style="margin-top: 1ex">
195              You may optionally provide a <em>message</em> you wish
196              your castle to yell at the troll or at your opponent.
197              Just append it to your output, being sure to separate it
198              with at least one space.
199              <!-- It has no incidence on the game whatsoever.  Unless
200              you're god, that is. -->
201            </p>
202          </div>
203        </div>
204        <div class="blk">
205          <div class="title">Timing Considerations</div>
206          <div class="text">
207            <p>
208              You're currently allowed the default SDK timings.  I
209              think it's one second for the first turn and 50&nbsp;ms
210              then, but don't quote me on this.
211            </p>
212          </div>
213        </div>
214      </div>
215    </div>
216    <div class="statement-section statement-examples">
217      <h2>
218        <span class="icon icon-example">&nbsp;</span>
219        <span>Proper RNG seeding examples</span>
220      </h2>
221      <table>
222        <tr>
223          <th style="border-bottom: 2px dashed #f2bb13;">Language Family</th>
224          <th style="border-bottom: 2px dashed #f2bb13;">Sample</th>
225        </tr>
226        <tr>
227          <td style="border-bottom: 1px dashed #f2bb13;">JVM</td>
228          <td style="border-bottom: 1px dashed #f2bb13;"><code>
229              long mySecretSalt = 0x4242424242424242L;<br>
230              Random random = new Random(gameSeed ^ gameSide ^ mySecretSalt);
231          </code></td>
232        </tr>
233        <tr>
234          <td style="border-bottom: 1px dashed #f2bb13;">C, C++, Perl&hellip;</td>
235          <td style="border-bottom: 1px dashed #f2bb13;"><code>
236              srand(gameSeed ^ gameSide ^ 0xdeadb33f);<br>
237              std::srand(gameSeed ^ gameSide ^ 12345);<br>
238              srand( $gameSeed ^ $gameSide ^ 0xCAFE_BABE );
239          </code></td>
240        </tr>
241        <tr>
242          <td style="border-bottom: 1px dashed #f2bb13;">Other</td>
243          <td style="border-bottom: 1px dashed #f2bb13;">Unachievable until proven otherwise</td>
244        </tr>
245      </table>
246    </div>
247    <div class="statement-section statement-expertrules">
248      <h2>
249        <span class="icon icon-expertrules">&nbsp;</span>
250        <span>Expert rules</span>
251      </h2>
252      <div class="statement-expert-rules-content">
253        <p>
254          In the lower leagues, the following maps are currently
255          available and randomly yet extremely fairly (you wouldn't
256          believe the effort that went into this) chosen uniformly at
257          random among the following:
258        </p>
259        <table style="margin: 1ex">
260          <tr>
261            <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Road length</th>
262            <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Stones</th>
263          </tr>
264          <tr>
265            <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
266            <td style="border-bottom: 1px dashed #f2bb13"><const>15</const></td>
267          </tr>
268          <tr>
269            <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
270            <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
271          </tr>
272          <tr>
273            <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
274            <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
275          </tr>
276          <tr>
277            <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
278            <td style="border-bottom: 1px dashed #f2bb13"><const>50</const></td>
279          </tr>
280        </table>
281        <p>
282          You can also override them via game
283          settings <var>roadLength</var> and <var>initialStones</var>,
284          so long as you remember you won't be choosing them for
285          ranking play.
286        </p>
287      </div>
288    </div>
289    <div class="statement-section statement-protocol">
290      <h2>
291        <span class="icon icon-protocol">&nbsp;</span>
292        <span>Change Log</span>
293      </h2>
294      <p>
295        I'm not maintaining the full changelog here anymore as the
296        <a href="https://troll.desast.re/troll.git">game's source
297        repository</a> is now publicly available.  I'll just make note
298        of the single latest change, so you can know how far behind you
299        were lagging.  Patches welcome, BTW.
300      </p>
301      <p>
302        This draft's last change is:
303        <strong>
304          early game termination.
305        </strong>
306      </p>
307    </div>
308    <div class="statement-story-background">
309      <div class="statement-story"
310           style="position: relative; min-height: min-content">
311        <div class="story-text">
312          <div style="text-align: center">
313            &ldquo;Trolls simply detest the very sight of dwarves (uncooked).&rdquo;
314          </div>
315          <div style="text-align: right">
316            &mdash;&nbsp;J.R.R. Tolkien, <i>The Hobbit</i>
317          </div>
318        </div>
319        <div class="story-text" style="margin-top: 4em">
320          <p>
321            Based on an involuntary suggestion by
322            <span class="card" cg-codingamer-card-popup=""
323                  userid="user.codingamer.userId">
324              <a class="pseudo"
325                 href="/profile/dbfa96e0ac9b77a3db679628f27224ae8509333"
326                 title="Zaap38">Zaap38</a>
327            </span>
328            on the #Fr channel.  The original appears to be by
329            <a href="http://andre.lovichi.free.fr/teaching/ea/2015-2016/cours/troll/Trolls_et_chateaux.pdf">
330              Romain Andr&eacute;-Lovichi
331            </a>.
332          </p>
333        </div>
334      </div>
335    </div>
336 </div>