- public int getAction() throws TimeoutException, NumberFormatException {
- return Integer.parseInt(getOutputs().get(0));
+ void receiveGameTurn() {
+ messageString = "";
+ try { messageString = getOutputs().get(0); }
+ catch (TimeoutException e) { type = Action.Timeout; return; }
+
+ Scanner s = new Scanner(messageString);
+ try { stoneThrow = s.nextInt(); }
+ catch (InputMismatchException e) { type = Action.Invalid; return; }
+ catch (NoSuchElementException e) { type = Action.Invalid; return; }
+
+ s.useDelimiter(eol);
+ if (s.hasNext(rest)) messageString = s.next(rest).trim();
+ else messageString = "";
+ type = Action.Throw;