The Raku Programming Language Collect, Conserve and Remaster Project
Originally published on 30 July 2012 by Carl Mäsak.
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.
take tiny disk on the
CLI, something that would be necessary to win the game.I fixed that.
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.
Having to do with when things are visible or listed.
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.