/a_star_backbone/main.html

https://github.com/siyegen/A--backbone · HTML · 43 lines · 39 code · 4 blank · 0 comment · 0 complexity · b18f531b163f5ce3f72d4e082f510853 MD5 · raw file

  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <title>A* demo with a backbone</title>
  5. <script src="./js/underscore.js"></script>
  6. <script src="./js/jquery-1.6.4.js"></script>
  7. <script src="./js/backbone.js"></script>
  8. <script src="./js/json2.js"></script>
  9. <script data-main="js/a_star" src="js/require.js"></script>
  10. <link href="./css/style.css" media="all" rel="stylesheet" type="text/css">
  11. </head>
  12. <body>
  13. <script type="text/template" id="grid-template">
  14. <table class="grid">
  15. <% for(var i=0; i<rows; i++){%><tr id="row-<%= i %>"></tr><% }%>
  16. </table>
  17. </script>
  18. <script type="text/template" id="button-template">
  19. <button class="btn primary" id="<%= id %>"><%= name %></button>
  20. </script>
  21. <script type="text/template" id="help-text">
  22. <p>
  23. A* demo with a backbone. Input the number of rows and columns in the range [2, 20].
  24. </p>
  25. <p>
  26. Click build to build the grid. Click and drag the start/end (green/red) cells to move them.
  27. Click and drag any other cell to toggle whether it's passable or not.
  28. </p>
  29. <p>
  30. When you're ready, click 'Start' to let the algo try to find a path. The path is shown in light
  31. blue, and expanded (or travelled) cells are shown in a varying color depending on the cost to get
  32. there from the start cell. If you want to make changes to the grid and try again click 'Unlock',
  33. make your changes, and then click 'Start' again. Clicking 'Build' again will reset the div. Be
  34. warned that resizing the window so that the grid changes size will cause the inputs to be off till
  35. you rebuild.
  36. </p>
  37. </script>
  38. </body>
  39. </html>