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()); }
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()); } }