private void BuildTree(GameNode node, int depth, bool isPlayerTurn) { if (depth <= 0) { return; } node.GenerateChildren(isPlayerTurn); foreach (var child in node.Children.Keys) { BuildTree(child, depth - 1, !isPlayerTurn); } }