* DONE left win bias bug
* DONE upgrade deps
* DONE Timings
-* TODO Protocol
+* DONE Protocol
* DONE fenceposts
* Quotes to include
Trolls, it is said, were bred by Melkor because he desired a race as powerful as the giant Ents, the Tree-herds.
Trolls are only counterfeits, made by the Enemy in the Great Darkness, in mockery of Ents, as Orcs were of Elves.
J. R. R. Tolkien, The Two Towers (1954), Book III, Chapter 4: "Treebeard"
* TODO View settings
-- [ ] troll pants colors
+- [X] troll pants colors
* TODO Internationalised troll quotes
- pain au chocolat ou chocolatine
* DONE initial model parametrization
* DONE view parameterization?
* DONE troll races
+* TODO html for salting the seed
* BUGS
** viewer goes blank <2020-06-03 mer. 22:58>
(22:19:12) Astrobytes: JBM, if you're around, the TVC viewer goes blank after a couple of games. Consistently. In Chrome. Other games not doing the same.
int roadLength = in.nextInt();
int initialStones = in.nextInt();
- in.nextLong();
+ in.nextLong(); // seed
+ in.nextInt(); // side
+ nextLine();
while (true) {
int trollDistance = in.nextInt();
<div class="title">Map Input</div>
<div class="text">
<p>
- Your first line of input contains three space-separated
+ Your first line of input contains space-separated
parameters:
- <var>roadLength</var> <var>initialStones</var> <var>seed</var>
+ <var>roadLength</var> <var>initialStones</var>
+ <var>gameSeed</var> <var>gameSide</var>
+ <var>reserved1</var> … <var>reservedN</var>
</p>
<dl style="margin: 1em;">
<dt>roadLength</dt>
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<em>N</em></dt>
+ <dd style="margin-left: 6em;">
+ one or more parameters, reserved for future use
+ </dd>
</dl>
</div>
</div>
-read roadLength:int initialStones:int gameSeed:long
+read roadLength:int initialStones:int gameSeed:long gameSide:int reserved:int
gameloop
read trollDistance:int stones:int opponentStones:int
write 1
roadLength: the distance (even) between both castles. The troll starts at half that distance.
initialStones: the number of stones each castle starts with.
gameSeed: a random number to salt and help make your games more reproducible.
+gameSide: a suggested partial salt to help make your reproducible games more interesting.
+reserved: first unused parameter. There may be more to come.
trollDistance: distance between the troll and your castle. Keep it above zero!
stones: number of stones you have left.
opponentStones: number of stones your opponent has left.
package com.codingame.game;
import java.util.List;
+import java.util.Random;
import java.util.regex.Pattern;
import java.util.Scanner;
public class Player extends AbstractMultiplayerPlayer {
Model.Player model;
View.Player view;
+ Random random = new Random();
@Override
public int getExpectedOutputLines() {
// same-typed positional parameters… a disaster waiting to happen
void gameInit(int roadLength, int initialStones, long seed) {
- sendInputLine(String.format("%d %d %d",
- roadLength, initialStones, seed));
+ int nReserved = random.nextInt(5);
+ String reserved = "";
+ while (nReserved --> 0) reserved += " 0";
+ sendInputLine(String.format("%d %d %d %d%s",
+ roadLength, initialStones, seed,
+ model.getMultiplier(), reserved));
}
void sendGameTurn() {
int roadLength = in.nextInt();
int initialStones = in.nextInt();
+ in.nextLine();
while (true) {
int trollDistance = in.nextInt();
int roadLength = in.nextInt();
int initialStones = in.nextInt();
+ in.nextLine();
while (true) {
int trollDistance = in.nextInt();
int roadLength = in.nextInt();
int initialStones = in.nextInt();
+ in.nextLine();
while (true) {
int trollDistance = in.nextInt();
int roadLength = in.nextInt();
int initialStones = in.nextInt();
+ in.nextLine();
while (true) {
int trollDistance = in.nextInt();