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
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:
Playing around with the game, I noticed that the hall was still lit. 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!)
Oh, and no-one had disconnected the chamber and the hall by default, so I did that too before I started with today's real hacking.
Now, I hooked up the CLI to show the Hanoi game whenever the player is in the hall. This required lifting the Hanoi game drawing logic out of the
Hanoi::Gameclass into its own subroutine. No big deal.
Then it was time to put the Hanoi game in Crypt. 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::Gamehas 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
See you tomorrow, when we will play with fire a bit.