Exemplo n.º 1
0
 @Override
 public void happier(double dblHappinessUp) {
   info.updateHappiness(dblHappinessUp, info.getIntLastEatIndex(), info.getIntLastEatNum());
   if (!info.getPriority().isWeightedPriorityComplete()) {
     // System.out.println("[G1Player] [happier] " + dblHappinessUp + ", " +
     // info.getIntLastEatIndex() + ", " + info.getIntLastEatNum());
     info.getPriority()
         .updatePriority(
             info.getIntLastEatIndex(), dblHappinessUp / info.getIntLastEatNum(), info);
   }
 }
Exemplo n.º 2
0
  @Override
  public void initialize(
      int intPlayerNum,
      double dblTasteMean,
      int intPlayerIndex,
      String strClassName,
      int[] aintInHand) {

    info = new Infobase();
    info.setIntPlayerIndex(intPlayerIndex);
    info.setStrClassName(strClassName);
    info.setAintInHand(aintInHand);
    info.setIntColorNum(aintInHand.length);

    int totalSkittles = 0;
    for (int i : aintInHand) {
      totalSkittles += i;
    }
    info.setInitialSkittlesPerPlayer(totalSkittles);

    info.createTables(intPlayerNum);

    info.setDblHappiness(0);
    info.setAdblTastes(new double[info.getIntColorNum()]);

    info.setColorHappinessArray(new double[info.getIntColorNum()]);
    for (int intColorIndex = 0; intColorIndex < info.getIntColorNum(); intColorIndex++) {
      info.setAdblTasteElement(intColorIndex, -1);
      // adblTastes[ intColorIndex ] = -1;
    }

    info.getPriority().initializePriority(aintInHand);

    eatStrategy = new EatStrategy();
    pickStrategy = new PickStrategy();
    offerStrategy = new OfferStrategy(info);
  }