examples/src/main/java/io/github/agentsoz/jill/example/tokenpassing/TokenAgent3.java
@Override
  public void start(PrintStream writer, String[] params) {
    parse(params);
    out = writer;

    // Create a new belief set about neighbours
    BeliefSetField[] fields = {new BeliefSetField("name", String.class, true),};

    try {
      // Attach this belief set to this agent
      this.createBeliefSet(beliefset, fields);

      int numAgents = GlobalState.agents.size();

      // Cannot have more neighbours than agents
      if (neighbourhood >= numAgents) {
        Log.error("Agent " + getName() + " cannot add " + neighbourhood
            + " neighbours, when there are only " + numAgents + " agents all up");
        System.exit(-1);
      }
      // Add beliefs about neighbours
      for (int i = 1; i <= neighbourhood; i++) {
        int neighbour = (getId() + i) % numAgents;
        this.addBelief(beliefset, Integer.toString(neighbour));
        Log.debug("Agent " + getName() + " added neighbour " + neighbour);
      }
      Log.debug("Agent " + getName() + " is initialising with neighbourhood size of "
          + neighbourhood + " on each side (so " + (neighbourhood * 2) + " neighbours)");

      // Let Agent 0 start the token passing
      if (getId() == 0) {
        Log.debug("round 1");
        Token3 token = new Token3(1, 1);
        token.setHops(1);
        send(1, token);
      }
    } catch (BeliefBaseException e) {
      Log.error(e.getMessage());
    }
  }
@Override
  public void start(PrintStream writer, String[] params) {
    parse(params);
    out = writer;

    // Create a new belief set about neighbours
    BeliefSetField[] fields = {new BeliefSetField("name", String.class, true),};

    try {
      // Attach this belief set to this agent
      this.createBeliefSet(beliefset, fields);

      int numAgents = GlobalState.agents.size();

      // Cannot have more neighbours than agents
      if (neighbourhood >= numAgents) {
        Log.error("Agent " + getName() + " cannot add " + neighbourhood
            + " neighbours, when there are only " + numAgents + " agents all up");
        System.exit(-1);
      }
      // Add beliefs about neighbours
      for (int i = 1; i <= neighbourhood; i++) {
        int neighbour = (getId() + i) % numAgents;
        this.addBelief(beliefset, Integer.toString(neighbour));
        Log.debug("Agent " + getName() + " added neighbour " + neighbour);
      }
      Log.debug("Agent " + getName() + " is initialising with neighbourhood size of "
          + neighbourhood + " on each side (so " + (neighbourhood * 2) + " neighbours)");

      // Let Agent 0 start the token passing
      if (getId() == 0) {
        Log.debug("round 1");
        Token3 token = new Token3(1, 1);
        token.setHops(1);
        send(1, token);
      }
    } catch (BeliefBaseException e) {
      Log.error(e.getMessage());
    }
  }
{@inheritDoc}.