Thread: Need assistance with the minimax tree algorithm implementation.

  1. #1
    Registered User
    Join Date
    Oct 2017
    Posts
    5

    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. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,485
    Read the book again to find out.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2017
    Posts
    5
    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. #4
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,456
    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. #5
    Banned
    Join Date
    Aug 2017
    Posts
    861
    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
    Last edited by userxbw; 10-28-2017 at 06:13 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assistance to program a compression algorithm
    By SoraK05 in forum Tech Board
    Replies: 2
    Last Post: 06-16-2014, 06:33 AM
  2. Attempt to implement the minimax algorithm
    By gavra in forum C++ Programming
    Replies: 2
    Last Post: 08-17-2011, 11:27 PM
  3. Tic Tac Toe Minimax Algorithm Problem
    By hello.world in forum Game Programming
    Replies: 3
    Last Post: 10-24-2010, 05:47 AM
  4. Minimax tree help
    By stonecold1654 in forum C Programming
    Replies: 1
    Last Post: 09-13-2005, 09:34 PM
  5. b-tree (not binary tree) implementation help
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 01-02-2002, 03:30 PM

Tags for this Thread