Example #1
0
  private void decideOnExplore() {
    if (this.explore == null) this.explore = new Explore();

    if (this.explore.plan == null
        && !knownArena.toVisit
            .isEmpty()) { // || !this.explore.p.equals(knownArena.curentPosition) ) {

      Vector<BestPos> tmp = new Vector<BestPos>();
      for (BestPos bp : knownArena.toVisit) {
        this.explore.plan = Plan.createPlan(knownArena, bp.p, 15, false, 100);
        tmp.add(bp);
        if (this.explore.plan != null) {
          // this.explore.plan.print();
          // System.out.print("\n\n");
          break;
        }
      }
      for (BestPos bp : tmp) {
        knownArena.toVisit.remove(bp);
        knownArena.visited.add(bp.p);
      }
    }

    if (this.explore.plan != null) {
      this.explore.p = this.explore.plan.p;
      this.explore.plan = mulDirection(this.explore.plan);
    }
  }
Example #2
0
 private void decideOnReturn() {
   if (this.ret == null) this.ret = new Explore();
   if (this.ret.plan == null || !this.ret.p.equals(knownArena.curentPosition)) {
     this.ret.plan =
         Plan.createPlan(
             knownArena, knownArena.landmarks.get(Neighborhood.HEADQUARTERS), 10000, true, 150);
     if (this.ret.plan == null) {
       decideOnExplore();
       return;
     }
   }
   // this.explore.plan.print();
   this.ret.p = this.ret.plan.p;
   this.ret.plan = mulDirection(this.ret.plan);
 }
Example #3
0
 private void decideOnSeek() {
   if (knownArena.landmarks.get(Neighborhood.FLAG) == null) {
     state = AgentState.EXPLORE;
     decideOnExplore();
   }
   if (this.seek == null) this.seek = new Explore();
   if (this.seek.plan == null || !this.seek.p.equals(knownArena.curentPosition)) {
     this.seek.plan =
         Plan.createPlan(
             knownArena, knownArena.landmarks.get(Neighborhood.FLAG), 10000, true, 200);
   }
   // this.explore.plan.print();
   this.seek.p = this.seek.plan.p;
   this.seek.plan = mulDirection(this.seek.plan);
 }