Пример #1
0
            public double EvaluateState(ReadOnlyBlockadeState state, int player)
            {
                var weights = new[] { 20, 15, 10 };

                return(weights.Select((weight, i) =>
                                      state.GetBoardCalculator()
                                      .GetD1Neighbors(state.GetCurrentLocationOfPlayer(player), distance: i + 1)
                                      .Sum(l => (state.GetCell(l).IsEmpty() ? 1 : -1) * weight))
                       .Sum());
            }
Пример #2
0
 public double GetReachableCellScore(ReadOnlyBlockadeState state, int player)
 {
     using (var step = this._myProfiler.Step("sophie evaluate state - reachable"))
     {
         // so we cant check the reachable count for the current position of the player because that space is
         // occupied, but we can check all the places they can go and get the max of that as an analog
         return(state.GetMoves(player)
                .Select(move => state.GetBoardCalculator().GetReachableCellCount(move.Location))
                .Max());
     }
 }
Пример #3
0
 public double GetNeighborAversionScore(ReadOnlyBlockadeState state, int player)
 {
     using (var step = this._myProfiler.Step("mira evaluate state - neighbor"))
     {
         var weights = new[] { 20, 15, 10 };
         return(weights.Select((weight, i) =>
                               state.GetBoardCalculator()
                               .GetD1Neighbors(state.GetCurrentLocationOfPlayer(player), distance: i + 1)
                               .Sum(l => (state.GetCell(l).IsEmpty() ? 1 : -1) * weight))
                .Sum());
     }
 }