Example #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