return max_score,max_path elsemin_score float("inf"min_path none for in node children()score,path minimax( ,depth+ if score min_scoremin_score score min_path name,path return min_score,min_path the following is depth-first minimax with - pruning it returns the value for node as well as best path for the agents masminimax py -(continued def minimax_alpha_beta(node,alpha,beta,depth= )"""node is nodealpha and beta are cutoffsdepth is the depth returns valuepath where path is sequence of nodes that results in the value ""node display( ,"*depth,"minimax_alpha_beta(",node name,"",alpha""beta,")"best=none only used if it will be pruned if node isleaf()node display( ,"*depth,"returning leaf value",node evaluate()return node evaluate(),none elif node ismaxfor in node children()score,path minimax_alpha_beta( ,alpha,beta,depth+ if score >betabeta pruning node display( ,"*depth,"pruned due to beta=",beta," =", namereturn scorenone if score alphaalpha score best namepath node display( ,"*depth,"returning max alpha",alpha,"best",bestreturn alpha,best elsefor in node children()score,path minimax_alpha_beta( ,alpha,beta,depth+ if score <alphaalpha pruning node display( ,"*depth,"pruned due to alpha=",alpha," =", namereturn scorenone if score betabeta=score best name,path node display( ,"*depth,"returning min beta",beta,"best=",bestreturn beta,best testingversion june