fork download
  1. coord = [
  2. [34,21,32,41,25],
  3. [14,42,43,14,31],
  4. [54,45,52,42,23],
  5. [33,15,51,31,35],
  6. [21,52,33,13,23]
  7. ]
  8.  
  9. cur = [0,0]
  10. next = [0,0]
  11. while True:
  12. if (cur == [0,0]):
  13. print([1,1])
  14. row = next[0]
  15. col = next[1]
  16. coordVal = coord[row][col]
  17.  
  18.  
  19. cur = [int(i) for i in str(coordVal)]
  20.  
  21. if (cur == [next[0]+1,next[1]+1]):
  22. print("HARTA KARUN DITEMUKAN!")
  23. break
  24.  
  25. next = [cur[0]-1, cur[1]-1]
  26. print(cur)
  27.  
  28.  
  29.  
Success #stdin #stdout 0.07s 14116KB
stdin
Standard input is empty
stdout
[1, 1]
[3, 4]
[4, 2]
[1, 5]
[2, 5]
[3, 1]
[5, 4]
[1, 3]
[3, 2]
[4, 5]
[3, 5]
[2, 3]
[4, 3]
[5, 1]
[2, 1]
[1, 4]
[4, 1]
[3, 3]
[5, 2]
HARTA KARUN DITEMUKAN!