示例#1
0
 protected virtual float Score(IBoard board)
 {
     return
     board
     //.Where(node => node.State.ToUnit(board.Player) > 0)
        .Aggregate(0,
           (score, node) =>
              score + (int)node.State.ToUnit(board.Player));
 }
示例#2
0
 protected override float Score(IBoard board)
 {
     return
      board
         .Aggregate(0f,
            (score, node) =>
            {
               var unit = node.State.ToUnit(board.Player);
               return score + scores[unit];
             });
 }
示例#3
0
 protected virtual float Score(IBoard board)
 {
     return
      board
         .Aggregate(0f,
            (score, node) =>
            {
               var unit = node.State.ToUnit(board.Player);
               switch (unit)
               {
                  case Unit.AlienAlive: return score - 2;
                  case Unit.AlienAliveZombie: return score - 4;
                  case Unit.AlienZombie: return score + 1;
                  case Unit.AllyAlive: return score + 2;
                  case Unit.AllyAliveZombie: return score + 4;
                  case Unit.AllyZombie: return score - 1;
                  case Unit.None: return score;
                  default: return score;
               }
            });
 }