Making a Wordle

I made a spin off of Wordle as a programming exercise on my parental leave. This is a document of the things I learned. The repository is here.

Learnings follow.

Pseudorandom Generation

The daily word is selected from a list pseudorandomly using a seed generated from the current day’s date.

Lazy Local Storage

There are a few things stored in local storage, and a handy way to not have to keep checking that the items exist without too much code branching is to lazy load it.

The lazy loader can also be used to automatically create the new game state item for the word if the player isn’t currently on the same day as the existing storage item.

Heavy top level App Controller

The Vuejs top level App component became a bit large, and I would say it’s almost a god class. Next time, I’d try and pull functionality out of it.

Typescript

I decided to use Typescript as I like types. I couldn’t imagine making something even as small as this without it.

Mobile Safari and vh

You can’t use 100vh as the height of an element in mobile Safari because they broke it on purpose!