Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the following program in C++ In a minimax tree the root is conventionally the max player and the utility function for leaf nodes is
Write the following program in C++ In a minimax tree the root is conventionally the max player and the utility function for leaf nodes is what the max player wants to maximize. After the max player moves, the root of the rest of the game is the min player, who wants to minimize the utility function. Code in C++ the mutually-recursive max_value and min_value functions specified in Figure 5.3 and use them to find the min (root's value) of a min tree read in from the keyboard as a nested list. For example, the tree in Figure 5.2 would be input as ((3,12,8),(2,4,6),(14,5,2)) with the triangles inverted so the root is min, and the tree passed out in class would be input as ((3,8,(7,(3,0,7),(8,8,2))), (4,(7,9,8),8), (((3,6,4),2,6),((9,2,9),4,7,(6,4,5) ),4,(6,4,5)) ) with the triangles inverted so the root is min.MAX 51 MIN di d2 3 12 8 14 5 Figure 5.2 A two-ply game tree. The nodes are "MAX nodes," in which it is MAX's turn to move, and the nodes are ..MIN nodes." The terminal nodes show the utility values for MAX; the other nodes are labeled with their minimax values. MAX's best move at the root is al, because it leads to the state with the highest minmax value, and MIN's best reply is because it leads to the state with the lowest minimax value MAX 51 MIN di d2 3 12 8 14 5 Figure 5.2 A two-ply game tree. The nodes are "MAX nodes," in which it is MAX's turn to move, and the nodes are ..MIN nodes." The terminal nodes show the utility values for MAX; the other nodes are labeled with their minimax values. MAX's best move at the root is al, because it leads to the state with the highest minmax value, and MIN's best reply is because it leads to the state with the lowest minimax value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started