How do I write a c# minimax code to show resulting values from this info of the start of a game tree program ??
-
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();
And what is your question after all?:confused:
-
And what is your question after all?:confused:
My question after all is about how to add a code with the variable that holds minimax value of the node, the node having a variable that holds the board position bearing in mind that the value of this valuable can be an array of length 9 which makes values X and O (or 1 and -1 talking of integers) leading to generating a tree automatically by computing successor states for the board positions represented by a particular code, starting with the empty board for the root node, recursively computing successors until terminal nodes reached.
-
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();