- [ ] troll pants colors
* TODO Troll quotes
- pain au chocolat ou chocolatine
-* TODO initial model parametrization
+* DONE initial model parametrization
* TODO view parameterization?
* TODO troll races
<div class="statement-section statement-expertrules">
<h2>
<span class="icon icon-expertrules"> </span>
- <span>Maps</span>
+ <span>Expert rules</span>
</h2>
<div class="statement-expert-rules-content">
<p>
is <strong>subject to change without notice</strong>. Why do
you think they're provided in the game input?
</p>
+ <p>
+ You can also override them via game
+ settings <tt>roadLength</tt> and <tt>initialStones</tt>.
+ </p>
</div>
</div>
<div class="statement-section statement-protocol">
<p>
This draft's last change is:
<strong>
- the troll can speak.
+ game parameters can be overridden.
</strong>
</p>
</div>
package com.codingame.game;
import java.util.Random;
+import java.util.Properties;
+import com.codingame.gameengine.core.GameManager;
import com.codingame.gameengine.core.MultiplayerGameManager;
import com.google.inject.Inject;
break;
}
+ Properties ps = gameManager.getGameParameters();
+ String buf = ps.getProperty("roadLength");
+ if (buf != null) {
+ try {
+ int i = Integer.parseInt(buf);
+ if (i < 0 || i > 20 || (i & 1) != 0) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ignoring invalid road length: " + buf));
+ }
+ else {
+ roadLength = i;
+ gameManager.addToGameSummary("Road length overridden to " + i);
+ }
+ }
+ catch(NumberFormatException e) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ill-formed road length: " + buf));
+ }
+ }
+ buf = ps.getProperty("initialStones");
+ if (buf != null) {
+ try {
+ int i = Integer.parseInt(buf);
+ if (i > 50) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ignoring invalid initial stone count: " + buf));
+ }
+ else {
+ initialStones = i;
+ gameManager.addToGameSummary("Initial stone count overridden to " + buf);
+ }
+ }
+ catch (NumberFormatException e) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ill-formed initial stone count: " + buf));
+ }
+ }
+
trollPosition = roadLength / 2;
p0 = new Player(0);
+import java.util.Properties;
+
import com.codingame.gameengine.runner.MultiplayerGameRunner;
public class Main {
public static void main(String[] args) {
+ Properties props = new Properties();
+ props.setProperty("seed", "3");
MultiplayerGameRunner gameRunner = new MultiplayerGameRunner();
+ gameRunner.setGameParameters(props);
+
gameRunner.addAgent(Player1.class);
gameRunner.addAgent(PlayerRand.class);