Пример #1
0
    private void StartGame()
    {
        if (!IsLearning)
        {
            GameState = Random.value > 0.5f ? GamePhase.PlayerTurn : GamePhase.IaTurn;
            Brains[0].isFirstAgainstPlayer = GameState != GamePhase.PlayerTurn;
        }
        else
        {
            //refactor
            if (IsLearning)
            {
                _learningAgent = LearningAgent.Agent1;
            }
            //_learningAgent = _learningAgent == LearningAgent.Agent1 ? LearningAgent.Agent2 : LearningAgent.Agent1;

            if (_learningAgent == LearningAgent.Agent2)
            {
                Brains[0].IsAgentLearningThisTurn = false;
                Brains[1].IsAgentLearningThisTurn = true;
                Brains[0].ProcessAgentPlay();
            }
            else
            {
                Brains[0].IsAgentLearningThisTurn = true;
                Brains[1].IsAgentLearningThisTurn = false;
            }

            GameState = GamePhase.Learning;
        }
    }
Пример #2
0
 public void CreateLearningAgent(LearningConfig learningConfig)
 {
     LearningAgent newAgent = new LearningAgent(
         learningConfig.Name,
         learningConfig.NativePids,
         learningConfig.ForeignPids,
         MinPositive,
         MinNegative);
     m_LearningAgents.AddAgent(newAgent);
 }
Пример #3
0
    protected override void Awake()
    {
        base.Awake();
        Assert.raiseExceptions = true;

        GatherReferences();

        if (!_isPlayerPlaying)
        {
            IsLearning      = true;
            _learningAgent  = LearningAgent.Agent1;
            LearningSession = new Session(0.9f, 0.99f, 0.7f, SessionIterations);
        }
        else
        {
            //load the corresponding filename
            IsLearning = false;
            Brains[0].IsUsingFileData = true;
            LearningSession           = new Session(SessionFileName);
        }
    }
Пример #4
0
 public void AddAgent(LearningAgent learningAgent)
 {
     m_LearningAgents.Add(learningAgent);
 }