Exemplo n.º 1
0
def TEST_2(expected):
#    from lab3 import alpha_beta_search
    from lab3 import minimax
    tup_tree = ("A", None,
		("B", None,
		 ("C", None,
		  ("D", 6),
		  ("E", 4)),
		 ("F", None,
		  ("G", 8),
		  ("H", 6))
		 ),
		("I", None,
		 ("J", None,
		  ("K", 4),
		  ("L", 0)),
		 ("M", None,
		  ("N", 2),
		  ("O", 2))
		 )
		)
    tree = make_tree(tup_tree)
    print "%s:\n%s" %("TREE_2", tree_as_string(tree))
    v = minimax(tree, 10,
			  tree_eval,
			  tree_get_next_move,
			  is_leaf)
    print "BEST MOVE: %s" %(v)
    print "EXPECTED: %s" %(expected)
Exemplo n.º 2
0
def TEST_3(expected):
    from lab3 import minimax
    tup_tree = ("A", None,
		("B", None,
		 ("E", None,
		  ("K", 8),
		  ("L", 2)),
		 ("F", 6)
		 ),
		("C", None,
		 ("G", None,
		  ("M", None,
		   ("S", 4),
		   ("T", 5)),
		  ("N", 3)),
		 ("H", None,
		  ("O", 9),
		  ("P", None,
		   ("U", 10),
		   ("V", 8))
		  ),
		 ),
		("D", None,
		 ("I", 1),
		 ("J", None,
		  ("Q", None,
		   ("W", 7),
		   ("X", 12)),
		  ("K", None,
		   ("Y", 11),
		   ("Z", 15)
		   ),
		  )
		 )
		)
    tree = make_tree(tup_tree)
    print "%s:\n%s" %("TREE_3",
		      tree_as_string(tree))
    v = minimax(tree, 10,
			  tree_eval,
			  tree_get_next_move,
			  is_leaf)
    print "BEST-MOVE: %s" %(v)
    print "EXPECTED: %s" %(expected)