Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: nekosune on Mar 18th, 2012  |  syntax: None  |  size: 1.33 KB  |  views: 51  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # grid format:
  2. #     0 = navigable space
  3. #     1 = occupied space
  4. grid = [[1, 1, 1, 0, 0, 0],
  5.         [1, 1, 1, 0, 1, 0],
  6.         [0, 0, 0, 0, 0, 0],
  7.         [1, 1, 1, 0, 1, 1],
  8.         [1, 1, 1, 0, 1, 1]]
  9. goal = [2, 0] # final position
  10. init = [4, 3, 0] # first 2 elements are coordinates, third is direction
  11. cost = [2, 1, 20] # the cost field has 3 values: right turn, no turn, left turn
  12.  
  13. Answer:
  14. [' ', ' ', ' ', 'R', '#', 'R']
  15. [' ', ' ', ' ', '#', ' ', '#']
  16. ['*', '#', '#', '#', '#', 'R']
  17. [' ', ' ', ' ', '#', ' ', ' ']
  18. [' ', ' ', ' ', '#', ' ', ' ']
  19. Policies:
  20. orientation: up
  21. [' ', ' ', ' ', 'R', 'R', 'L']
  22. [' ', ' ', ' ', '#', ' ', '#']
  23. ['*', 'L', 'L', '#', 'L', 'L']
  24. [' ', ' ', ' ', '#', ' ', ' ']
  25. [' ', ' ', ' ', '#', ' ', ' ']
  26. orientation: left
  27. [' ', ' ', ' ', 'L', '#', '#']
  28. [' ', ' ', ' ', 'R', ' ', 'L']
  29. ['*', '#', '#', '#', '#', '#']
  30. [' ', ' ', ' ', 'R', ' ', ' ']
  31. [' ', ' ', ' ', 'R', ' ', ' ']
  32. orientation: down
  33. [' ', ' ', ' ', '#', 'R', '#']
  34. [' ', ' ', ' ', '#', ' ', '#']
  35. ['*', 'R', 'R', 'R', 'R', 'R']
  36. [' ', ' ', ' ', ' ', ' ', ' ']
  37. [' ', ' ', ' ', ' ', ' ', ' ']
  38. orientation: right
  39. [' ', ' ', ' ', 'R', '#', 'R']
  40. [' ', ' ', ' ', 'R', ' ', 'R']
  41. ['*', '#', '#', 'L', '#', 'L']
  42. [' ', ' ', ' ', 'L', ' ', ' ']
  43. [' ', ' ', ' ', 'L', ' ', ' ']
  44. The thread 'MainThread' (0x1a28) has exited with code 0 (0x0).
clone this paste RAW Paste Data