-
Notifications
You must be signed in to change notification settings - Fork 1
/
tree-creation.html
219 lines (205 loc) · 8.48 KB
/
tree-creation.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tree Creation</title>
<link href="css/styles.css" rel="stylesheet">
<script src="js/tree-creation.js" type="module" defer></script>
<!-- import custom font Nunito -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<script src="https://kit.fontawesome.com/fbeeabe0fc.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.5/seedrandom.min.js"></script>
</head>
<body>
<section class="main-container">
<section class="icon-container">
<i class="fas fa-lightbulb dark-mode-toggle"></i>
<i class="fa-solid fa-rotate-right reset-icon"></i>
<a href="./index.html">
<i class="fa-solid fa-arrow-left"></i>
</a>
</section>
<section class="canvas-container">
<section class="insert-delete-container" id="insert-delete-section">
<ul>
<li>
<button class="insert">Insert</button>
<input type="number" name="insert" id="insert">
</li>
<li>
<button class="delete">Delete</button>
<input type="number" name="delete" id="delete">
</li>
</ul>
</section>
<div class="holder">
<ul>
<li>
<label id="treeDegree" value=""></label>
</li>
</ul>
<canvas id="canvas" width="900px" height="670px">
</canvas>
</div>
<section class="controls">
<section class="zoom-controls">
</section>
<section class="panning-controls">
<section class="left-section">
<button type="button" class="l">
←
</button>
</section>
<section class="mid-section">
<button type="button" class="up">
↑
</button>
<button type="button" class="m">
·
</button>
<button type="button" class="down">
↓
</button>
</section>
<section class="right-section">
<button type="button" class="r">
→
</button>
</section>
</section>
</section>
<div id="solution-popup" class="popup">
<div id="solution-panel" class="solution">
<span class="close" id="close-solution">×</span>
<h2 id="solution-heading">Correct Tree</h2>
<canvas id="solution-canvas" width="900px" height="450px"></canvas>
</div>
</div>
<div id="help-guide" class="guide">
<div class="guide-content">
<span class="close" id="close-help-guide">×</span>
<h2 id="guide-heading">Getting Started Guide</h2>
<p>Here's a guide to using this B-tree simulator:</p>
<ul>
<li><strong>Max Degree (for tree creation):</strong> Enter a number as the maximum degree of the
B-tree.</li>
<li><strong>Num keys (for tree creation):</strong> Enter a number as the number of keys in the
tree.</li>
<li><strong>Random Tree:</strong> Click this button when you have filled in Max Degree and Num
Keys to have a randomised tree.</li>
<li><strong>Custom Tree:</strong> Click this button to create your own B-tree, this will enable
the insert and delete buttons.</li>
<li><strong>Insert:</strong> Enter a number and click this button to insert a node into the
tree.</li>
<li><strong>Delete:</strong> Enter a number and click this button to delete a node from the
tree.</li>
<li><strong>Seeds:</strong> Enter a number and check the "Use Seed" option to generate the same
random tree from reused parameters. Enter a different seed to generate a different tree with the same parameters.</li>
</ul>
</div>
</div>
</section>
</section>
<section class="side-panel">
<!-- Create Tree View -->
<section class="parameters-container" id="parameters-container-c">
<ul>
<h2>Generation Constraints</h2>
<li>
<button type="button" class="random-tree">
Random Tree
</button>
</li>
<li>
<button type="button" class="custom-tree">
Custom Tree
</button>
</li>
<li>
<label id="error-message" value=""></label>
</li>
<li>
<label for="max-degree">Max Degree</label>
<input type="number" name="max-degree" id="max-degree" autofocus>
</li>
<li>
<label for="num-keys">Num Keys</label>
<input type="number" name="num-keys" id="num-keys">
</li>
<li>
<label for="seed">Seed</label>
<input type="number" name="seed" id="seed">
</li>
<li>
<label for="use-seed">Use Seed</label>
<input type="checkbox" name="use-seed" id="use-seed">
</li>
</ul>
<ul>
<h2>Save/Load</h2>
<li>
<button class="save">
Save
</button>
</li>
<li>
<label for="fileInput" class="custom-file-upload">
Load
<input type="file" id="fileInput" accept=".txt" class="load" value="Load">
</label>
</li>
</ul>
<ul>
<h2>More</h2>
<button id="generate-questions-single-tree">Generate Questions on Tree</button>
<li>
<button id="help-button">Need Help?</button>
</li>
</ul>
</section>
<!-- Question View -->
<section class="parameters-container" id="parameters-container-q">
<ul>
<li>
<label id="question" value=""></label>
</li>
<li>
<button class="random-question">
Next Question
</button>
</li>
<li>
<button class="validate">
Check Answer
</button>
</li>
<li>
<button class="show-correct-tree">
Show Correct Tree
</button>
</li>
<li>
<label id="validation" value=""></label>
</li>
</ul>
<ul>
<li>
<label id="treeDegree" value=""></label>
</li>
</ul>
<ul>
<h2>More</h2>
<li>
<button class="back">Back to Custom Creation</button>
</li>
<li>
<button id="help-button">Need Help?</button>
</li>
</ul>
</section>
</section>
</body>
</html>