-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhosOnFirst.html
170 lines (156 loc) · 5.87 KB
/
whosOnFirst.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Who's on first - Keep Talking</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
tbody {
border: 1px solid black;
}
td {
border: 1px solid black;
width: 20px;
height: 20px;
font-size: 10pt;
text-align: center;
}
</style>
</head>
<body>
<h3>Who's on first</h3>
<button type="button" onclick="reset();">Reset</button><br>
Step 1: <input type="text" id="txtDisplay"><br>
Step 2: <input type="text" id="txtButton"><br>
<span id="out"></span>
<script>
var txtDisp = document.getElementById("txtDisplay");
var txtBtn = document.getElementById("txtButton");
var out = document.getElementById("out");
function init() {
txtDisp.addEventListener("keyup", update);
txtBtn.addEventListener("keyup", update);
update();
}
function update() {
var erg = "";
erg += "<h3>Step 1</h3>" + update1() + "<br>";
erg += "<h3>Step 2</h3>" + update2();
out.innerHTML = erg;
}
function update1() {
var tab = "<table><tbody><tr><th colspan = '2'>" + txtDisp.value + "</th></tr>";
var parts = step1[txtDisp.value.trim().toLowerCase()]
if (parts != undefined) {
parts = parts.split("");
var erg = replacementX[parts[0]] + " " + replacementY[parts[1]];
for (var i = 0; i < parts.length; i++) {
parts[i] = parseInt(parts[i]);
}
for (var y = 0; y < 3; y++) {
tab += "<tr>"
for (var x = 0; x < 2; x++) {
if (parts[0] == x && parts[1] == y) {
tab += "<td>X</td>";
} else {
tab += "<td></td>";
}
}
tab += "</tr>"
}
tab += "</tbody></table>"
return erg + tab;
} else {
return "";
}
}
function update2() {
return step2[txtBtn.value.trim().toLowerCase()];
}
function reset() {
txtDisp.value = "";
txtBtn.value = "";
update();
}
var step1 = {
"yes": "01",
"first": "10",
"display": "12",
"okay": "10",
"says": "12",
"nothing": "01",
"": "02",
"blank": "11",
"no": "12",
"led": "01",
"lead": "12",
"read": "11",
"red": "11",
"reed": "02",
"leed": "02",
"hold on": "12",
"you": "11",
"you are": "12",
"your": "11",
"you're": "11",
"youre": "11",
"ur": "00",
"there": "12",
"they're": "02",
"theyre": "02",
"their": "11",
"they are": "01",
"see": "12",
"c": "10",
"cee": "12",
};
var replacementX = {
0: "left",
1: "right"
};
var replacementY = {
0: "top",
1: "middle",
2: "bottom"
};
var step2 = {
"ready": "yes, okay, what, middle, left, press, right, blank, ready",
"first": "left, okay, yes, middle, no, right, nothing, uhhh, wait, blank, what, press, first",
"no": "blank, uhhh, wait, first, what, ready, right, yes, nothing, left, press, okay, no",
"blank": "wait, right, okay, middle, blank",
"nothing": "uhhh, right, okay, middle, yes, blank, no, press, left, what, wait, first, nothing",
"yes": "okay, right, uhhh, middle, first, what, press, ready, nothing, yes",
"what": "uhhh, what",
"uhhh": "ready, nothing, left, what, okay, yes, right, no, press, blank, uhhh",
"left": "right, left",
"right": "yes, nothing, ready, press, no, wait, what, right",
"middle": "blank, ready, okay, what, nothing, press, no, wait, left, middle",
"okay": "middle, no, first, yes, uhhh, nothing, wait, okay",
"wait": "uhhh, no, blank, okay, yes, left, first, press, what",
"press": "right, middle, yes, ready, press",
"you": "sure, you are, your, you're, next, uh huh, ur, hold, what?, you",
"you are": "your, next, like, uh huh, what?, done, uh uh, hold, you, u, you're, sure, ur, you are",
"your": "uh uh, you are, uh huh, your",
"you're": "you, you're",
"youre": "you, you're",
"ur": "done, u, ur",
"u": "uh huh, sure, next, what?, you're, ur, uh uh, done, u",
"uh huh": "uh huh",
"uhhuh": "uh huh",
"uh uh": "ur, u, you are, you're, next, uh uh",
"uhuh": "ur, u, you are, you're, next, uh uh",
"what?": "you, hold, you're, your, u, done, uh uh, like, you are, uh huh, ur, next, what?",
"done": "sure, uh huh, next, what?, your, ur, you're, hold, like, you, u, you are, uh uh, done",
"next": "what?, uh huh, uh uh, your, hold, sure, next",
"hold": "you are, u, done, uh uh, you, ur, sure, what?, you're, next, hold",
"sure": "you are, done, like, you're, you, hold, uh huh, ur, sure",
"like": "you're, next, u, ur, hold, done, uh uh, what?, uh huh, you, like"
};
init();
</script>
</body>
</html>