Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. cells = [
  2. None,
  3. [2,7,8], # 1 start
  4. [7,9], # 2 b diagnal
  5. [2,4,9], # 3 y adjacent
  6. [2,6,14,16,18], # 4 r 2space
  7. [4,6,11], # 5 y
  8. [5,12], # 6 y
  9. [8,13], # 7 y
  10. [2,7,9,14], # 8 y
  11. [3,8,10,15], # 9 y
  12. [3,5,15,17], # 10 b
  13. [5,10,12,17], # 11 y
  14. [5,17], # 12 b
  15. [3,15,25,27], # 13 r
  16. [7,9,19,21], # 14 b
  17. [8,10,20,22], # 15 b
  18. [2,4,6,14,18,26,28,30], # 16 r
  19. [10,12,22,24], # 17 b
  20. [11,23], # 18 b
  21. [13,20,25], # 19 y
  22. [13,15,25,27], # 20 b
  23. [14,16,26,28], # 21 b
  24. [16,21,23,28], # 22 y
  25. [16,18,28,30], # 23 b
  26. [10,12,22,34,36], # 24 r
  27. [20,32], # 25 b
  28. [14,16,28], # 26 r
  29. [21,26,28,33], # 27 y
  30. [21,23,33,35], # 28 b
  31. [23,28,30,35], # 29 y
  32. [24,29,36], # 30 y
  33. [26], # 31 b
  34. [26,31,33], # 32 y
  35. [19,21,23,31,35], # 33 r
  36. [27,29], # 34 b
  37. [29,34,36] # 35 y
  38. ]
  39.  
  40. results = []
  41. historyl = [None] * len(cells)
  42. historys = set()
  43. f = open('out.txt','w')
  44.  
  45. def find(this = 1, depth = 0):
  46. #print historyl, this
  47. if this == 36 and depth == 35:
  48. r = historyl[:depth]
  49. r.append(this)
  50. results.append(r)
  51. print r
  52. print >>f, r
  53. elif this != 36:
  54. historyl[depth] = this
  55. for x in cells[this]:
  56. if x not in historys:
  57. historys.add(this)
  58. find(x, depth+1)
  59. historys.discard(this)
  60.  
  61. find()
  62. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement