Skip to content

Commit

Permalink
wordsearch: Scrabble
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Sep 30, 2023
1 parent dfde94d commit a40a284
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wordsearch.pike
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
constant score = "02210313074020029000033739";
mapping ltrscore = mkmapping(enumerate('z' - 'a' + 1, 1, 'a'), (array(int))(score / 1));

mapping counter(string ltrs)
{
mapping ret = ([]);
Expand Down Expand Up @@ -29,7 +32,7 @@ int main(int argc, array(string) argv)
array(string) words = Stdio.read_file(fn) / "\n";
array(string) matches = listwords(words, ltrs, minlength);
foreach (matches, string w)
write("%d %s\n", sizeof(w), w);
write("%d %s\n", sizeof(w) + `+(@ltrscore[((array)w)[*]]), w);
if (!sizeof(words) || !hidden) return 0;
int best = sizeof(matches[-1]) + 1;
for (int ltr = 'a'; ltr <= 'z'; ++ltr) {
Expand Down

0 comments on commit a40a284

Please sign in to comment.