All in C# language
I seeking help in extending the implementation of the mimimax algorithm in this program so that
(1). in addition to the variable that holds the minimax value of the node, the node has a

variable that holds the board position. The value of this variable can simply be an array of

length nine which takes the values x and o (or 1 and -1, if you prefer integers).

(2). the tree is generated automatically by computing the successor states for the board

position represented by a particular node. Start with the empty board for the root node

and recursively compute the successors until you reach terminal nodes.

(3). the data value of a terminal node is determined by the board position that it represents:

1, if Max wins

0, if it is a draw

-1, if Min wins

(4). after running the program, all nodes should have the appropriate minimax values.

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 rootTree tree = new Tree(0);// children of the roottree.children = new Forest(new int[] { 0, 0 });// children of the left child of the roottree.children.first.children = new Forest(new int[] { 0, 7, 9 });// children of the right child of the roottree.children.rest.first.children = new Forest(new int[] { 4, 8, 6 });// children of the leftmost child of the left child of the roottree.children.first.children.first.children = new Forest(new int[] { 5, 3, 1 });// write the expected and calculated minimax values to the consoleConsole.WriteLine("Expected minimax value is 5");Console.WriteLine("Calculated minimax value of the tree " + tree.Minimax(true));Console.WriteLine("Press any key to exit ...");Console.ReadKey();} // end method Mainprivate class Tree{public int data; // data stored in nodepublic Forest children; // link to the children of the node// create a tree without children and initialize datapublic Tree(int nodeData){data = nodeData;children = null; // node has no children} // end constructor// determine the minimax value of the nodepublic int Minimax(Boolean maximise){// this method calculates the minimax value for the tree, which is:// - the value in data, if the tree is a leafif (children == null) return data;// - the maximum of the minimax values of the subtrees, if maximise is trueif (maximise) return children.Max();// - the minimum of the minimax values of the subtrees, if maximise is falseelse return children.Min();} // end method Minimax} // end class Treeprivate class Forest{public Tree first; // first treepublic Forest rest; // remaining trees// create a single-node tree for each piece of data and link them togetherpublic Forest(int[] nodeData){first = new Tree(nodeData[0]);if (nodeData.Length > 1){rest = new Forest(nodeData, 1);}else rest = null;} // end constructorpublic Forest(int[] nodeData, int start){first = new Tree(nodeData[start]);if (nodeData.Length - start > 1){rest = new Forest(nodeData, start + 1);}else rest = null;} // end constructor// determine the maximum of the minimax values of the trees in the forestpublic int Max(){// this method returns the maximum of the minimax values of the trees in the forestint max = first.Minimax(false);if (rest != null) max = Math.Max(first.Minimax(false), rest.Max());return max;} // end method Max// determine the minimum of the minimax values of the trees in the forestpublic int Min(){// this method returns the minimum of the minimax values of the trees in the forestint min = first.Minimax(true);if (rest != null) min = Math.Min(first.Minimax(true), rest.Min());return min;} // end method Min} // end class Forest} // end class Minimax

Umm, my previous comment wasn't intended to be a solution to this problem.

0

Featured Post

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…

Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…

I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.
https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt
https://filedb.experts-exchange.com/incoming/201…

In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…