-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (143 loc) · 6.99 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
<!DOCTYPE html>
<html lang="en" ng-app="abTreePractice">
<head>
<meta charset="utf-8">
<title>Alpha-Beta Pruning Practice</title>
<meta property="og:title" content="Alpha-Beta Pruning Practice">
<meta property="og:site_name" content="Alpha-Beta Pruning Practice">
<meta property="og:type" content="website">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.4/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/5.0.12/bootstrap-slider.min.js"></script>
<script src="app.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/5.0.12/css/bootstrap-slider.min.css">
<link rel="stylesheet" href="app.css">
</head>
<body ng-controller="MainCtrl">
<nav class="navbar navbar-inverse navbar-static-top nomargin" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<span class="navbar-brand">Alpha-Beta Pruning Practice</span>
</div>
<div class="nav navbar-nav navbar-right">
<li ng-click="setUseAb(true)" class="{{useAb ? 'active' : ''}}"><a>αβ</a></li>
<li ng-click="setUseAb(false)" class="{{!useAb ? 'active' : ''}}"><a>Cutoff</a></li>
</div>
</div>
</nav>
<div class="container-fluid nopadding">
<ab-tree class="ab-tree" tree="tree" use-ab="useAb" re-render="reRender"></ab-tree>
<div class="container-fluid ctrl-panel">
<div class="row text-center">
<button ng-click="toggleABVisual()" type="button" class="btn btn-default">
{{actionLQ.inAction ? 'Stop' : 'Start'}} Animation
</button>
</div>
<div class="{{actionLQ.inAction ? '' : 'hidden'}}">
<div class="row text-center">
<div class="btn-group">
<button ng-disabled="!actionLQ.inAction" ng-click="play()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-play"></span>
</button>
<button ng-disabled="!actionLQ.inAction" ng-click="pause()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button ng-disabled="!actionLQ.inAction" ng-click="stepBackward()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-backward"></span>
</button>
<button ng-disabled="!actionLQ.inAction" ng-click="stepForward()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-forward"></span>
</button>
<button ng-disabled="!actionLQ.inAction" ng-click="goToBeginning()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-fast-backward"></span>
</button>
<button ng-disabled="!actionLQ.inAction" ng-click="goToEnd()" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-fast-forward"></span>
</button>
</div>
</div>
<div class="row text-center">
<div class="progress">
<div class="progress-bar"
role="progressbar"
aria-valuenow="{{actionLQ.lastAction + 1 + 0.001}}"
aria-valuemin="0"
aria-valuemax="{{actionLQ.length + 0.001}}"
style="width: {{((actionLQ.lastAction + 1) / actionLQ.length) * 100 + 0.0001}}%"
>
<span class="sr-only">{{((actionLQ.lastAction + 1) / actionLQ.length) * 100}}% Complete (success)</span>
</div>
</div>
</div>
<div class="row text-center">
<label class="slider-label left">Slow</label>
<input class="slider"
type="text"
data-placement="bottom"
data-slider-min="25"
data-slider-max="1675"
data-slider-step="25"
data-slider-value="850"
/>
<label class="slider-label right">Fast</label>
</div>
</div>
<div class="{{actionLQ.inAction ? 'hidden' : ''}}">
<hr/>
<div class="row">
<div class="col-sm-6 button-label-container text-right">
<label class="button-label">Depth</label>
</div>
<div class="col-sm-6">
<div class="btn-group">
<button ng-click="incrDepth(-1)" type="button" class="btn btn-default">-</button>
<button ng-click="incrDepth(1)" type="button" class="btn btn-default">+</button>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 button-label-container text-right">
<label class="button-label">Branching Factor</label>
</div>
<div class="col-sm-6">
<div class="btn-group">
<button ng-click="incrBranchingFactor(-1)" type="button" class="btn btn-default">-</button>
<button ng-click="incrBranchingFactor(1)" type="button" class="btn btn-default">+</button>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-sm-6 text-right">
<button ng-click="flipMax()" type="button" class="btn btn-default">Swap Min/Max</button>
</div>
<div class="col-sm-6 text-left">
<button ng-click="generateRootNode()" type="button" class="btn btn-default">Regenerate Tree</button>
</div>
</div>
<div class="row">
<div class="col-sm-6 text-right">
<button ng-disabled="actionLQ.inAction" ng-click="resetTree()" type="button" class="btn btn-default">Reset Tree</button>
</div>
<div class="col-sm-6 text-left">
<button ng-disabled="actionLQ.inAction" ng-click="showSolution()" type="button" class="btn btn-default">Show Solution</button>
</div>
</div>
<div class="row">
<div class="col-sm-6 text-right">
<button ng-disabled="actionLQ.inAction" ng-click="checkAnswer()" type="button" class="btn btn-default">Check Answer</button>
</div>
<div class="col-sm-6 button-label-container">
<label class="button-label answer-{{correct}}">
{{(correct == null) ? '--' : (correct ? 'Correct!' : 'Incorrect')}}
</label>
</div>
</div>
</div>
</div>
</div>
<div class="prune-info">
<span>Nodes are pruned when {{useAb ? 'β ≤ α' : 'value is in cutoff range'}}.</span>
</div>
</body>
</html>