- 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;
- if (stones <= 0) {
- stoneCounter.setText("No stones!");
- stoneCounter.setFillColor(0xff7777);
- }
- else if (stones == 1) {
- stoneCounter.setText("1 stone");
- stoneCounter.setFillColor(0xffbb77);
- }
- else {
- stoneCounter.setText(stones + " stones");
- }
+ // same-typed positional parameters… a disaster waiting to happen
+ void gameInit(int roadLength, int initialStones, long seed) {
+ int nReserved = random.nextInt(5);
+ String reserved = "";
+ while (nReserved --> 0) reserved += " 0";
+ sendInputLine(String.format("%d %d %d %d%s",
+ roadLength, initialStones, seed,
+ model.getMultiplier(), reserved));