void Update() { if (runDemo) { if (internalEras < erasPerRun) { for (int epochs = 0; epochs < epochsPerEra; epochs++) { learner.RunEpoch(world, GetRandomState(), eValue, alpha, gamma, eta, mom); } eras++; internalEras++; } while (internalEras >= erasPerRun && counter <= Time.time) { counter = Time.time + counterStep; nextState = learner.RunStep(world, nextState, eValue, alpha, gamma, eta, mom); playerPrefab.transform.position = nextState.GetPlayerPos(); goalPrefab.transform.position = nextState.GetGoalPos(); if (world.IsTerminal(nextState)) { nextState = GetRandomState(); internalEras = 0; } } } else { for (int epochs = 0; epochs < epochsPerEra; epochs++) { learner.RunEpoch(world, GetRandomState(), eValue, alpha, gamma, eta, mom); } eras++; } }
void Update() { world.UpdateWorld(winReward, stepReward, loseReward); if (runDemo) { if (internalEras < erasPerRun) { for (int epochs = 0; epochs < epochsPerEra; epochs++) { learner.RunEpoch(world, GetRandomState(), eValue, alpha, gamma); } eras++; internalEras++; } while (internalEras >= erasPerRun && counter <= Time.time) { counter = Time.time + counterStep; nextState = learner.RunStep(world, nextState, eValue, alpha, gamma); playerPrefab.transform.position = nextState.GetPlayerPos(); if (world.IsTerminal(nextState)) { nextState = GetRandomState(); internalEras = 0; UpdateBackground(); } } } else { for (int epochs = 0; epochs < epochsPerEra; epochs++) { learner.RunEpoch(world, GetRandomState(), eValue, alpha, gamma); } nextState = GetRandomState(); eras++; UpdateBackground(); } }