Skip to content

Commit 19d8010

Browse files
committed
Better matching in Classic
1 parent 44fdbeb commit 19d8010

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

sets/main.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
let meta1 = document.createElement("meta");
2+
meta1.property = "og:image";
3+
meta1.content = "../../icon.jpg";
4+
document.head.appendChild(meta1);
5+
6+
let meta2 = document.createElement("meta");
7+
meta2.property = "og:image:width";
8+
meta2.content = "256";
9+
document.head.appendChild(meta2);
10+
11+
let meta3 = document.createElement("meta");
12+
meta3.property = "og:image:height";
13+
meta3.content = "256";
14+
document.head.appendChild(meta3);
15+
116
let lst = words.split("\n").map((l) => l.split("\t"));
217

318
let h1 = document.querySelector("h1");
@@ -37,6 +52,24 @@ function remove_punctuation(string) {
3752
.join("");
3853
}
3954

55+
function generate_options(str) {
56+
if (![...str].includes("(")) {
57+
return [str];
58+
}
59+
let ret = [str];
60+
for (let ind = 0; ind < str.length; ind++) {
61+
let chr = str[ind];
62+
if (chr === "(") {
63+
let prev = str.slice(0, ind);
64+
while (str[ind] !== ")") {
65+
ind++
66+
}
67+
ret.push(prev + str.slice(ind + 1));
68+
}
69+
}
70+
return ret;
71+
}
72+
4073
function check_input_classic() {
4174
total++;
4275
/* Easy mode: (document.getElementById("inp").value.toLowerCase().split(" ").map(q =>
@@ -51,6 +84,8 @@ function check_input_classic() {
5184
.split("/")
5285
.map((q) => q.split(", "))
5386
.flat()
87+
.map((p) => generate_options(p))
88+
.flat()
5489
.map((r) => remove_punctuation(r))
5590
.includes(
5691
remove_punctuation(document.getElementById("inp").value.toLowerCase()),

0 commit comments

Comments
 (0)