Exemplo n.º 1
0
  public void vision(SimState state, SparseGrid2D grid) {
    // System.out.println("Direction: " + direction);
    // Visual Processor

    Int2D cord = grid.getObjectLocation(this);
    assert (vP != null && cord != null);
    assert (direction != 0);
    // System.out.println(this + "was at location: " + cord);
    if (cord != null) {
      seen = vP.sight(cord.x, cord.y, state, direction);
      Bag locations = new Bag();

      // Testing Print Statements
      for (int s = 0; s < seen.size(); s++) {
        Object j = seen.get(s);
        // System.out.print(s + "saw " + seen.get(s));
        Int2D obLoc = grid.getObjectLocation(j);
        locations.add(obLoc);
        // System.out.println(" at location:" + obLoc);
        // if(j.equals(Prey.class))
        // System.out.println("****" + seen.get(s));
      } // end of for loop

      this.behaviorProb(locations, seen);

      // Move every timestep
      super.move(grid, state);
    }
  } // end of vision
Exemplo n.º 2
0
  @Override
  public void step(SimState state) {
    // TODO Auto-generated method stub
    super.step(state);
    // System.out.println("Last Meal: " + lastMeal + " timesteps");

    // Visual Processor
    this.vision(state, grid);

    // Death Calculations
    if (this.iDie(state)) return;

    // Reproduction Calculations
    if (this.iReproduce(state)) return;

    // Will I eat?
    /*if(this.willEat(grid, state))
    	return;
    */

  }