# Thread: Need assistance with the minimax tree algorithm implementation.

1. ## Need assistance with the minimax tree algorithm implementation.

Hi,

So I am working on trying to implement the minimax tree algorithm given in the AI book. Here is the algorithm:
Code:
```function MINIMAX-DECISION(state) returns an action
return argmax_a _∈ _ACTIONS(s) MIN-VALUE(RESULT(state, a))

function MAX-VALUE(state) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ←−∞
for each a in ACTIONS(state)do
v ← MAX(v, MIN-VALUE(RESULT(s, a)))
return v

function MIN-VALUE(state) returns a utility value
if TERMINAL-TEST(state) then return UTILITY(state)
v ←∞
for each a in ACTIONS(state)do
v ← MIN(v, MAX-VALUE(RESULT(s, a)))
return v```
So if my problem is to return a max value from the input of a tree in a form of nested list, such as ((1,2,3),(4,5,6)), which after the minimax call, the output would be 4. What does the above algorithm mean by saying "ACTIONS, UTILITY, TERMINAL-TEST," and "RESULT(s,a)"? What are s and or a?
I am trying to understand this algorithm before I go ahead and attempt to implement it in C++.

Any clarification is appreciated. 2. Read the book again to find out. 3. I would not have been here if the book helped, or the Prof, or the TA or the students.
01010101 01110011 01100101 01101100 01100101 01110011 01110011 00100000 01100001 01110011 01110011 00100000 01100110 01101111 01110010 01110101 01101101 00100001 00100000 4. Sounds more like the Prof and the TA are the useless ones since they, according to you, do not know what they are teaching 5. seeings that it is a function call within a function call which is legal (btw), using the inside functions return ( value ) to pass it into the outside function.
Code:
```MIN-VALUE(RESULT(s, a)))

```

s and a would therefore represent some type of variable value of some kind. what kind? One would need the documentation on same said function. seeings how it is dealing with values as you stated " such as ((1,2,3),(4,5,6)), w " I'd say it is an integer over a char.

So by the functions name it is the results of s and a that is being passed into, by the outside functions name, the minimum value. whatever operation that inner functions is preforming on s and a, but by its name one could logically deduce it maybe the lesser value between s and a

that is my best guess Popular pages Recent additions algorithm, function, minimax, return, trees 