-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
158 lines (124 loc) · 2.76 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
<!DOCTYPE html>
<html>
<style>
* {
margin: 0;
padding: 0;
}
body,
html {
background-color: black;
height: 100%;
color: white;
}
body {
overflow-x: scroll;
width: fit-content;
}
.char {
display: inline-block;
background-color: red;
padding: 8px;
width: 20px;
height: 20px;
margin: 0px;
user-select: none;
text-align: center;
font-weight: bold;
border: 2px solid black;
vertical-align: top;
}
.word {
position: relative;
display: block;
height: 42px;
white-space: nowrap;
}
.pattern {
top: 0px;
left: 0px;
width: fit-content;
}
@keyframes match {
from {
rotate: -5deg;
}
to {
rotate: 5deg;
}
}
.match {
animation: 500ms linear 0s infinite alternate match;
filter: brightness(1.1);
}
.dismatch {
filter: brightness(0.6);
border: 2px solid gray;
}
.cursor {
border-top: 2px solid white;
}
#playground {
padding: 16px;
margin-top: 20px;
}
.lastOccurrence {
border-radius: 16px;
}
#options {
position: fixed;
bottom: 0px;
padding: 8px;
}
@keyframes error {
from {
background-color: brown;
}
to {
background-color: black;
}
}
.error {
animation: 500ms linear 0s infinite alternate error;
}
@keyframes bravo {
from {
filter: brightness(1.2);
}
to {
filter: brightness(1);
}
}
.bravo {
background: green;
}
#help {
width: 100%;
}
.hidden {
opacity: 0;
}
</style>
<head>
</head>
<body>
<div id="help">
<h1>Boyer-Moore-Horspool algorithm</h1>
The objective is to find the pattern in the word.
Drag and drop the pattern along the word. At each step, you have a current letter <div class="char cursor">A
</div>.
You must align the pattern so that the current letter matches the corresponding last occurrence <div
class="char lastOccurrence">A</div>. If the current letter does not appear in the pattern, you must move
forward.
</div>
<div id="playground">
<div class="word" id="word"></div>
<div class="word pattern" id="pattern"></div>
</div>
<div hidden id="options">
<input id="horspool" type="checkbox" checked></input><label for="horspool">Simplified version of
Horspool</label>
</div>
<script src="main.js"></script>
</body>
</html>