I’ve published my first word game wordfight inspired by venerable Letterpress. It’s a game where players make up words from the letters on the board. Whoever takes the most letters wins once all the letters are taken.
The idea has been in my “todo” for few reasons:
- algorithmic problem at heart
- build a UI with reactjs
- build a bot opponent and AI
- real-time multi-player app with golang
- experimentation platform
This is a typical CS problem where data structures and algorithms matter. Running it on a small VPS sets certain requirements on memory consumption and performance characteristics.
UI with React
I’ve been mostly doing backend. The times when I had to build a UI jquery would be my tool of choice. This project could be built with jquery as well no problem but I wanted to try reactjs.
Surprisingly using reactjs with create-react-app was pretty seamless experience. I didn’t have to get into a rabbit hole of setting up webpack and configuring millions tools required to trans-pile, minify html, js, css.
I still have to figure out what’s the testing process, but I’ve achieved my main goal: to prototype an app with reactjs without getting lost in nodejs’ configuration land.
Bot and AI
When there’s no-one to play with bots come to the rescue. Right now the bot is quite naive and picks words and letters randomly. While it works as a prototype there’s definitely a strategy to winning a game by picking certain letters at certain locations. So there are different levels of AIs that could be built, which I’ll be experimenting with.
Real-time and multi-player
It uses “roulette” style player matching: from all the connected participants a random pair of players are matched together to start a game.
Backend is done with Golang and it turned surprisingly simple.
Few ideas I’m gonna entertain it with:
- improve UI in general: add better turn indicator, make less chatty
- rewrite UI with Elm, see what’s all the hype is about
- use optimized data structures: for example the indexed vocabulary has 2 representations in memory: serialized as byte slice and unmarshalled into a structure. Idealy there should be only 1
- document API for external bots
- few levels of AI for bots
PS: Open Source
Usually I’d open source all my work but for small projects like this it just not worth it:
- companies do not look into the code: whiteboard interview still determines your value.
- getting working projects rather than just source code out.
- running things requires working DevOps knowledge, and I’m building up my ansible toolbelt.
- saving time by not dealing with developers but rather with users: potential paying customers.