The Raku Programming Language Collect, Conserve and Remaster Project
Originally published on 23 July 2012 by Carl Mäsak.
I felt a curious lack of energy today, on the day when it was time to do the important merge of the Hanoi subgame (developed on the first two days of this month), and the bigger adventure game (developed since then).
Nevertheless, I made it, though admittedly I haven’t tested it much, and pieces are missing. Hey, the tests pass! The rest will have to come piece by piece later.
(Mostly what’s missing is actually hooking up all the nice Hanoi:: event
types to the CLI so that it can tell the player what’s going on. Oh, and
parsing commands correctly on the CLI. That’s missing, too.)
Here’s what happened today:
Fixed that. It was a rather large fix because I realized I had a bug in the “is there a light source here” logic — ultimately caused by assuming the wrong location of the player because of not-yet-applied events. (Tricky, that one!)
So I did that too before I started with today’s real hacking.
This required
lifting the Hanoi game drawing logic out of the Hanoi::Game class into its
own subroutine. No big deal.
This was the most hair-tearing commit I have made this month. I ended up choosing
the least painful of a number of painful options. Crypt::Game has to intercept
events that move the player from Adventure::Engine, in order to correctly forbid
the player from playing the Hanoi game outside of the hall.
I’ll have more to say about this factoring in the next few days. I’m glad it worked out, and as far as I can see it will work very well for what we want.
Note that we got our first crypt-specific exception with this:
X::Crypt::NoDisksHere, which happens when you try to play Hanoi outside of
the hall. It clearly belongs in the crypt domain, and not the adventure domain
(which doesn’t know about Hanoi) or the Hanoi domain (which doesn’t know about
player locations).
See you tomorrow, when we will play with fire a bit.