// move/class predictors are already global instances, so no need to make them members public GamePredictor(List <scorer> scorers, int numDrawPredictors) { DrawSequences = new ClassSequence[numDrawPredictors]; DrawPredictors = new TranscendentDrawPredictor[numDrawPredictors]; for (int i = 0; i < numDrawPredictors; i++) { DrawSequences[i] = new ClassSequence(); DrawPredictors[i] = new TranscendentDrawPredictor(scorers, AllDrawPredictors); } ClassPredictor = new TranscendentClassPredictor(scorers, AllClassPredictors); MovePredictor = new TranscendentMovePredictor(scorers, AllMovePredictors); // underlying predictions SimpleMovePredictors.ForEach(p => p.MakeNextPrediction(MoveSequence)); SimpleDrawPredictors.ForEach(p => p.MakeNextPrediction(DrawSequences[0])); // sequence 0/1 identical initially AllClassPredictors.ForEach(p => p.MakeNextPrediction(ClassSequence)); // metapredictions MovePredictor.MakePredictions(); ClassPredictor.MakePredictions(); foreach (TranscendentDrawPredictor p in DrawPredictors) { p.MakePredictions(); } }
public void Update(char MyMove, char YourMove) { MoveSequence.Extend(MyMove, YourMove); MovePredictor.UpdateScores(YourMove); SimpleMovePredictors.ForEach(p => p.MakeNextPrediction(MoveSequence)); MovePredictor.MakePredictions(); ClassSequence.Extend(MyMove, YourMove); ClassPredictor.UpdateScores(YourMove); AllClassPredictors.ForEach(p => p.MakeNextPrediction(ClassSequence)); ClassPredictor.MakePredictions(); int numDraws = DynamiteController.ScoreKeeper.PointsForRound; if (numDraws >= 2 && numDraws < 2 + DrawSequences.Length) { DrawSequences[numDraws - 2].Extend(MyMove, YourMove); DrawPredictors[numDraws - 2].UpdateScores(YourMove); // Delay making new predictions until actually needed } DynamiteController.Update(MyMove, YourMove); }