Live data from Hacker News

Show HN: Can you beat my dad at Scrabble?

dadagrams.com

141–144 of 144 posts

Re: Show HN: Can you beat my dad at Scrabble?

#144
post #122

Well... I'm kinda a jerk for this, but it's also a free lesson on why global variables are baaaaad. Also, I wrote this in seconds and I know it could be more efficient / cleaner. don't @ me. Toss this in your browser's dev console to get the best word available for each puzzle instantly function solvePuzzle(puzzle, words) { const letters = {}; puzzle.forEach(l => { if (!letters[l]) { letters[l] = 0; } letters[l]++; }…

> don't @ me I'm @ing you :) This code only checks for the longest word, not the highest scoring word. It neglects the x3 and x2 tile spaces.

Fair point.
Post reply on HN