コード例 #1
0
ファイル: connect4.py プロジェクト: pwstegman/Connect-4-AI
def runSims(B, diff, piece):
	probs = {}
	for i in range(diff):
		temp = Board(B.board, piece)
		temp.playRandomGame(probs)
		if temp.state == "win" and temp.piece == piece:
			histLen = len(temp.history)
			limit = 10
			if histLen < 10:
				limit = histLen
			for h in range(0,limit,2):
				hist = temp.history[h]
				probs[hist[0]][hist[1]] -= 1/histLen**1.5
	return probs[B.string]