【发布时间】:2010-08-02 22:16:43
【问题描述】:
在 alpha、beta 剪枝算法中, 我有一个类,其中定义了函数 def getAction(self,gamestate) id。我在 def getAction 中又做了 2 个函数
喜欢:
class BAC:
def you(self,gamestate):
def me(gamestate,depth,alpha, beta):
------
return v
def both(gamestate,depth,alpha, beta):
-------------------
return v
return me(gamestate,0,alpha, beta)-
我需要将 alpha 和 beta 放入函数 me 和两者中。但是我在哪里定义 alpha 和 beta 值。如果我在 def me 和 def 中定义了 alpha 和 beta,则会发生错误,因为全局名称 alpha 不存在。
如何制作 alpha 和 beta 局部变量或如何使其正常工作?
【问题讨论】:
-
你除了有人会为你编码吗?
标签: python algorithm alpha pruning