-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise.html
190 lines (151 loc) · 9.58 KB
/
exercise.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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='og:viewport' content='width=device-width,initial-scale=1'>
<meta name="og:description" content="Binary tree builder">
<title>Binary tree exercises</title>
<link rel="stylesheet" href="css/index.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" type="image/x-icon" href="./assets/favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Finlandica&display=swap" rel="stylesheet">
</head>
<body>
<nav id="nav1">
<ul class="nav-items navleft">
<li class="headername">Binary Tree Exercises</li>
</ul>
<ul class="nav-items navcenter" id="nav">
<li><a class="larget" onclick="resettree();">Reset Tree</a></li>
<li><a class="larget" onclick="openel('sharetree'); createshareURL(); openscreen();">Share Tree</a></li>
<li><a class="larget" href="./index.html">Binary Tree Builder</a></li>
<li><a class="larget" id='header2' href="./bst.html">BST Classification</a></li>
</ul>
<ul class="nav-items navright">
<li title="Settings"><a onclick="openprefs(); openscreen();"><img src="assets/settings.png" height="30px" class="logo"></a></li>
<li title="Help"><a onclick="openel('instructions'); openscreen();" ><img src="assets/help.png" height="30px" class="logo" style="cursor: help;"></a></li>
<li title="Report bug"><a href="https://github.com/skparab1/binarytree/issues/new" target="_blank"><img src="assets/reportbuggy.png" height="30px" class="logo"></a></li>
</ul>
</nav>
<div class="fullwidth">
<h1 id='head' style="font-size: 50px; color: rgba(0,0,0,0);">e</h1>
</div>
<div id="treeholder">
</div>
<div id="connectors">
</div>
<div class="exercisetab">
<div class="feedbackspacer" id="feedbackspacer">
</div>
<br>
<br>
<h2 class="exerciseprompt" id="exerciseprompt">Exercise: </h2>
<div clas="buttonbucket">
<div class="checkexercise" onclick="lightup();">Light-up Animation</div>
<div class="checkexercise" style="margin-left: 5%;" onclick="verifyexercise();">Check</div>
<div class="checkexercise" style="margin-left: 5%;" onclick="localStorage.removeItem('binarytreestorage'); location.reload();">New Exercise</div>
</div>
</div>
<!--
<div id='res' class="results" onmouseenter="raiseresults();" onmouseleave="lowerresults();">
<button class="exit-modal" onclick="if (!stayingup){ raiseresults(); stayingup = true; document.getElementById('sb').textContent = 'Unlock movement';} else {stayingup = false; document.getElementById('sb').textContent = 'Lock movement';}"><p id='sb'>Lock movement</p></button>
<button class="exit-modal" style='left: 15px;' onclick="openprefs(); openscreen();"><p id='prefs'>Preferences</p></button>
<h1>Output</h1>
<div class="guesstile">
<h3>Post order <span id='playpost' onclick=" if (!disabled){(async () => { disableplay(); redrawtree(); await glowtreepostorder(root); enableplay(); })();}" style="color: rgb(255, 51, 0); cursor: pointer; font-size: 15px;"> (Light-up animation)</span></h3>
<input class="guess" id="postorder">
</div>
<div class="guesstile">
<h3>In order <span id='playin' onclick=" if (!disabled){(async () => { disableplay(); redrawtree(); await glowtreeinorder(root); enableplay(); })();}" style="color: rgb(255, 51, 0); cursor: pointer; font-size: 15px;"> (Light-up animation)</span></h3>
<input class="guess" id="inorder">
<div class="check" onclick="checkall();">Check All</div>
<div class="check" onclick="showsolutions();">Solutions</div>
</div>
<div class="guesstile">
<h3>Pre order <span id='playpre' onclick=" if (!disabled){(async () => { disableplay(); redrawtree(); await glowtreepreorder(root); enableplay(); })();}" style="color: rgb(255, 51, 0); cursor: pointer; font-size: 15px;"> (Light-up animation)</span></h3>
<input class="guess" id="preorder">
</div>
</div> -->
<div id="screen" class="screen"></div>
<div class="largenotif" id="solutions">
<!-- warning: everything inside of this is overwritten by js function checkall. do not change this -->
<h1>Solutions</h1>
<h5 id="preordersol">Pre order: </h5>
<h5 id="inordersol">In order: </h5>
<h5 id="postordersol">Post order: </h5>
<div class="close" onclick="closesolutions();">Close</div>
</div>
<div class="largenotif" id="preferences" style="height: fit-content;">
<h1 style="font-size: 25px;">Settings</h1>
<h3 style="font-size: 15px; margin-bottom: 5px; margin-top: 0px;" id="theme">Theme: (Dark)</h3>
<label class="switch" onclick="toggletheme();">
<input type="checkbox">
<span class="slider round"></span>
</label>
<h3 style="font-size: 15px; margin-bottom: 5px; margin-top: 0px;" id="lines">Lines: (Cornered)</h3>
<label class="switch" onclick="toggleangle();">
<input type="checkbox">
<span class="slider round"></span>
</label>
<h3 style="font-size: 15px; margin-bottom: 0px; margin-top: 0px;" id="animwait">Light-up animation delay time: 500ms</h3>
<div class="slide2container" style="margin-top: -20px;">
<input type="range" min="100" max="2000" value="500" step="10" class="slider2" name="waittime" id="waittime" onchange="document.getElementById('animwait').textContent = 'Light-up animation delay time: '+document.getElementById('waittime').value+'ms'; localStorage.setItem('btspeed',document.getElementById('waittime').value);">
</div>
<div class="close" onclick="closeprefs(); closescreen();">Close</div>
</div>
<div class="wrong" id="wr">
<h1>Incorrect!</h1>
<h5 id="explanation" style="color: var(--contrast); font-size: 25px; font-weight: bolder; border-radius: 25px; background-color: var(--bg);">Explanation</h5>
<div class="close" onclick="closeel('wr'); lightup()">Light up Animation</div>
<div class="close" onclick="closeel('wr');">Close</div>
</div>
<div class="wrong" id="corr">
<h1>Correct!</h1>
<h3>Good job!</h3>
<div class="close" onclick="closeel('corr');">Close</div>
<div class="close" onclick="localStorage.removeItem('binarytreestorage'); location.reload();">New Exercise</div>
</div>
<div class="largenotif" id="randomtree" style="height: min-content; top: 15%;">
<h1 style="margin-bottom: 0px; font-size: 25px;">Generate random tree</h1>
<h3 style="margin-bottom: 0px; font-size: 25px;">Max number of levels</h3>
<select class='guess' name="numnodes" id="numnodes" onchange="initnums();">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
</select>
<h3 style="margin-bottom: 0px; font-size: 25px;">Tree type</h3>
<select class='guess' name="treetype" id="treetype" onchange="localStorage.setItem('treetype',document.getElementById('treetype').value);">
<option value="alpha">Alphabetical</option>
<option value="numeric">Numerical</option>
<option value="rand">Random</option>
</select>
<div class="close" onclick="closeel('randomtree'); closescreen(); root = randtree(); redrawtree();">Generate</div>
<div class="close" onclick="closeel('randomtree'); closescreen();">Cancel</div>
</div>
<div class="largenotif" id="instructions" style="top: 100%; opacity: 0; height: auto; margin-bottom: 50px;">
<h1 style='font-size: 25px; margin: 10px;'>How to use</h1>
<h5 style='font-size: 15px; margin: 10px;'>1. Use the left/right buttons to add nodes and delete button to remove nodes.</h5>
<h5 style='font-size: 15px; margin: 10px;'>2. Build a binary tree that meets the specifications of the prompt.</h5>
<h5 style='font-size: 15px; margin: 10px;'>3. Click "Check" to verify answer.</h5>
<h5 style='font-size: 15px; margin: 10px;'>4. Click "Light-up animation" to see a light up animation of traversal</h5>
<h5 style='font-size: 15px; margin: 10px;'>5. Click "Share Tree" share your tree with someone else</h5>
<div class="close" onclick="closeinstructions(); closescreen();">Close</div>
</div>
<div class="largenotif" id="sharetree" style="top: 100%; opacity: 0; height: auto; margin-bottom: 50px;">
<h1 style='font-size: 25px; margin: 10px;'>Share Tree</h1>
<h5 style='font-size: 15px; margin: 18px;'>Send the following URL to someone to share your tree with them.</h5>
<div id="copysharelink" class="coolbutton" onclick="copyshare()">Copy link</div>
<h5 id="shareurldisp" style='font-size: 20px; margin: 15px; padding: 10px; border-radius: 25px; color: var(--main); background-color: var(--bg);'></h5>
<div class="close" onclick="closeel('sharetree'); closescreen();">Close</div>
</div>
<!-- <img class="standaloneicon" id="x1" src="assets/redx.png" height="75px" alt="large red x">
<img class="standaloneicon" id="x2" src="assets/redx.png" height="75px" alt="large red x">
<img class="standaloneicon" id="x3" src="assets/redx.png" height="75px" alt="large red x">
<img class="standaloneicon" id="check1" src="assets/greencheck.png" height="75px" alt="green check">
<img class="standaloneicon" id="check2" src="assets/greencheck.png" height="75px" alt="green check">
<img class="standaloneicon" id="check3" src="assets/greencheck.png" height="75px" alt="green check"> -->
<script src="js/exercise.js"></script>
</body>
</html>