Petite erreur pour génération de labyrinthe en python

Hello j'ai un petit problème avec python sur calculatrice,
J'ai récupéré ce bout de code pour générer un labyrinthe mais il m'affiche quelques erreurs, est ce que quelqu'un sait ou j'ai pu me gourrer ?
Voici mon erreur :
J'ai récupéré ce bout de code pour générer un labyrinthe mais il m'affiche quelques erreurs, est ce que quelqu'un sait ou j'ai pu me gourrer ?
- Code: Select all
from ti_draw import *
from random import *
def vline(x,y,w):
if w:
x1=x*wl+9
y1=y*wl+3
draw_line(x1,y1,x1,y1+wl)
def hline(x,y,w):
if w:
x1=x*wl+9
y1=y*wl+3
draw_line(x1,y1,x1+wl,y1)
def cell(x,y):
z=a[x+y*w]
hline(x,y,z&1)
vline(x+1,y,z&2 )
hline(x,y+1,z&4)
vline(x,y,z&8)
def disp():
clear
for x in range(w):
for y in range(h):
cell(x,y)
def nor(u):
v=u-w
if v>0:
if a[v]==15:
a[u]&=14
a[v]&=11
return v
return u
def eas(u):
v=u+1
if v%w:
if a[v]==15:
a[u]&13
a[v]&7
return v
return u
def sou(u):
v=u+w
if v<n:
if a[v]==15:
a[u]&=11
a[v]&=14
return v
return u
def wes(u):
v=u-1
if u%w:
if a[v]==15:
a[u]&=7
a[v]&=13
return v
return u
def move(u):
for i in range(c):
d=randrange(4)
if d==0:
u=nor(u)
if d==1:
u=eas(u)
if d==2:
u=sou(u)
if d==3:
u=wes(u)
# Initialize
w=25
h=17
n=w*h
c=n/4
wl=12
a=[15 for x in range(n)]
t=[x for x in range(n)]
a[0]=7
clear()
draw_text(125,110,"-thinking-")
while 1:
# Shuffle the index
for i in range(n):
j=randrange(n)
t[i],t[j]=t[j],t[i]
#Check each cell in index order
done=True
for i in range(n):
u=t[i]
if a[u]==15:
done=False
else:
move(u)
#Done if all cells connected
if done:
break
#Done
a[n-1]&=13
disp()
Voici mon erreur :
- Code: Select all
File "<stdin>", line 2, in <module>
File "C:\Users\arihe\AppData\Roaming\Texas I
nstruments\TI-Nspire CX CAS Student Softwar
e\python\doc2\maze.py", line 103, in <module>
File "C:\Users\arihe\AppData\Roaming\Texas I
nstruments\TI-Nspire CX CAS Student Softwar
e\python\doc2\maze.py", line 71, in move
File "C:\Users\arihe\AppData\Roaming\Texas I
nstruments\TI-Nspire CX CAS Student Softwar
e\python\doc2\maze.py", line 39, in eas
TypeError: unsupported types for __add__: 'Non
eType', 'int'