Åsberg

Wordle in Swedish

Wordle is a game where you have six tries to guess the days word. After each guess the game tells you if the letters of your guess are included in the word, and if they’re in the correct position or not. It’s extremely fun and limiting it to one word a day has made it last. But I’ve got one problem with it, it’s in English and I’m Swedish.

I do fine in the English version, but I thought it’d be fun to have a Swedish version too. So, I built one! I setup a blank React/TypeScript/Webpack project as I’ve done many times before and just got started. I used my own CSS framework Snygg again, but along the way I learned a few new CSS tricks (or hacks). Did you know CSS animations can enforce their starting/ending state on elements with the animation-fill-mode property? I didn’t, but now I do. And that useful.

But the most fun I had was investigating word lists. I found Hunspell (a spellchecking tool), and used the dictionary originally meant for LibreOffice to produce all words in the Swedish language (though I’m guessing, and almost hoping, that it didn’t actually include all the words). Then I stripped out all words that contained other characters than letters and capital letters too, we don’t want any proper nouns. Lastly, I removed all words that weren’t exactly five letters long. In the end I ended up with about nine and a half thousand words. I saw that the original had two lists, one to draw words for the day from, and one for checking if an entered word is correct. I think that is a better way to do it because right now my game can have some pretty obscure words as the word of the day, but I don’t know where to get the “common” words from.

All in all, this was a fun little project that took me about one day to complete (although I did say up until around 23:00 yesterday, so…). I’ve put the source up on GitHub, but don’t read too much into it. I’m not super proud of the Store class, but it gets the work done and I was able to complete it in one day.

Hope you have fun playing it (Ordne), or if you prefer the English (and original) version I think you will have fun with that!