1 package com.codingame.game;
3 import com.codingame.gameengine.core.AbstractMultiplayerPlayer;
4 import com.codingame.gameengine.module.entities.Group;
5 import com.codingame.gameengine.module.entities.Text;
6 import com.codingame.gameengine.module.entities.Sprite;
8 public class Player extends AbstractMultiplayerPlayer {
15 private int castlePosition;
16 public int getCastlePosition() {
17 return castlePosition;
19 public void setCastlePosition(int pos) {
24 public int getStones()
28 public void consumeStones(int n) throws InvalidAction {
30 throw new InvalidAction("attempted to throw more stones than they had.");
32 setStones(stones - n);
34 public void setStones(int n) {
37 stoneCounter.setText("No stones!");
38 stoneCounter.setFillColor(0xff7777);
40 else if (stones == 1) {
41 stoneCounter.setText("1 stone");
42 stoneCounter.setFillColor(0xffbb77);
45 stoneCounter.setText(stones + " stones");
49 private int multiplier;
50 public int getMultiplier() {
53 public void setMultiplier(int m){
57 public void adjustScore(int trollPosition) {
58 setScore(Math.abs(castlePosition - trollPosition));
62 public int getExpectedOutputLines() {
66 public int getAction() throws TimeoutException, NumberFormatException {
67 return Integer.parseInt(getOutputs().get(0));