コード例 #1
0
 public void CreateRandomBrainPressed()
 {
     _brain          = new AINeuralPlayer2();
     _prevBrain      = (AINeuralPlayer2)_brain.Clone();
     _trainingsCount = 0;
     Debug.Log("Created ai");
 }
コード例 #2
0
    public override Player Clone()
    {
        AINeuralPlayer2 clone = new AINeuralPlayer2();

        clone._whereToGoDecider     = _whereToGoDecider.Clone();
        clone._getUsedHumansDecider = _getUsedHumansDecider.Clone();
        return(clone);
    }
コード例 #3
0
 public void LoadTraining()
 {
     using (Stream stream = File.Open(FilePath, FileMode.Open))
     {
         var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
         _trainingModels = (List <TrainingDecisionModel>)binaryFormatter.Deserialize(stream);
         _brain          = (AINeuralPlayer2)binaryFormatter.Deserialize(stream);
         _prevBrain      = (AINeuralPlayer2)_brain.Clone();
     }
     UpdateView();
     InitTrainers();
     Debug.Log("Training loaded");
 }
コード例 #4
0
 public void Init(DecisionType type, List <TrainingDecisionModel> trainingModels, AINeuralPlayer2 player)
 {
     _trainingModels = new List <TrainingDecisionModel> ();
     foreach (var model in trainingModels)
     {
         if (model.Type == type && model.RewardPercent > 0.5f)
         {
             _trainingModels.Add(model);
         }
     }
     _trainingsDataSize.text = _trainingModels.Count.ToString();
     _decider        = player.GetChooserDecider(type);
     _trainingsCount = 0;
 }
コード例 #5
0
 public void OnRevertToPrevPressed()
 {
     _brain = (AINeuralPlayer2)_prevBrain.Clone();
     UpdateView();
 }