Lab: Mini Text Game
Start from the adventure game example in Text-Based Games.
At the moment, our game state is just the room we're in. For lab credit, add an explicit WorldState
or GameState
struct that tracks not only where we are, but possibly what items we've obtained or what our character's stats are; modify room, door, or other game structures to update and read from this state. You'll want to replace the at
variable with this more robust state.
One really important thing to remember about the example above is that it was totally made-up and arbitrary; I just decided that there is a vec of rooms, and that each door has a list of trigger words and a single target. You get to decide how the world is made. I did it this way so that the code was as simple as possible, without needing a real command parser.
It's possible you built your unit 1 game off of the text adventure example, in which case talk to Prof Osborn about it.
Either way, show Prof Osborn or a TA how your game works!