1 package com.codingame.game;
5 import java.util.regex.Pattern;
6 import java.util.Scanner;
7 import java.util.InputMismatchException;
8 import java.util.NoSuchElementException;
10 import com.codingame.gameengine.core.AbstractMultiplayerPlayer;
11 import com.codingame.gameengine.module.entities.Group;
12 import com.codingame.gameengine.module.entities.Text;
13 import com.codingame.gameengine.module.entities.Sprite;
15 public class Player extends AbstractMultiplayerPlayer {
19 private String messageString = "";
20 public String getMessageString() { return messageString; }
23 public int getExpectedOutputLines() {
27 static final Pattern rest = Pattern.compile(".*");
28 static final Pattern eol = Pattern.compile("\n");
29 public int getAction() throws TimeoutException, NumberFormatException {
30 Scanner s = new Scanner(getOutputs().get(0));
36 messageString = s.next(rest);
39 catch (InputMismatchException e) { throw new NumberFormatException(); }
40 catch (NoSuchElementException e) { throw new NumberFormatException(); }