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 {
16 private int castlePosition;
17 public int getCastlePosition() {
18 return castlePosition;
20 public void setCastlePosition(int pos) {
25 public int getStones()
29 public void consumeStones(int n) throws InvalidAction {
31 throw new InvalidAction("attempted to throw more stones than they had.");
33 setStones(stones - n);
35 public void setStones(int n) {
38 stoneCounter.setText("No stones!");
39 stoneCounter.setFillColor(0xff7777);
41 else if (stones == 1) {
42 stoneCounter.setText("1 stone");
43 stoneCounter.setFillColor(0xffbb77);
46 stoneCounter.setText(stones + " stones");
50 private int multiplier;
51 public int getMultiplier() {
54 public void setMultiplier(int m){
58 public void adjustScore(int trollPosition) {
59 setScore(Math.abs(castlePosition - trollPosition));
63 public int getExpectedOutputLines() {
67 public int getAction() throws TimeoutException, NumberFormatException {
68 return Integer.parseInt(getOutputs().get(0));