Beispiel #1
0
                    alpha = k
            return alpha
            #node.setValue(best)
        elif node.Pos() is "min":
            for next in node.Next():
                m = Alpha_Beta(next, alpha, beta)
                if m < beta:
                    beta = m
            return beta
            #node.setValue(best)


# Testing.
if __name__ == "__main__":

    root = Min_Max_Tree("min")
    node1 = Min_Max_Tree("max")
    node2 = Min_Max_Tree("max")

    root.addNode(node1)
    root.addNode(node2)

    node4 = Min_Max_Tree("min")
    node5 = Min_Max_Tree("min")
    node6 = Min_Max_Tree("min")

    node7 = Min_Max_Tree("max")
    node8 = Min_Max_Tree("max")

    node1.addNode(node4)
    node1.addNode(node5)
Beispiel #2
0
			node.setValue(best)	
			
		elif node.Pos() is "max":
			best = float('-inf')
			for next in node.Next():
				best = max(best,minMax_Search(next))			
			node.setValue(best)
		
		return best
				


# Testing.
if __name__ == "__main__":

 	root = Min_Max_Tree("min")
 	node1 = Min_Max_Tree("max")
 	node2 = Min_Max_Tree("max")
 	
 	root.addNode(node1)
 	root.addNode(node2)

 	node4 = Min_Max_Tree("min")
 	node5 = Min_Max_Tree("min")
 	node6 = Min_Max_Tree("min")

 	node7 = Min_Max_Tree("max")
 	node8 = Min_Max_Tree("max")

 	node1.addNode(node4)
 	node1.addNode(node5)
Beispiel #3
0
				if k > alpha:
					alpha = k
			return alpha
			#node.setValue(best)				
		elif node.Pos() is "min":
			for next in node.Next():
				m = Alpha_Beta(next,alpha,beta)	
				if m < beta:
					beta = m
			return beta
			#node.setValue(best)

# Testing.
if __name__ == "__main__":

 	root = Min_Max_Tree("min")
 	node1 = Min_Max_Tree("max")
 	node2 = Min_Max_Tree("max")
 	
 	root.addNode(node1)
 	root.addNode(node2)

 	node4 = Min_Max_Tree("min")
 	node5 = Min_Max_Tree("min")
 	node6 = Min_Max_Tree("min")

 	node7 = Min_Max_Tree("max")
 	node8 = Min_Max_Tree("max")

 	node1.addNode(node4)
 	node1.addNode(node5)
Beispiel #4
0
                best = min(best, minMax_Search(next))
            node.setValue(best)

        elif node.Pos() is "max":
            best = float('-inf')
            for next in node.Next():
                best = max(best, minMax_Search(next))
            node.setValue(best)

        return best


# Testing.
if __name__ == "__main__":

    root = Min_Max_Tree("min")
    node1 = Min_Max_Tree("max")
    node2 = Min_Max_Tree("max")

    root.addNode(node1)
    root.addNode(node2)

    node4 = Min_Max_Tree("min")
    node5 = Min_Max_Tree("min")
    node6 = Min_Max_Tree("min")

    node7 = Min_Max_Tree("max")
    node8 = Min_Max_Tree("max")

    node1.addNode(node4)
    node1.addNode(node5)