forked from Sarose550/Minimax-Visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
213 lines (200 loc) · 9.12 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript" src="tree.js"></script>
<script type="text/javascript" src="utilities.js"></script>
<script type="text/javascript" src="animations.js"></script>
<script type="text/javascript" src="parsertree.js"></script>
<script type="text/javascript" src="parserSML.js"></script>
<style>
#nodeOptions {
display: none;
background-color: #f2f2f2;
border: 1px solid gray;
box-shadow: 1px 1px 1px 1px;
font-size: 11px;
padding: 3px 5px;
}
#infoTab{
border-left: 3px;
border-left-style: solid;
border-color: #abc5f9;
}
#nodeOptions div {
cursor: default;
border-bottom: 1px solid gray;
padding: 2px 4px;
color: black;
}
#nodeOptions div:hover{
background: rgb(217,217,217);
}
#main {
margin: auto;
position: relative;
}
</style>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description"
content="A tool to help students understand minimax and alpha-beta pruning." />
<title>Minimax & Alpha-Beta Pruning Simulator</title>
</head>
<body onload='initKey(); initRoot();'>
<nav class="navbar navbar-expand-lg navbar-light" style="background-color: #2DAFE8;">
<a class="navbar-brand" href="#">Minimax</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active" id="infoTab" style="font-size: 18px; padding-right: 10px;">
<a class="nav-link" href="https://github.com/Sarose550/Minimax-Visualizer/blob/main/README.md"> About <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Edit
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown1">
<a class="dropdown-item" href="#" onclick="hideButtons();resetTree();unhighlightCells();">Clear Parents</a>
<a class="dropdown-item" href="#" onclick="hideButtons();initRoot();">Reset</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Options
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown2">
<a class="dropdown-item" href="#" onclick="copyTree();">Copy Tree</a>
<a class="dropdown-item" href="#" onclick="loadTreeCode();">Load Tree</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" onclick="copyExplicitTree();">Copy SML</a>
<a class="dropdown-item" href="#" onclick="loadExplicitTree();">Load SML</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
View Example
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown3">
<a class="dropdown-item" href="#" onclick="hideButtons();drawEx1();">Example 1</a>
<a class="dropdown-item" href="#" onclick="hideButtons();drawEx2();">Example 2</a>
<a class="dropdown-item" href="#" onclick="hideButtons();drawEx3();">Example 3</a>
<a class="dropdown-item" href="#" onclick="hideButtons();drawEx4();">Example 4</a>
<a class="dropdown-item" href="#" onclick="hideButtons();drawEx5();">Example 5</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Run
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown4">
<a class="dropdown-item" href="#" onclick="compileMinimax();">Minimax</a>
<a class="dropdown-item" href="#" onclick="compileAlphaBeta();">Alpha-Beta Pruning</a>
</div>
</li>
</ul>
<span class="navbar-text" id="speedLabel" style="display: none;">
<b>Speed:</b>
</span>
<ul class="navbar-nav navbar-right mr-auto">
<span id="detector">
<select name="speed" id="speed" style="padding: 3px; margin: 10px; display: none;">
<option value="0.25">0.25x</option>
<option value="0.5">0.5x</option>
<option value="0.75">0.75x</option>
<option value="1.00" selected>Normal</option>
<option value="1.50">1.5x</option>
<option value="2.00">2x</option>
<option value="4.00">4x</option>
</select>
</span>
<button class="btn btn-success navbar-btn-right mr-1" id="button0" style="display: none;" onclick="showFirst();" disabled> << </button>
<button class="btn btn-success navbar-btn-right mr-1" id="button1" style="display: none;" onclick="showPrev();" disabled> < </button>
<button class="btn btn-success navbar-btn-right mr-1" id="button2" style="display: none;" onclick="playBtnClick();"> Play </button>
<button class="btn btn-success navbar-btn-right mr-1" id="button3" style="display: none;" onclick="showNext();"> > </button>
<button class="btn btn-success navbar-btn-right mr-1" id="button4" style="display: none;" onclick="showLast();"> >> </button>
</ul>
</nav>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">αβ-Pruning Description</th>
<th scope="col">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<table class="table table-bordered" id="ab">
<thead>
<tr>
<th scope=col></th>
<th scope="col">v ≤ α</th>
<th scope="col"> α < v < β </th>
<th scope="col"> β ≤ v </th>
</tr>
</thead>
<tbody>
<tr id="maxierow">
<th scope="row">Maxie</th>
<td id="0,0">Ignore</td>
<td id="0,1">Update α</td>
<td id="0,2">Prune</td>
</tr>
<tr id="minnierow">
<th scope="row">Minnie</th>
<td id="1,0">Prune</td>
<td id="1,1">Update β</td>
<td id="1,2">Ignore</td>
</tr>
</tbody>
</table>
</td>
<td>
<table class="table table-bordered" id="key">
<thead>
<tr>
<th scope="col">Maxie</th>
<th scope="col">Minnie</th>
<th scope="col">Leaf</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding-top=0px; padding-bottom=0px; padding-left=0px; padding-right=0px;">
<canvas width="80" height="35" id="key-maxie" style="position: relative; top:0px; left:0px;">
Oh no! Your browser is too old to support canvas! Update to view this page.
</canvas>
</td>
<td style="padding-top=0px; padding-bottom=0px; padding-left=0px; padding-right=0px;">
<canvas width="80" height="35" id="key-minnie" style="position: relative; top:0px; left:0px;">
Oh no! Your browser is too old to support canvas! Update to view this page.
</canvas>
</td>
<td style="padding-top=0px; padding-bottom=0px; padding-left=0px; padding-right=0px;">
<canvas width="80" height="35" id="key-leaf" style="position: relative; top:0px; left:0px;">
Oh no! Your browser is too old to support canvas! Update to view this page.
</canvas>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div id="main">
<canvas width="1200" height="600" id="drawing" style="position: relative; top:0px; left:0px;">
Oh no! Your browser is too old to support canvas! Update to view this page.
</canvas>
<div id="nodeOptions" style="position: absolute; display: none;">
</div>
</div>
</body>
</html>