Skip to content

Commit

Permalink
add point values for letters
Browse files Browse the repository at this point in the history
  • Loading branch information
joshparkerj committed Mar 8, 2024
1 parent 778932a commit 00a380b
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion gmw/cheat-wos.user.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
const pointValues = {
a: 1,
b: 3,
c: 3,
d: 2,
e: 1,
f: 4,
g: 2,
h: 4,
i: 1,
j: 1,
k: 5,
l: 1,
m: 3,
n: 1,
o: 1,
p: 3,
q: 1,
r: 1,
s: 1,
t: 1,
u: 1,
v: 4,
w: 4,
x: 8,
y: 4,
z: 10,
};

const score = (w) => [...w].reduce((acc, c) => acc + pointValues[c], 0);

const dict = [];

const getDict = (t, p) => {
Expand Down Expand Up @@ -72,4 +103,13 @@ const solveMissing = (a, l) => {
return JSON.stringify([...abc].map((c) => solveFake(a + c, l, preDict)));
};

export default { solve, solveFake, solveMissing };
const display = (solutions) => (
JSON.stringify(solutions.map((w) => (
`${w} ${score(w)}`
)).sort((a, b) => (
Number(b.match(/\d+/)) - Number(a.match(/\d+/))
))));

export default {
solve, solveFake, solveMissing, display,
};

0 comments on commit 00a380b

Please sign in to comment.