Exemplo n.º 1
0
         if beta <= alpha:
            return self.val

      return self.val

   def addChild(self):
      child=MaxNode()
      self.addChildX(child)
      return child


import sys

root=MaxNode()

if len(sys.argv) > 1:
   net=sys.argv[1]
else:
   net="net2best"


readNet(net+".txt",root)

printTree(net+"_init.ps",root)

root.visit(-INF,INF)

printTree(net+"_final.ps",root)


Exemplo n.º 2
0
         return str(self.val)

   def update(self):
      for c in self.children:
         self.val=min(c.val,self.val)  

   def addChild(self):
      child=MaxNode()
      self.addChildX(child)
      return child

nodes=[]

root=MaxNode()

readNet("net4.txt",root)

printTree("initialTree.ps",root)



def updateMinMax(node):

   # print " visite : " ,node.hash

   node.visit_hash=Node.visit_count
   Node.visit_count=Node.visit_count+1

   if node.children==None:
      return