- static final Pattern rest = Pattern.compile(".*");
- static final Pattern eol = Pattern.compile("\n");
- public int getAction() throws TimeoutException, NumberFormatException {
- Scanner s = new Scanner(getOutputs().get(0));
+ // same-typed positional parameters… a disaster waiting to happen
+ void gameInit(int roadLength, int initialStones, long seed, long salt) {
+ sendInputLine(String.format("%d %d %d %d %d",
+ roadLength, initialStones, seed,
+ model.getMultiplier(), salt));
+ }
+
+ void sendGameTurn() {
+ type = null; //
+ stoneThrow = null; // correctness over stability!
+ messageString = null; //
+
+ sendInputLine(String.format("%d %d %d",
+ model.getTrollDistance(),
+ model.getStones(),
+ model.getOppStones()));
+ execute();
+ }
+
+ static enum Action { Throw, Timeout, Invalid }
+ Action type;
+ Integer stoneThrow;
+ String messageString;
+
+ private void reportMsg(String tag) {
+ System.err.println("Message @" + tag + ": " + messageString);
+ }
+
+ void receiveGameTurn() {