+ Player p0, p1;
+
+ class Player {
+ com.codingame.game.Player gp;
+ int index;
+
+ Player(int i) { index = i; }
+
+ private int castlePosition;
+ public int getCastlePosition() { return castlePosition; }
+ public void setCastlePosition(int pos) { castlePosition = pos; }
+
+ private int multiplier;
+ public int getMultiplier() { return multiplier; }
+ public void setMultiplier(int m){ multiplier = m; }
+
+ private int stones;
+ public int getStones() { return stones; }
+ public void consumeStones(int n) throws InvalidAction {
+ if (n > stones) {
+ throw new InvalidAction("attempted to throw more stones than they had.");
+ }
+ setStones(stones - n);
+ }
+ public void setStones(int n) {
+ stones = n;
+ }
+ public int getOppStones() {
+ return p0.stones + p1.stones - stones;
+ }
+
+ public void adjustScore(int trollPosition) {
+ gp.setScore(Math.abs(castlePosition - trollPosition));
+ }
+
+ public int getTrollDistance() {
+ return Math.abs(castlePosition - trollPosition);
+ }
+ }