import random
# 正しく8×8×(list)を作る
Q = [[0 for _ in range(8)] for _ in range(8)]
K = [[list(range(16)) for _ in range(16)] for _ in range(8)]
N = [[[random.randint(0, 15)] for _ in range(8)] for _ in range(8)]
def reward(action, prediction):
return action != prediction # True = reward
for _ in range(2**20):
a = random.randint(0, 7)
b = random.randint(0, 7)
c = random.randint(0, len(K[a][b]) - 1)
action = N[a][b][0]
prediction = K[a][b][c]
if reward(action, prediction):
K[a][b].pop(c)
print(K)
print(N)
To embed this project on your website, copy the following code and paste it into your website's HTML: