stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

Scrabbly

  • 1 Devlogs
  • 3 Total hours

A Scrabble Training CLI App

Ship #1 Pending review

Shipping Scrabbly

What I built

Scrabbly is a command-line Scrabble trainer, and as of today it’s on npm. You install it with one command and get seven working commands: score, validate, train, find, master-word, help and credits. It checks words against Collins Scrabble Words 2019 (about 279,000 words), drills 2- and 3-letter words by starting letter, finds every word hiding in a rack of tiles (blanks included), and has a game where you draw 7 tiles from a real 100-tile bag and get three guesses at the highest-scoring word.

What was challenging

Making it work on someone else’s machine. Everything ran fine from my project folder, but a published package only includes what you tell npm to include. My first test install crashed on validate because words.txt hadn’t made it into the package at the time.

Blank tiles. A ? in the terminal is a wildcard to the shell, so it needs quotes: scrabbly find “ret?ins”. Scoring blanks was also easy to get wrong. A blank has to be spent only after your real tiles, or it quietly scores as the letter it replaces.

Flags. My plan had find -start qu, but Commander reads a single dash with a full word as five one-letter flags. It became –start, with -s as a short form.

What I am proud of

  • The way the code is split. The functions that work things out (scoreWord, findWords, isValidWord) never print anything. That’s why the Master Word game came together quickly: it calls the same findWords that powers find to work out each round’s answer, so the game has no separate answer key to get wrong.
  • Errors. Every mistake you can make, from a missing word to an unknown flag, gets the same styled message that says what went wrong and how to type it correctly.
  • The look. Tile yellow, tan and wood brown, an animated title, ★ on the best word in each group, and tiles drawn with their points as subscripts (Q₁₀).
  • That it exists. I started this because I wanted to learn two-letter words, and I now use it for that.

How to test Scrabbly

npm install -g scrabbly
scrabbly

You should see an animated title and a menu of commands. Try them out.

To try the two interactive modes:

  • scrabbly train: choose 2-letter words, pick a letter yourself, and enter I. Type if id in it is, press Enter, then press Enter again on an empty line. It should tell you that you forgot IO. Add io and try again to see the perfect-score screen. Then try random mode and make a mistake on purpose.
  • scrabbly master-word: guess something short and weak first and see it say your word is valid but not the master word. Then try a fake word like asdf, which shouldn’t cost you a guess.

Press Ctrl+C at any prompt to leave politely. To run it from source instead, see the “How to run it locally” section in the README.

  • 1 devlog
  • 3h
Try project → See source code →
Open comments for this post

3h 22m 14s logged

Scrabbly Devlog

What I built

Scrabbly is a command-line app for practicing Scrabble. It scores words, checks them against Collins Scrabble Words 2019 (about 279,000 words), and drills 2- and 3-letter words by starting letter. It can find every word hiding in a rack of tiles, blanks included, and it has a game where you draw 7 tiles from a real 100-tile bag and get three guesses at the highest-scoring word. I started it because I wanted to learn the two-letter words without flashcards.

What I learned during this project

  • I can just use a Set to validate words. I thought I had to make an algorithm which I now realized was dumb.
  • Keep functions that compute separate from functions that print. findWords was written for find, and the Master Word game reused it unchanged to work out each round’s answer.
  • Anything that waits for the user (menus, typed answers) has to be async.

Something that surprised me

I wrote the full dictionary to load lazily because I assumed 279,000 words would be slow. I finally timed it: a fraction of a second. The part that felt slow was my own title animation, which sits on screen for 2.5 seconds on purpose. I kept the lazy loading, but I’ll measure first next time.

Coming soon

  • scrabbly info: rules, history, tips and tricks, letter points, word lists
  • scrabbly define [word]: look up what a word means
  • scrabbly favorite [word]: save words you want to remember
0
0
11

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…