-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
61 lines (56 loc) · 2.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.js"></script>
<script src="pathfind.js"></script>
<link rel="stylesheet" href='style.css' />
</head>
<body ng-app="PathfinderApp">
<h3>Instructions:</h3>
<p>
Click a dark tile and drag to paint a wall.<br>
Click a light tile and drag to paint a path.
</p>
<p>
The new maze is sent to the server and solved when you release the mouse.
</p>
<p>
This is a very simple brute force recursive solver and you <i>can break it</i>. It's just a cute demo.
</p>
<div ng-controller="MazeCtrl">
<div class="panel left">
<div class="arrow">▶</div>
<div class="controls">
<div>width: {{ maze.grid[0].length }}</div>
<input name="width" type="range" min="4" max="30" value="9">
<div>height: {{ maze.length }}</div>
<input name="height" type="range" min="4" max="30" value="9">
</div>
</div>
<div class="panel right">
<ul id="solutions">
<li ng-repeat="s in maze.solutions"
ng-mouseover="maze.grid = s"
ng-mouseleave="maze.grid = original.grid">
Path #{{ $index + 1 }} ( {{ s.steps }} steps )</li>
</ul>
</div>
<div id="maze_container">
<div id="maze">
<div ng-repeat="row in maze.grid"
class="row">
<div ng-repeat="cell in row"
ng-mousedown="startPainting(cell, $event)"
ng-mouseup="stopPainting()"
ng-mouseenter="paint(cell, $event)"
ng-click="toggle_wall(cell)"
class="cell {{ cell.type }}"
style="width: {{ 30 / maze.grid[0].length }}em;
height: {{ 30 / maze.grid[0].length }}em">
</div>
</div>
</div>
</div>
</div>
</body>
</html>