本文整理汇总了Python中State.State.actions方法的典型用法代码示例。如果您正苦于以下问题:Python State.actions方法的具体用法?Python State.actions怎么用?Python State.actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State.State
的用法示例。
在下文中一共展示了State.actions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: State
# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import actions [as 别名]
from State import State
#Start board
# 0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4
r = [0,2,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,3,0,5,0,0,0,0,0]
w = [0,0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2]
# 0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4
#r = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0]
#w = [2,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
s = State(r, w)
a = s.actions(1, [2,2])
def printArray(array):
for i,row in enumerate(array):
for j,row2 in enumerate(row):
print("------------- Dice Roll {0},{1} or {1},{0} -------------".format(i + 1,j + 1))
for index,actionset in enumerate(row2):
print("Option {0}:\t{1}".format(index + 1,actionset))
printArray(a)
print("current score " + str(s.score([r,w], 1)))