Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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,
- 0, 0, 0, 0, 0, 0, 0,
- 3, 1, 1, 1, 1, 1, 0,
- 3, 3, 3, 3, 3, 1, 1,
- 3, 3, 3, 2, 3, 3, 3,
- 1, 3, 3, 3, 3, 1, 1,
- 3, 1, 3, 1, 1, 1, 0,
- 0, 1, 3, 1, 0, 0, 0,
- 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,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 0,
- 0, 3, 3, 3, 3, 1, 1,
- 3, 3, 3, 2, 3, 3, 3,
- 1, 3, 3, 3, 3, 1, 1,
- 0, 1, 3, 1, 1, 1, 0,
- 0, 1, 0, 1, 0, 0, 0,
- <div id="results" style="font-family: monospace; font-weight: bold; font-size: 24pt; background-color: #000000; color: #FFFFFF;">
- </div>
- <script>
- 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,];
- 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,];
- function path_create(map,width,height,point,range,mask)
- {
- // map = pure map with 0 as floor and 1 as wall
- // width, height = size of map
- // point = starting point to calculate movement range
- // range = number of moves from starting point to each direction of horizontal, vertical, and diagonal
- // 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
- var matrix=[];
- return matrix;
- // one dimension array where 0 is no range, and 1 is ok
- }
- function path_show(matrix,width,height)
- {
- var v="";
- for(var i=0; i<matrix.length; i++)
- {
- if(i!=0 && i%7==0){v=v+"<br>";}
- v=v+matrix[i]+" ";
- }
- document.getElementById('results').innerHTML=v;
- }
- path_show(path_create(map,7,7,25,3,mask));
- //path_show(path_create(map,7,7,16,3,mask));
- </script>
- if (!mask[i][j] || array[i][j] === 1 || !steps || reach[i][j] >= steps) {
- return;
- }
Add Comment
Please, Sign In to add comment