We've already set up some context for puzzles. There's a mud puddle in the backyard, and if Riley goes into the puddle, he gets his paws muddy and cannot get into the house. So we should use this. We have a couple of choices -- either we can force the player to deal with the situation by starting Riley out in the mud, or we can give the player a reason Riley has to go into the puddle, which seems more organic and interesting.
So what reason does Riley have to go into the puddle? Well, his primary objective is to get onto the dining room table, steal a turkey leg, and get back outside to eat it. As the game is currently set up, he has enough turns to pull it off. And Mom actually doesn't notice that he has the turkey leg as he's leaving the house. We should fix that, which suggests a puzzle -- perhaps he needs a way to conceal the turkey leg, by, say, tucking it into his collar.
So let's put his collar in the mud puddle to start with. And give him a way to wipe his paws. And make sure Mom will catch him if he doesn't tuck it safely away. First, we need to create the collar and put it in the mud puddle:
Your collar is a wearable container. Your collar is in the mud puddle. "Lying forlornly in the mud is your collar, lost during a particularly vigorous round of tail-chasing." Understand "collar" as your collar.
And we need to allow Riley to remove the mud with appropriate action. This gets a little tricky because RUB and CLEAN are the same thing in Inform's standard libraries -- and here, we want to differentiate between wiping Riley's paws on the grass and cleaning them with his tongue. So we have to define the paws (as part of the player, so they can't be dropped or otherwise separated from Riley's body) and override the standard rub, wipe and clean verbs.
The paws are a thing. The paws are part of the player.
Instead of examining the paws, say "Your paws are [if player is clean]sparkling clean. Well, not sparkling. But clean. [otherwise]gloriously filthy with mud."
Understand the commands "rub" and "wipe" and "clean" as something new.
Scraping is an action applying to one visible thing. Understand "rub [something]" and "wipe [something]" and "scrape [something]" as scraping.
Washing is an action applying to one visible thing. Understand "wash [something]" and "clean [something]" as washing.
Carry out washing: say "You lick at the [noun] ineffectively."
Carry out scraping: say "You can't scrape anything off of that."
Instead of washing the paws:
say "You lick at your paws.[if player is muddied] But the mud is too thick to clean up this way."
Instead of scraping the paws:
if the player is in the Back Yard:
say "You wipe your paws on the grass.[if player is muddied]The mud comes off surprisingly neatly!";
now the player is clean;
if the player is inside the Mud Puddle:
say "You wipe your paws in the mud. Yep, still muddy!";
if the player is not in the Back Yard and the player is not inside the Mud Puddle:
say "You wipe your paws on the floor."
Now we need to set things up so that Riley can get caught on his way out after a successful heist, hinting that Riley needs a way to conceal the turkey leg:
if the player has the turkey leg and Mom can see the player and the turkey leg is not inside your collar:
say "Mom spots the turkey leg held brazenly between your teeth, and before you can even look guilty you are tossed unceremoniously outside. You paw at the locked puppy door, never to return, at least while the family dinner is in progress.";
end the story.
Note that the combination of rules driving the story will also work together in more complicated situations. For example, if Mom catches Riley on the table, but he has already concealed the turkey leg, she will throw him outside -- without taking the leg away from him. If we didn't want that to be possible, we would need to add a check for that -- but I like the idea of snatching victory in the face of defeat!
Now we need Riley to be able to stash the turkey leg inside his collar, and give the player some information to suggest that such an action is possible. One thing we will do is replace the standard "Your collar is empty" response:
Instead of examining your collar, say "Your collar was given to you a very long time ago. It has a jingly thing on it. When you have it on, you always get stuff caught in it. [if the turkey leg is contained in your collar] Right now you have a turkey leg tucked into it, held safely beneath your chin."
The standard Inform libraries ensure that the player can PUT TURKEY LEG IN COLLAR, but we should describe it more colorfully, and should handle some other likely attempts appropriate to the context:
Understand "tuck [something] in/into/under [something]" and "slip [something] in/into/under [something]" as inserting it into.
Before inserting the turkey leg into the collar, say "The tantalizing odor right under your chin makes the whole world seem bright and turkeyful. You just... manage to... there!"
With these additions, we now have a brief but complete piece of interactive fiction. Most of the puzzles are verbiage-based, but as Riley the puppy has few manipulative capabilities or familiarity with human-type objects, that's probably where the emphasis ought to be.
If you've been following along with this series, you know we've left a number of bugs and issues outstanding, and my testing has found a handful of new ones. Our final installment will tackle cleaning up some of these items -- a game isn't really finished until all known bugs are exterminated.