hi, Iâm new to coding and i wanna use recursive function on python but doesnât know why it fails. Can you help me, I donât understand what i do the wrong way.
def droite(x,y,tableau,lim):
x=x+1
int(lim)
print(x,y,lim, file=sys.stderr, flush=True)
if x>=lim:
x=-1
y=-1
return x, y
elif tableau[y][x]=="0":
return x, y
else:
droite(x,y,tableau,lim)
def Bas(x,y,tableau,lim):
y=y+1
int(lim)
print(x,y,lim, file=sys.stderr, flush=True)
if y>=lim:
x=-1
y=-1
return x, y
elif tableau[y][x]=="0":
print(x,y,5, file=sys.stderr, flush=True)
return x, y
else:
Bas(x,y,tableau,lim)
width = int(input()) # the number of cells on the X axis
height = int(input()) # the number of cells on the Y axis
x1=0
y1=0
x2=-1
x3=-1
y2=-1
y3=-1
tab=[]
x2=y2=x3=y3=-1
for i in range(height):
line = input() # width characters, each either 0 or .
L=str(line)
tab.append(L)
for i in range(height):
for j in range(width):
if tab[i][j]=='0':
x1=j
y1=i
x2,y2=droite(x1,y1,tab,width)
x3,y3=Bas(x1,y1,tab,height)
print(x1,y1,x2,y2,x3,y3)