I last left off on Day 8 of my adventure game project. We continue from Day 9 today. Day 9 After warming up with a simple rename, I decide I don’t like how TextConsole and InputLoop interact. If I want…
Building an adventure game: part 2
Previously, I recounted day 1 of my adventure game project. Let’s continue. Day 2 This was a short day. First I observe that it isn’t really necessary for the caller of Game to pass the MessageBus, so I change that.…
Building an adventure game: part 1
I have written before about my early experiences with text adventure games and about how I built a GW-BASIC translator to convert one such example game to C#. It was a fun challenge but was admittedly more of a compiler…
Find the issue: tainted strings
In a previous post, we introduced a wrapper object for some method parameters: In terms of encapsulation and validation, this was a marked improvement. But there is one critical issue here. Let’s zoom in on the auditMessage parameter. In context,…
Find the issue: unbounded growth
Last time, we implemented a MyCommands class to keep track of commands invoked by the MyCommandsController. Here is the MyCommands as we left it: What possible issues do we have here? The first one that comes to mind is the…
Exact square roots (continued)
Last week, I introduced a data structure kata involving exact square roots. At the time of that writing, I had implemented a RootTerm struct which could represent real and imaginary square roots. Today we’ll pick up where we left off…
Data structure kata: exact square roots
Many programming courses introduce the concept of data structures with complex numbers as a motivating
The binary coverage hypothesis
Everyone loves to hate code coverage. But I have started to notice one interesting consequence of using coverage metrics that I refer to as the binary coverage hypothesis: A class should either have full unit test coverage or none at…
Async recipes: after first (matching) task, cancel rest
When it comes to the Task-based Asynchronous Pattern, there are easy patterns to run tasks sequentially (await in a loop) and all in parallel (add to list, await WhenAll). Things get slightly more complicated when the execution model doesn’t fit…
BASIC solutions: code generation!
It’s been a long slog, but the quest is over. I now have a functional-enough GW-BASIC to C# code translator. Using adventure.bas as a guide, I implemented enough features to produce a working version of it reimagined in C#. The…