Guest User

Untitled

a guest
May 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. 0, 0, 0, 0, 0, 0, 0,
  2. 0, 1, 1, 1, 1, 1, 0,
  3. 0, 0, 0, 0, 0, 1, 1,
  4. 0, 0, 0, 0, 0, 0, 0,
  5. 1, 0, 0, 0, 0, 1, 1,
  6. 0, 1, 0, 1, 1, 1, 0,
  7. 0, 1, 0, 1, 0, 0, 0,
  8.  
  9. 0, 0, 0, 0, 0, 0, 0,
  10. 3, 1, 1, 1, 1, 1, 0,
  11. 3, 3, 3, 3, 3, 1, 1,
  12. 3, 3, 3, 2, 3, 3, 3,
  13. 1, 3, 3, 3, 3, 1, 1,
  14. 3, 1, 3, 1, 1, 1, 0,
  15. 0, 1, 3, 1, 0, 0, 0,
  16.  
  17. 0, 0, 0, 1, 0, 0, 0,
  18. 0, 0, 1, 1, 1, 0, 0,
  19. 0, 1, 1, 1, 1, 1, 0,
  20. 1, 1, 1, 1, 1, 1, 1,
  21. 0, 1, 1, 1, 1, 1, 0,
  22. 0, 0, 1, 1, 1, 0, 0,
  23. 0, 0, 0, 1, 0, 0, 0,
  24.  
  25. 0, 0, 0, 0, 0, 0, 0,
  26. 0, 1, 1, 1, 1, 1, 0,
  27. 0, 3, 3, 3, 3, 1, 1,
  28. 3, 3, 3, 2, 3, 3, 3,
  29. 1, 3, 3, 3, 3, 1, 1,
  30. 0, 1, 3, 1, 1, 1, 0,
  31. 0, 1, 0, 1, 0, 0, 0,
  32.  
  33. <div id="results" style="font-family: monospace; font-weight: bold; font-size: 24pt; background-color: #000000; color: #FFFFFF;">
  34. </div>
  35. <script>
  36. var map=[0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,0,0,];
  37. var mask=[0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,];
  38.  
  39. function path_create(map,width,height,point,range,mask)
  40. {
  41. // map = pure map with 0 as floor and 1 as wall
  42. // width, height = size of map
  43. // point = starting point to calculate movement range
  44. // range = number of moves from starting point to each direction of horizontal, vertical, and diagonal
  45. // mask = (optional) if possible to do, array mask (0 is not in range) can change range for diagonal moves with special shapes like circle or rhombus
  46. var matrix=[];
  47. return matrix;
  48. // one dimension array where 0 is no range, and 1 is ok
  49. }
  50.  
  51. function path_show(matrix,width,height)
  52. {
  53. var v="";
  54. for(var i=0; i<matrix.length; i++)
  55. {
  56. if(i!=0 && i%7==0){v=v+"<br>";}
  57. v=v+matrix[i]+" ";
  58. }
  59. document.getElementById('results').innerHTML=v;
  60. }
  61.  
  62. path_show(path_create(map,7,7,25,3,mask));
  63. //path_show(path_create(map,7,7,16,3,mask));
  64. </script>
  65.  
  66. if (!mask[i][j] || array[i][j] === 1 || !steps || reach[i][j] >= steps) {
  67. return;
  68. }
Add Comment
Please, Sign In to add comment