Пример #1
0
 private bool[] DroppedLines(Unit unit)
 {
     bool[] dropped = emptyCellsInLines.Select(c => false).ToArray();
     var rect = unit.GetSurroundingRectangle();
     for (int l = rect.Item1.y; l <= rect.Item2.y; ++l)
     {
         var emptyCellsInLine = emptyCellsInLines[l];
         if (emptyCellsInLine.Count > unit.members.Count) continue;
         if (emptyCellsInLine.TrueForAll(c => unit.members.Contains(c)))
             dropped[l] = true;
     }
     return dropped;
 }
Пример #2
0
 public double Evaluate(Unit unit)
 {
     var dropped = DroppedLines(unit);
     int[] freedomInts = CountFreeInputsForSurroundingPoints(unit);
     int[] byCountFree = new int[5];
     foreach (var nfree in freedomInts)
         byCountFree[nfree]++;
     int scoreDropped = dropped.Select((isDrop, i) => isDrop ? 100+10*i : 0).Sum();
     int scorePosHeigh = unit.GetSurroundingRectangle().Item1.y;
     var score = scoreDropped  + scorePosHeigh
         //- 3*byCountFree[0] - 1*byCountFree[1] /* -2*byCountFree[2] - 1*byCountFree[3]*/
         ;
     return score;
 }