Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tab = [[2, 0, 3, 2],[4, 4, 1, 2],[11, 12, 15, 4],[1, 5, 3, 1]]
- -----------------------------------------------------------------
- # n szerokość, m wysokość
- # poczatek:
- def droga(tab, n, m, nMax, mMax):
- # print (n, m)
- if ((n == nMax) & (m == mMax)):
- print("koniec")
- elif(n == nMax):
- print("prawo")
- m +=1
- droga(tab, n, m, nMax, mMax)
- elif(m == mMax):
- print("dół")
- n+=1
- droga(tab, n, m, nMax, mMax)
- elif (tab[n+1][m] < tab[n][m+1]):
- print("dół")
- n = n+1
- droga(tab, n, m, nMax, mMax)
- elif(tab[n+1][m] >= tab[n][m+1]):
- print("prawo")
- m = m+1
- droga(tab, n, m, nMax, mMax)
- else:
- print("cos sie zjebalo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement