I'm having this error when I run the code.
If I set pos=(algum numero qualquer)
the code runs normally, but if I use this random function of the error.
'int' object is not iterable on line 20 at the beginning.
Where am I going wrong? in the Deposit function I am sending y.sub = zeros array.
import numpy as np
import random
def Deposito(x):
for i in range(16):
pos=randint(0,15)
D=(pos+1)%16;
E=(pos+15)%16;
h=0
while h<30:
if (x[h,D]==1 and x[h,pos]==0):
x[h,pos]=1
break
elif (x[h,E]==1 and x[h,pos]==0):
x=[h,pos]=1
break
elif (x[h,pos]==1):
x[h-1,pos]=1
break
h=h+1
if h==29:
x[h,pos]=1
class Amostra:
substrato=np.zeros((30,16))
sub=substrato
y=Amostra()