Update statement to stabilize rule changes
[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        <p>
31          The game isn't finished, but I'm not taking any more
32          suggestions at this time, the path is now determined.  There
33          will be three leagues:
34        </p>
35        <ol>
36          <li>
37            single small map, cheating is tolerated, boss plays tit for
38            tat (9/10) or cheats (1/10)
39          </li>
40          <li>
41            rock troll and ice troll unlocked; multiple rounds;
42            four maps available; no cheating; boss plays well but
43            not perfect
44          </li>
45          <li>
46            all races unlocked; map continuum, no boss but default
47            AI doesn't lose.
48            <!-- I've actually got plans on a generic way to do
49                 that.  It's going to need many many hacks and a
50                 viewer module.  It's not planned for too soon.  -->
51          </li>
52        </ol>
53        <p>
54          For the WIP phase of this draft, I'll likely merge the last
55          two leagues into one because we need data on what makes the
56          games interesting.
57        </p>
58        <p>
59          You're still welcome to discuss the game
60          <a href="https://forum.codingame.com/t/troll-vs-castles-brainstorm/184827?u=jbm">
61            on the forum
62          </a>
63          or report a bug
64          <a href="https://www.codingame.com/contribute/view/507070b7925f661e2d2835c14f950b9d157e">
65            on the contribution's page.
66          </a>
67        </p>
68      </div>
69    </div>
70    <div class="statement-victory-conditions">
71      <div class="icon victory"></div>
72      <div class="blk">
73        <div class="title">Victory Condition</div>
74        <div class="text">Your opponent loses.</div>
75      </div>
76    </div>
77    <div class="statement-lose-conditions">
78      <div class="icon lose"></div>
79      <div class="blk">
80        <div class="title">Defeat Condition</div>
81        <ul>
82          <li>The troll reaches your castle.</li>
83          <li>When no player has stones left, the troll is closer to your castle.</li>
84        </ul>
85      </div>
86    </div>
87    <div class="statement-section statement-protocol">
88      <h2>
89        <span class="icon icon-protocol">&nbsp;</span>
90        <span>I/O Protocol</span>
91      </h2>
92      <div class="statement-protocol-content">
93        <p style="margin-bottom: 1em">
94          This place used to read: “Just read the sample code.  You can
95          figure this out.”  Here are the formalities for <em>that
96          other</em> part of the audience.
97        </p>
98        <div class="blk">
99          <div class="title">Map Input</div>
100          <div class="text">
101            <p>
102              Your first line of input contains five space-separated
103              parameters:
104            </p>
105            <dl style="margin: 1em;">
106              <dt><var>roadLength</var></dt>
107              <dd style="margin-left: 6em;">
108                distance between both castles, between <const>6</const>
109                and <const>14</const>.
110              </dd>
111              <dt><var>initialStones</var></dt>
112              <dd style="margin-left: 6em;">
113                number of stones a castle starts the day with,
114                between <const>0</const> and <const>50</const>.
115              </dd>
116              <dt><var>gameSeed</var></dt>
117              <dd style="margin-left: 6em;">
118                the game's seed.  The game AIs use it to provide you
119                with reproducible matches even when they use stochastic
120                algorithms, and you're encouraged to do the same!  See
121                examples section below for simple ways to achieve that.
122              </dd>
123              <dt><var>gameSide</var></dt>
124              <dd style="margin-left: 6em;">
125                which side you're on, as <const>-1</const>
126                or <const>1</const>.  It's not supposed to make a
127                difference to how you handle the rest of the game, but
128                you can XOR it to your <code>gameSeed</code> to have a
129                (reproducible) random that doesn't necessarily draw
130                when it plays against itself.
131              </dd>
132              <dt><var>reserved</var></dt>
133              <dd style="margin-left: 6em;">
134                reserved for future use, ignore for now.
135              </dd>
136            </dl>
137          </div>
138        </div>
139        <div class="blk">
140          <div class="title">Turn Input</div>
141          <div class="text">
142            <p>
143              At each turn, you are provided with the following three
144              space-separated values:
145            </p>
146            <dl style="margin: 1em;">
147              <dt><var>trollDistance</var></dt>
148              <dd style="margin-left: 6em;">
149                distance between the troll and your castle
150              </dd>
151              <dt><var>stones</var></dt>
152              <dd style="margin-left: 6em;">
153                number of stones you have left
154              </dd>
155              <dt><var>opponentStones</var></dt>
156              <dd style="margin-left: 6em;">
157                number of stones your opponent has left
158              </dd>
159            </dl>
160          </div>
161        </div>
162        <div class="blk">
163          <div class="title">Turn Output</div>
164          <div class="text">
165            <p>
166              After having received your turn input, you are to output
167              a single integer <var>stones</var>: the number of stones
168              you wish to throw at the troll.
169            </p>
170            <p style="margin-top: 1ex">
171              You may optionally provide a <em>message</em> you wish
172              your castle to yell at the troll or at your opponent.
173              Just append it to your output, being sure to separate it
174              with at least one space.
175              <!-- It has no incidence on the game whatsoever.  Unless
176              you're god, that is. -->
177            </p>
178          </div>
179        </div>
180        <div class="blk">
181          <div class="title">Timing Considerations</div>
182          <div class="text">
183            <p>
184              You're allowed the default SDK timings.  I think it's one
185              second for the first turn and 50&nbsp;ms then, but don't
186              quote me on this.
187            </p>
188          </div>
189        </div>
190      </div>
191    </div>
192    <div class="statement-section statement-examples">
193      <h2>
194        <span class="icon icon-example">&nbsp;</span>
195        <span>Proper RNG seeding examples</span>
196      </h2>
197      <style>
198        table.jbm-statement th { border-bottom: 2px dashed #f2bb13 }
199        table.jbm-statement td { border-bottom: 1px dashed #f2bb13 }
200      </style>
201      <table class="jbm-statement">
202        <tr>
203          <th>Language Family</th>
204          <th>Inspiration</th>
205        </tr>
206        <tr>
207          <td>JVM</td>
208          <td><code>
209              long mySecretSalt = 0x4242424242424242L;<br>
210              Random random = new Random(gameSeed ^ gameSide ^ mySecretSalt);
211          </code></td>
212        </tr>
213        <tr>
214          <td>C, C++, Perl&hellip;</td>
215          <td><code>
216              srand(gameSeed ^ gameSide ^ 0xdeadb33f);<br>
217              std::srand(gameSeed ^ gameSide ^ 12345);<br>
218              srand( $gameSeed ^ $gameSide ^ 0xCAFE_BABE );
219          </code></td>
220        </tr>
221        <tr>
222          <td>Other</td>
223          <td>Unachievable until proven otherwise</td>
224        </tr>
225      </table>
226    </div>
227    <div class="statement-section statement-expertrules">
228      <h2>
229        <span class="icon icon-expertrules">&nbsp;</span>
230        <span>Expert rules</span>
231      </h2>
232      <div class="statement-expert-rules-content">
233        <p>
234          In the lower leagues, the following maps are available and
235          randomly yet extremely fairly (you wouldn't believe the
236          effort that went into this) chosen uniformly at random among
237          the following:
238        </p>
239        <style>
240          table#jbm-maps th {
241            min-width: 6em;
242            text-align: right;
243          }
244          table#jbm-maps td {
245            text-align: right;
246            padding-right: 1em;
247          }
248        </style>
249        <table class="jbm-statement" id="jbm-maps" style="margin: 1ex">
250          <tr>
251            <th>Road length</th>
252            <th>Stones</th>
253          </tr>
254          <tr>
255            <td><const>6</const></td>
256            <td><const>15</const></td>
257          </tr>
258          <tr>
259            <td><const>6</const></td>
260            <td><const>30</const></td>
261          </tr>
262          <tr>
263            <td><const>14</const></td>
264            <td><const>30</const></td>
265          </tr>
266          <tr>
267            <td><const>14</const></td>
268            <td><const>50</const></td>
269          </tr>
270        </table>
271        <p>
272          You may also override them via game
273          settings <var>roadLength</var> and <var>initialStones</var>,
274          so long as you remember you won't be choosing them for
275          ranking play.
276        </p>
277      </div>
278    </div>
279    <div class="statement-section statement-protocol">
280      <h2>
281        <span class="icon icon-protocol">&nbsp;</span>
282        <span>Change Log</span>
283      </h2>
284      <p>
285        I'm not maintaining the full changelog here anymore as the
286        <a href="https://troll.desast.re/troll.git">game's source
287        repository</a> is now publicly available.  I'll just make note
288        of the single latest change, so you can know how far behind you
289        were lagging.  Patches welcome, BTW.
290      </p>
291      <p>
292        This draft's last change is:
293        <strong>
294          not taking any more suggestions.
295        </strong>
296      </p>
297    </div>
298    <div class="statement-story-background">
299      <div class="statement-story"
300           style="position: relative; min-height: min-content">
301        <div class="story-text">
302          <div style="text-align: center">
303            &ldquo;Trolls simply detest the very sight of dwarves (uncooked).&rdquo;
304          </div>
305          <div style="text-align: right">
306            &mdash;&nbsp;J.R.R. Tolkien, <i>The Hobbit</i>
307          </div>
308        </div>
309        <div class="story-text" style="margin-top: 4em">
310          <p>
311            Based on an involuntary suggestion by
312            <span class="card" cg-codingamer-card-popup=""
313                  userid="user.codingamer.userId">
314              <a class="pseudo"
315                 href="/profile/dbfa96e0ac9b77a3db679628f27224ae8509333"
316                 title="Zaap38">Zaap38</a>
317            </span>
318            on the #Fr channel.  The original appears to be by
319            <a href="http://andre.lovichi.free.fr/teaching/ea/2015-2016/cours/troll/Trolls_et_chateaux.pdf">
320              Romain Andr&eacute;-Lovichi
321            </a>.
322          </p>
323        </div>
324      </div>
325    </div>
326 </div>