import random
import copy
prob=[[1.0,1.0],[1.0,1.0]]
kiok=[]
Ans=[[random.randint(0,1),random.randint(0,1)] for _ in range(10)]
Q=copy.deepcopy(Ans)
J=0
H=None
while Ans != []:
if J < len(kiok):
K=kiok[J]
else:
if H is not None:
K=H
else:
K=random.choice([[0,0],[0,1],[1,0],[1,1]])
if K == Ans[-1]:
prob[K[0]][K[1]] += 0.1
if J == len(kiok):
kiok.append(Ans.pop())
else:
Ans.pop()
J+=1
H=None
else:
prob[K[0]][K[1]] = max(0.1, prob[K[0]][K[1]]-0.1)
J=0
H=Ans[-1]
Ans=copy.deepcopy(Q)
print(Ans)
To embed this project on your website, copy the following code and paste it into your website's HTML: