Reorganize View/Player
[troll.git] / config / statement_en.html
index 89a0e27..35242fa 100644 (file)
        <span>Rules</span> 
      </h2> 
      <div class="statement-rules-content">
-       You <em>have</em> to shoot at least <const>1</const> stone per
-       turn if you have any left.
-     </div> 
-   </div>
-   <div class="statement-section statement-warning">
-     <h2>
-       <span class="icon icon-warning">&nbsp;</span>
-       <span>Breaking Change</span>
-     </h2>
-     <p>
-       The <var>roadLength</var> game input variable used to be the
-       cardinal number of positions the troll could be in.  That's the
-       way it was presented in the original game, but I leaned more
-       towards distances to make the I/O protocol easier on beginners.
-       So it's currently inconsistent.
-     </p>
-     <p>
-       This is going to change in the following days to be a distance
-       everywhere, more in line with the protocol's other measures.
-       Not to mention being somewhat more consistent with the variable
-       name.  Thanks
-       <a href="https://www.codingame.com/profile/c4a50746f425cb125f77487aaf51350c7258821">
-         @Snef
-       </a>
-       for reminding me of this.
-     </p>
-     <p>
-       If you used this variable, I suggest you temporarily used one
-       of these workarounds so you don't get bit by the upcoming
-       change:
-     </p>
-     <table>
-       <tr><th>Former use</th><th>As a</th><th>Try this</th></tr>
-       <tr>
-         <td><pre>roadLength - 1</pre></td>
-         <td><pre>distance to opponent</pre></td>
-         <td><pre>roadLength & (~1)</pre></td>
-       </tr>
-       <tr>
-         <td><pre>roadLength</pre></td>
-         <td><pre>number of troll states</pre></td>
-         <td><pre>roadLength | 1</pre></td>
-       </tr>
-       <tr>
-         <td><pre>roadLength + 1</pre></td>
-         <td><pre>I have no idea</pre></td>
-         <td><pre>(roadLength + 1) & (-1)</pre></td>
-       </tr>
-     </table>
+       If you have stones, shoot <const>1</const> or more of them.
+       <br>
+       If you don't have stones, shoot <const>0</const> exactly.
+     </div>
    </div>
    <div class="statement-section statement-warning">
      <h2>
      <div class="statement-warning-content">
        The following ideas are still in flux, waiting for some
        opinions.  Please drop a word on the
-       <a href="https://www.codingame.com/contribute/view/507070b7925f661e2d2835c14f950b9d157e">
-         contribution's page
-       </a>
+       <a href="https://www.codingame.com/contribute/view/507070b7925f661e2d2835c14f950b9d157e">contribution's page</a>
        or
        <a href="https://forum.codingame.com/t/troll-vs-castles-brainstorm/184827?u=jbm">
          on the forum
        </a>
        <ul>
-         <li>
+         <li><s>
            Is it even worth publishing? can the problem be totally solved?
-         </li>
+         </s></li>
          <li>
            More maps? (a map is a {road length} × {initial stone count} pair)
+           → Yes, there will be more maps.
          </li>
          <li>
-           Leagues? I could conceive the referee being permissive
-           (allow 0 stones thrown) in the first one, and then strict.
-         </li>
-         <li>
-           Fog of war? (see only troll position, not enemy throw/stones left)
+           Leagues
+           <ol>
+             <li>
+               single small map, cheating is tolerated, boss plays tit
+               for tat (9/10) or cheats (1/10)
+             </li>
+             <li>
+               rock troll and ice troll unlocked; multiple rounds;
+               four maps available; no cheating; boss plays well but
+               not perfect
+             </li>
+             <li>
+               all races unlocked; map continuum, no boss but default
+               AI doesn't lose.
+               <!-- I've actually got plans on a generic way to do
+                    that.  It's going to need many many hacks and a
+                    viewer module.  It's not planned for too soon.  -->
+             </li>
+           </ol>
+           For the WIP phase of this draft, I'll likely merge the last
+           two leagues into one because we need data on what makes the
+           games interesting.
          </li>
          <li>
-           <strong>variable</strong> for of war? (seeing enemy stones
-           is a boolean decided randomly as part of the map?
+           <s>Fog of war?</s> Cancelled.  Not in this game.
          </li>
          <li>
-           alternative fog of war? (seeing enemy stones only when
-           troll is close to us?)
-         </li>
-         <li>
-           Praise for my artistic skillz
+           Praise for my artistic skillz.  There can never be enough
+           of that.
          </li>
          <li>
            Other remarks?
        <span>I/O Protocol</span>
      </h2>
      <div class="statement-protocol-content">
-       Just read the sample code.  You can figure this out.
+       <p style="margin-bottom: 1em">
+         This place used to read: “Just read the sample code.  You can
+         figure this out.”  Here are the formalities for <em>that
+         other</em> part of the audience.
+       </p>
+       <div class="blk">
+         <div class="title">Map Input</div>
+         <div class="text">
+           <p>
+             This section's HTML gets messed up somewhere in the SDK
+             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
+             you'll be able to find a readable representation of this
+             block.  Sorry about the inconvenience&hellip;
+           </p>
+           <p>
+             Your first line of input contains five space-separated
+             parameters:
+             <var>roadLength</var> <var>initialStones</var>
+             <var>gameSeed</var> <var>gameSide</var>
+             <var>reserved</var>
+           </p>
+           <dl style="margin: 1em;">
+             <dt>roadLength</dt>
+             <dd style="margin-left: 6em;">
+               distance between both castles, between <const>6</const>
+               and <const>14</const>.
+             </dd>
+             <dt>initialStones</dt>
+             <dd style="margin-left: 6em;">
+               number of stones a castle starts the day with,
+               between <const>0</const> and <const>50</const>.
+             </dd>
+             <dt>gameSeed</dt>
+             <dd style="margin-left: 6em;">
+               the game's seed.  The game AIs use it to provide you
+               with reproducible matches even when they use stochastic
+               algorithms, and you're encouraged to do the same!  See
+               examples section below for simple ways to achieve that.
+             </dd>
+             <dt>gameSide</dt>
+             <dd style="margin-left: 6em;">
+               which side you're on, as <const>-1</const>
+               or <const>1</const>.  It's not supposed to make a
+               difference to how you handle the rest of the game, but
+               you can XOR it to your <code>gameSeed</code> to have a
+               (reproducible) random that doesn't mecessarily draw
+               when it plays against itself.
+             </dd>
+             <dt>reserved</dt>
+             <dd style="margin-left: 6em;">
+               reserved for future use, ignore for now
+             </dd>
+           </dl>
+         </div>
+       </div>
+       <div class="blk">
+         <div class="title">Turn Input</div>
+         <div class="text">
+           <p>
+             At each turn, you are provided with the following three
+             space-separated values:
+             <var>trollDistance</var>
+             <var>stones</var>
+             <var>opponentStones</var>
+           </p>
+           <dl style="margin: 1em;">
+             <dt>trollDistance</dt>
+             <dd style="margin-left: 6em;">
+               distance between the troll and your castle
+             </dd>
+             <dt>stones</dt>
+             <dd style="margin-left: 6em;">
+               number of stones you have left
+             </dd>
+             <dt>opponentStones</dt>
+             <dd style="margin-left: 6em;">
+               number of stones your opponent has left
+             </dd>
+           </dl>
+         </div>
+       </div>
+       <div class="blk">
+         <div class="title">Turn Output</div>
+         <div class="text">
+           <p>
+             After having received your turn input, you are to output
+             a single integer <var>stones</var>: the number of stones
+             you wish to throw at the troll.
+           </p>
+           <p style="margin-top: 1ex">
+             You may optionally provide a <em>message</em> 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.
+             <!-- It has no incidence on the game whatsoever.  Unless
+             you're god, that is. -->
+           </p>
+         </div>
+       </div>
+       <div class="blk">
+         <div class="title">Timing Considerations</div>
+         <div class="text">
+           <p>
+             You're currently allowed the default SDK timings.  I
+             think it's one second for the first turn and 50&nbsp;ms
+             then, but don't quote me on this.
+           </p>
+         </div>
+       </div>
      </div>
    </div>
+   <div class="statement-section statement-examples">
+     <h2>
+       <span class="icon icon-example">&nbsp;</span>
+       <span>Proper RNG seeding examples</span>
+     </h2>
+     <table>
+       <tr>
+         <th style="border-bottom: 2px dashed #f2bb13;">Language Family</th>
+         <th style="border-bottom: 2px dashed #f2bb13;">Sample</th>
+       </tr>
+       <tr>
+         <td style="border-bottom: 1px dashed #f2bb13;">JVM</td>
+         <td style="border-bottom: 1px dashed #f2bb13;"><code>
+             long mySecretSalt = 0x4242424242424242L;<br>
+             Random random = new Random(gameSeed ^ gameSide ^ mySecretSalt);
+         </code></td>
+       </tr>
+       <tr>
+         <td style="border-bottom: 1px dashed #f2bb13;">C, C++, Perl&hellip;</td>
+         <td style="border-bottom: 1px dashed #f2bb13;"><code>
+             srand(gameSeed ^ gameSide ^ 0xdeadb33f);<br>
+             std::srand(gameSeed ^ gameSide ^ 12345);<br>
+             srand( $gameSeed ^ $gameSide ^ 0xCAFE_BABE );
+         </code></td>
+       </tr>
+       <tr>
+         <td style="border-bottom: 1px dashed #f2bb13;">Other</td>
+         <td style="border-bottom: 1px dashed #f2bb13;">Unachievable until proven otherwise</td>
+       </tr>
+     </table>
+   </div>
    <div class="statement-section statement-expertrules">
      <h2>
        <span class="icon icon-expertrules">&nbsp;</span>
-       <span>Maps</span>
+       <span>Expert rules</span>
      </h2>
      <div class="statement-expert-rules-content">
        <p>
-         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:
+         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:
        </p>
-       <table>
-         <tr><th>Road length</th><th>Stones</th></tr>
-         <tr><td><const>7</const></td><td><const>15</const></td></tr>
-         <tr><td><const>7</const></td><td><const>30</const></td></tr>
-         <tr><td><const>15</const></td><td><const>30</const></td></tr>
-         <tr><td><const>15</const></td><td><const>50</const></td></tr>
+       <table style="margin: 1ex">
+         <tr>
+           <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Road length</th>
+           <th style="border-bottom: 2px dashed #f2bb13; min-width: 6em;">Stones</th>
+         </tr>
+         <tr>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>15</const></td>
+         </tr>
+         <tr>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>6</const></td>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
+         </tr>
+         <tr>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>30</const></td>
+         </tr>
+         <tr>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>14</const></td>
+           <td style="border-bottom: 1px dashed #f2bb13"><const>50</const></td>
+         </tr>
        </table>
        <p>
-         As with anything in this <em>draft</em> statement, this
-         is <strong>subject to change without notice</strong>.  Why do
-         you think they're provided in the game input?
+         You can also override them via game
+         settings <var>roadLength</var> and <var>initialStones</var>,
+         so long as you remember you won't be choosing them for
+         ranking play.
        </p>
      </div>
    </div>
        <span class="icon icon-protocol">&nbsp;</span>
        <span>Change Log</span>
      </h2>
-     <ul>
-       <li>
-         Of course that game needed MSG functionality!
-       </li>
-       <li>
-         Enforce the one-stone rule.  (that also fixed the legacy
-         buh&mdash;sorry people!  I put an easter egg in exchange)
-       </li>
-       <li>
-         Cutesy defeat animations.
-       </li>
-       <li>
-         Distinct castle sprites!
-       </li>
-       <li>
-         Terminate game when there are no more stones in sight.
-       </li>
-       <li>
-         More pretty. (SRLSLY)
-       </li>
-       <li>
-         No more void maps. (root cause: Java <const>%</const> on a
-         negative seed)
-       </li>
-     </ul>
+     <p>
+       I'm not maintaining the full changelog here anymore as the
+       <a href="https://troll.desast.re/troll.git">game's source
+       repository</a> 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.
+     </p>
+     <p>
+       This draft's last change is:
+       <strong>
+         demo references still existing sprites.
+       </strong>
+     </p>
    </div>
    <div class="statement-story-background">
      <div class="statement-story"
           style="position: relative; min-height: min-content">
        <div class="story-text">
-         Based on an involuntary suggestion by
-         <span class="card" cg-codingamer-card-popup=""
-               userid="user.codingamer.userId">
-           <a class="pseudo"
-              href="/profile/dbfa96e0ac9b77a3db679628f27224ae8509333"
-              title="Zaap38">Zaap38</a>
-         </span>
-         on the #Fr channel.  The original appears to be by
-         <a href="http://andre.lovichi.free.fr/teaching/ea/2015-2016/cours/troll/Trolls_et_chateaux.pdf">
-           Romain Andr&eacute;-Lovichi
-         </a>.
+         <div style="text-align: center">
+           &ldquo;Trolls simply detest the very sight of dwarves (uncooked).&rdquo;
+         </div>
+         <div style="text-align: right">
+           &mdash;&nbsp;J.R.R. Tolkien, <i>The Hobbit</i>
+         </div>
+       </div>
+       <div class="story-text" style="margin-top: 4em">
+         <p>
+           Based on an involuntary suggestion by
+           <span class="card" cg-codingamer-card-popup=""
+                 userid="user.codingamer.userId">
+             <a class="pseudo"
+                href="/profile/dbfa96e0ac9b77a3db679628f27224ae8509333"
+                title="Zaap38">Zaap38</a>
+           </span>
+           on the #Fr channel.  The original appears to be by
+           <a href="http://andre.lovichi.free.fr/teaching/ea/2015-2016/cours/troll/Trolls_et_chateaux.pdf">
+             Romain Andr&eacute;-Lovichi
+           </a>.
+         </p>
        </div>
      </div>
    </div>