X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/7b8732a6aba5c34e24aa324a25e2fae37f7149a7..67375eefceac8e1ff648bc76f25a450a3143535f:/src/main/java/com/codingame/game/Player.java?ds=inline diff --git a/src/main/java/com/codingame/game/Player.java b/src/main/java/com/codingame/game/Player.java index cb5bb4a..79d5aeb 100644 --- a/src/main/java/com/codingame/game/Player.java +++ b/src/main/java/com/codingame/game/Player.java @@ -16,7 +16,6 @@ import com.codingame.gameengine.module.entities.Sprite; public class Player extends AbstractMultiplayerPlayer { Model.Player model; View.Player view; - Random random = new Random(); @Override public int getExpectedOutputLines() { @@ -24,13 +23,10 @@ public class Player extends AbstractMultiplayerPlayer { } // same-typed positional parameters… a disaster waiting to happen - void gameInit(int roadLength, int initialStones, long seed) { - int nReserved = random.nextInt(5); - String reserved = ""; - while (nReserved --> 0) reserved += " 0"; - sendInputLine(String.format("%d %d %d %d%s", + void gameInit(int roadLength, int initialStones, long seed, long salt) { + sendInputLine(String.format("%d %d %d %d %d", roadLength, initialStones, seed, - model.getMultiplier(), reserved)); + model.getMultiplier(), salt)); } void sendGameTurn() { @@ -65,7 +61,7 @@ public class Player extends AbstractMultiplayerPlayer { catch (NoSuchElementException e) { type = Action.Invalid; return; } s.useDelimiter(eol); - if (s.hasNext(rest)) messageString = s.next(rest); + if (s.hasNext(rest)) messageString = s.next(rest).trim(); else messageString = ""; type = Action.Throw; }