by Carl Mäsak
July 29 2012 — verb synonyms
I'm now the janitor in my own code, having switched from "let's implement feature X" to "let's make it all fit nicely together". Needless to say, there is some technical debt in there to repay.
- Playing the game, I noticed that I can't actually
take tiny disk
on the CLI, something that would be necessary to win the game. I fixed that. - I moved the abbreviated-directions logic into the adventure engine itself, because I figure it belongs there. Better for the engine to recognize even abbreviated directions than for the CLI to munge it.
- Taking lue++'s suggestion on channel, I wrote a short grammar for parsing commands for the adventure game.
- Going through the code in this way, I realized that there's a
.hide
method in the adventure engine. I used it to hide the fire when extinguished, instead of moving it to a made-up location "nowhere". Cleaner. - Playing the game some more, fixed some subtle things having to do with when things are visible or listed.
- The game used to say "There is a car here.", but now it says "Your car is
parked here." Such thing-specific overridings are now
handled
through a separate namespace in the
descriptions
file. Much cleaner than last year's solution. Actually, the event-based approach is forcing many of these "much cleaner" solutions, because it's harder to mix levels.
Another example of the latter is the "remark" system — lots of
game-specific remarks that the game made during various stages. All of these
were spread over last year's codebase as literal strings. Now they are all in
the descriptions
file, too. It wasn't so much that I decided to do it that
way; I basically had to do it that way. Which is nice.
There's more to say, and more refactors to do. But I'll save some for tomorrow and the day after.