Example #1
0
 @Override
 public void perform(final org.nlogo.nvm.Context context) throws LogoException {
   int numberOfTurtles = argEvalIntValue(context, 0);
   if (numberOfTurtles > 0) {
     AgentSet agentset =
         new org.nlogo.agent.ArrayAgentSet(Turtle.class, numberOfTurtles, false, world);
     AgentSet breed = breedName == NO_BREED ? world.turtles() : world.getBreed(breedName);
     org.nlogo.util.MersenneTwisterFast random = context.job.random;
     for (int i = 0; i < numberOfTurtles; i++) {
       Turtle turtle = world.createTurtle(breed, random.nextInt(14), random.nextInt(360));
       agentset.add(turtle);
       workspace.joinForeverButtons(turtle);
     }
     context.runExclusiveJob(agentset, next);
   }
   context.ip = offset;
 }
 @Override
 public void perform(final Context context) throws LogoException {
   int numberOfTurtles = argEvalIntValue(context, 0);
   if (numberOfTurtles > 0) {
     AgentSet agentset = new ArrayAgentSet(Turtle.class, numberOfTurtles, false, world);
     AgentSet breed = breedName == NO_BREED ? world.turtles() : world.getBreed(breedName);
     for (int i = 0; i < numberOfTurtles; i++) {
       Turtle turtle = world.createTurtle(breed);
       turtle.colorDouble(Double.valueOf(10.0 * i + 5.0));
       turtle.heading((360.0 * i) / numberOfTurtles);
       agentset.add(turtle);
       workspace.joinForeverButtons(turtle);
     }
     context.runExclusiveJob(agentset, next);
   }
   context.ip = offset;
 }