-
Notifications
You must be signed in to change notification settings - Fork 45
/
index.html
196 lines (190 loc) · 6.16 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Maze generator</title>
<style type="text/css">
body {
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
margin: 0 1em 1em;
}
p label, .color-picker label {
width: 10em;
display: inline-block;
}
p.desc, #download {
font-size: smaller;
}
p.desc {
border-top: 1px solid #afafaf;
padding-top: 1em;
}
.hide {
display: none;
}
.controls {
padding-bottom: 1em;
}
canvas {
/* if canvas overflows body */
margin-right: 1em;
}
.color-picker {
margin: 16px 0;
display:flex;
position: relative;
}
.color-sample {
width: 1em;
border: 1px solid #000;
margin: 0 .5em;
}
.color-picker {
margin-left: 5px;
}
.palette {
margin: 1.5em 0 0 10em;
width: 270px;
background: #efefef;
border: 1px solid #bcbcbc;
border-radius: 1px;
display: none;
padding: 1px;
position: absolute;
z-index: 1000;
}
.palette div {
width: 18px;
height: 18px;
margin: 3px;
cursor:pointer;
display: inline-block;
}
.palette div:focus {
outline-width: 2px;
outline-style: dashed;
}
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
word-wrap: normal !important; /* many screen reader and browser combinations announce broken words as they would appear visually */
}
noscript p {
border: 1px solid red;
padding: 1em;
}
#generate {
border-top: 1px solid #afafaf;
padding-top: 1em;
}
button {
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
padding:5px 1em;
margin-right: .5em;
font-size: .9em;
background:#3377ff;
color: #fff;
border:0 none;
cursor:pointer;
-webkit-border-radius: 3px;
border-radius: 5px;
}
button:hover {
background:#0055ff;
}
</style>
</head>
<body>
<h1>Maze Generator</h1>
<p>
Create, solve and download random maze puzzles in any size or color with this online tool. Enter the values for your maze design below and click the "Generate Maze" button.</p>
<p>
The <a href="https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker">recursive backtracking algorithm</a> is used to create the mazes.
For more information check out the <a href="https://github.com/keesiemeijer/maze-generator">Github Repository</a>.
</p>
<hr>
<div class="controls">
<p>
<label for="wall-size">Wall thickness:</label>
<input id="wall-size" type="number" name="" value="10" min="1">
</p>
<p>
<label for="width">Columns:</label>
<input id="width" type="number" name="width" value="20" min="3" max="200">
</p>
<p>
<label for="height">Rows:</label>
<input id="height" type="number" name="height" value="20" min="3" max="200">
</p>
<p>
<label for="entry">Maze entries:</label>
<select id="entry" name="entry">
<option value="">none</option>
<option value="diagonal" selected="selected">diagonal</option>
<option value="horizontal">left and right</option>
<option value="vertical">top and bottom</option>
</select>
</p>
<p>
<label for="bias">Bias:</label>
<select id="bias" name="bias">
<option value="">none</option>
<option value="horizontal">horizontal</option>
<option value="vertical">vertical</option>
</select>
</p>
<p class='desc'>
The maze can be solved in multiple ways if you remove maze walls. (maximum <span>300</span> walls)<br/>
The <a href='https://en.wikipedia.org/wiki/A*_search_algorithm'>A* search algorithm</a> is used to find the shortest path. This takes more time solving the maze.
</p>
<p style='padding-bottom: 0; margin-bottom: 0;'>
<label for="remove_walls">Remove maze walls:</label>
<input id="remove_walls" type="number" name="remove_walls" value="0" min="0" max="200">
</p>
<p class='desc'>
Click the colors below to select a color from a color pallete.
</p>
<div class="color-picker" data-default="#ffffff">
<label for="backgroundColor">Background Color</label>
<input type="text" class="" id="backgroundColor" name="backgroundColor" value="#ffffff"><div class="color-sample" style="background-color:#ffffff"></div>
</div>
<div class="color-picker" data-default="#000000">
<label for="color">Maze Color</label>
<input type="text" class="" id="color" name="color" value="#000000"><div class="color-sample" style="background-color:#000000"></div>
</div>
<div class="color-picker" data-default="#cc3737">
<label for="solveColor">Solve Color</label>
<input type="text" class="" id="solveColor" name="solveColor" value="#cc3737" pattern="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"><div class="color-sample" style="background-color:#cc3737"></div>
</div>
<div id="generate">
<button id="create-maze" onclick="initMaze();" class='hide'>Generate Maze</button>
<button id="solve" onclick="initSolve();" class='hide'>Solve Maze</button>
<a href="" class="hide" id="download">download maze</a>
</div>
</div>
<noscript>
<p>Sorry... this site requires JavaScript to generate a maze. Please enable it in your browser</p>
</noscript>
<script type="text/javascript">
const createMazeButton = document.getElementById('create-maze');
createMazeButton.classList.toggle("hide")
</script>
<canvas id="maze"></canvas>
<script type="text/javascript" src="src/globals.js"></script>
<script type="text/javascript" src="src/utils.js"></script>
<script type="text/javascript" src="src/entries.js"></script>
<script type="text/javascript" src="src/maze.js"></script>
<script type="text/javascript" src="src/solver.js"></script>
<script type="text/javascript" src="src/app.js"></script>
<script type="text/javascript" src="src/human-colours-en-gb.js"></script>
<script type="text/javascript" src="src/color-picker.js"></script>
</body>
</html>