private double Simulation() { Board s = episode.Peek().Item1; do { Move a = simulator.GetMove(s); Board newBoard; s.MakeMove(a, out newBoard); s = newBoard; } while (!s.IsGameOver()); return(s.Evaluate(startState.CurrentPlayer)); }
private double?Selection() { Board s = startState; while (policy.ContainsState(s)) { Move a = policy.GetMove(s); // make move. board switches players by itself Board newBoard; board.MakeMove(a, out newBoard); episode.Push(Tuple.Create(s, a)); s = newBoard; if (s.IsGameOver()) { return(s.Evaluate(startState.CurrentPlayer)); } } // Phase 2. Expand tree Expansion(s); return(null); }