private EvaluationRecord _updateEvaluation( EvaluationData <FrogsAndToadsPosition> evaluationData, MoveRecord moveRecord, _evaluator nextEvaluator, _bestValueUpdater bestValueUpdater, _bestPairUpdater bestPairUpdater) { FrogsAndToadsPosition resultingPosition; EvaluationData <FrogsAndToadsPosition> resultingEvaluationData; int bestToad = evaluationData.BestToad; int bestFrog = evaluationData.BestFrog; int moveEvaluationcount = 0; int bestValue = moveRecord.BestValueSoFar; List <FrogsAndToadsMove> evaluatedMoves = moveRecord.EvaluatedMoves; foreach (FrogsAndToadsMove move in moveRecord.MovesToEvaluate) { moveEvaluationcount++; evaluatedMoves.Add(move); resultingPosition = evaluationData.Position.PlayMove(move); resultingEvaluationData = new EvaluationData <FrogsAndToadsPosition>( resultingPosition, evaluationData.Depth + 1, evaluationData.BestToad, evaluationData.BestFrog); bestValue = bestValueUpdater( bestValue, nextEvaluator(resultingEvaluationData)); (bestToad, bestFrog) = bestPairUpdater(bestValue); if (bestToad > bestFrog) { break; } } return (moveEvaluationcount == moveRecord.MovesToEvaluate.Count ? new EvaluationRecord(bestValue) : new EvaluationRecord(bestValue, evaluatedMoves)); }
private EvaluationRecord _updateEvaluation( EvaluationData <GP> evaluationData, OptionRecord optionRecord, _evaluator nextEvaluator, _bestValueUpdater bestValueUpdater, _bestPairUpdater bestPairUpdater) { EvaluationData <GP> resultingEvaluationData; int bestToad = evaluationData.BestLeft; int bestFrog = evaluationData.BestRight; int optionEvaluationcount = 0; int bestValue = optionRecord.BestValueSoFar; List <GamePosition> evaluatedOptions = optionRecord.EvaluatedOptions; foreach (GP option in optionRecord.OptionsToEvaluate) { optionEvaluationcount++; evaluatedOptions.Add(option); resultingEvaluationData = new EvaluationData <GP>( option, evaluationData.Depth + 1, evaluationData.BestLeft, evaluationData.BestRight); bestValue = bestValueUpdater( bestValue, nextEvaluator(resultingEvaluationData)); (bestToad, bestFrog) = bestPairUpdater(bestValue); if (bestToad > bestFrog) { break; } } return (optionEvaluationcount == optionRecord.OptionsToEvaluate.Count ? new EvaluationRecord(bestValue) : new EvaluationRecord(bestValue, evaluatedOptions)); }