How do I write a minimax c# code to show the results of the game tree from this info provided...
-
using System; using System.Collections.Generic; using System.Text; public class Minimax { static void Main(string[] args) { // generate a simple game tree, starting with the root Tree tree = new Tree(0); // children of the root tree.children = new Forest(new int[] { 0, 0 }); // children of the left child of the root tree.children.first.children = new Forest(new int[] { 0, 7, 9 }); // children of the right child of the root tree.children.rest.first.children = new Forest(new int[] { 4, 8, 6 }); // children of the leftmost child of the left child of the root tree.children.first.children.first.children = new Forest(new int[] { 5, 3, 1 }); // write the expected and calculated minimax values to the console Console.WriteLine("Expected minimax value is 5"); Console.WriteLine("Calculated minimax value of the tree " + tree.Minimax(true)); //Console.Write(tree.children.first); Console.WriteLine("Press any key to exit ..."); Console.ReadKey();
-
using System; using System.Collections.Generic; using System.Text; public class Minimax { static void Main(string[] args) { // generate a simple game tree, starting with the root Tree tree = new Tree(0); // children of the root tree.children = new Forest(new int[] { 0, 0 }); // children of the left child of the root tree.children.first.children = new Forest(new int[] { 0, 7, 9 }); // children of the right child of the root tree.children.rest.first.children = new Forest(new int[] { 4, 8, 6 }); // children of the leftmost child of the left child of the root tree.children.first.children.first.children = new Forest(new int[] { 5, 3, 1 }); // write the expected and calculated minimax values to the console Console.WriteLine("Expected minimax value is 5"); Console.WriteLine("Calculated minimax value of the tree " + tree.Minimax(true)); //Console.Write(tree.children.first); Console.WriteLine("Press any key to exit ..."); Console.ReadKey();
This is the Visual C++ forum, so please post your question in the C# forum.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
using System; using System.Collections.Generic; using System.Text; public class Minimax { static void Main(string[] args) { // generate a simple game tree, starting with the root Tree tree = new Tree(0); // children of the root tree.children = new Forest(new int[] { 0, 0 }); // children of the left child of the root tree.children.first.children = new Forest(new int[] { 0, 7, 9 }); // children of the right child of the root tree.children.rest.first.children = new Forest(new int[] { 4, 8, 6 }); // children of the leftmost child of the left child of the root tree.children.first.children.first.children = new Forest(new int[] { 5, 3, 1 }); // write the expected and calculated minimax values to the console Console.WriteLine("Expected minimax value is 5"); Console.WriteLine("Calculated minimax value of the tree " + tree.Minimax(true)); //Console.Write(tree.children.first); Console.WriteLine("Press any key to exit ..."); Console.ReadKey();
please adhere to the forum rules and regulations.