public Position newPosition(int p, int n) {
      switch (p) {
      case 0: return new Position(n, b, c, moves + 1);
      case 1: return new Position(a, n, c, moves + 1);
      case 2: return new Position(a, b, n, moves + 1);
      }
      throw new IllegalArgumentException("Invalid piece");
    }