本文整理汇总了Python中agent.Agent.set_board方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.set_board方法的具体用法?Python Agent.set_board怎么用?Python Agent.set_board使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agent.Agent
的用法示例。
在下文中一共展示了Agent.set_board方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Board
# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import set_board [as 别名]
board = Board()
agent1 = Agent(board, 1, 0.1, 0.0, 0.5)
agent2 = Agent(board, 2, 0.8, 0.2, 0.9)
all_turns = []
for x in range(0, 1000):
turns = 0
finished = False
player1 = Bot(board, agent1)
player2 = Bot(board, agent2)
message = "Win!"
while not finished:
turns += 1
player1.move()
player2.move()
finished = board.finished()
if turns > 400:
finished = True
message = "Stalemate"
# print message
b, r, bk, rk = board.get_values()
# print("R: " + str(r) + " RK: " + str(rk) + " B: " + str(b) + " BK: " + str(bk))
all_turns.append(turns)
board = Board()
agent1.set_board(board)
agent2.set_board(board)
if x % 100 == 99:
print(sum(all_turns)/len(all_turns))
all_turns = []
print(all_turns)