示例#1
0
 /* Happiness gained if consumed
  * the whole hand at once
  */
 public double happiness(int[] hand) {
   double res = 0.0;
   for (int i = 0; i != info.colors; ++i)
     if (info.tasted(i))
       if (info.taste(i) > 0.0) res += info.taste(i) * hand[i] * hand[i];
       else res -= info.taste(i) * hand[i];
   return res;
 }
示例#2
0
 /* Self value of current offer
  * by taking into account only
  * the value of each color
  */
 public double selfLinearEvaluation(int[] toTake, int[] toGive) {
   double res = 0.0;
   for (int i = 0; i != info.colors; ++i)
     if (info.tasted(i)) res += info.taste(i) * (toTake[i] - toGive[i]);
   return res;
 }