/// <summary> /// Gets the table after given move. /// </summary> /// <param name="move">The move.</param> /// <returns>The table after move.</returns> private TicTacToeTable GetTableForMove(Position move) { TicTacToeTable newTable = stateTable; newTable.SetValue(Player, move.Item1, move.Item2); return(newTable); }
/// <summary> /// Initializes a new instance of the <see cref="TicTacToeNode"/> class. /// </summary> /// <param name="table">The game state.</param> /// <param name="player">The current player.</param> private TicTacToeNode(TicTacToeTable table, Value player) { stateTable = table; winner = new Lazy<Value>( () => IsFinished(), LazyThreadSafetyMode.ExecutionAndPublication); children = new Lazy<IReadOnlyList<TicTacToeNode>>( () => GetChildren(), LazyThreadSafetyMode.ExecutionAndPublication); heuristics = new Lazy<int>( () => GetHeuristics(), LazyThreadSafetyMode.ExecutionAndPublication); Debug.Assert(player != Value.None, "Verifying that the player value is valid."); Player = player; Opponent = player == Value.Maximizing ? Value.Minimizing : Value.Maximizing; }
/// <summary> /// Initializes a new instance of the <see cref="TicTacToeNode"/> class. /// </summary> /// <param name="table">The game state.</param> /// <param name="player">The current player.</param> private TicTacToeNode(TicTacToeTable table, Value player) { stateTable = table; winner = new Lazy <Value>( () => IsFinished(), LazyThreadSafetyMode.ExecutionAndPublication); children = new Lazy <IReadOnlyList <TicTacToeNode> >( () => GetChildren(), LazyThreadSafetyMode.ExecutionAndPublication); heuristics = new Lazy <int>( () => GetHeuristics(), LazyThreadSafetyMode.ExecutionAndPublication); Debug.Assert(player != Value.None, "Verifying that the player value is valid."); Player = player; Opponent = player == Value.Maximizing ? Value.Minimizing : Value.Maximizing; }