Debugging part 13: Finishing Go Fish

MP 156: Implementing the computer's turn, and recognizing the end of the game.

Note: This post is part of an ongoing series about debugging in Python. The posts in this series will only be available to paid subscribers for the first 6 weeks. After that they will be available to everyone. Thank you to everyone who supports my ongoing work on Mostly Python.

In the last post, we used an IDE's debugger to resolve a subtle recursion issue. In this post, we'll finish the basic implementation of Go Fish. In the remaining posts in the series, we'll clean up any issues that have come up, and identify the most meaningful takeaways from all this debugging work.

Finishing Go Fish

Here's the plan for finishing Go Fish:

  • Verify we don't have any known buggy behavior in the current version of the project.
  • Remove the random seed.
  • Check for initial matches when the game starts.
  • Finish processing the player's turn.
  • Implement the computer's turn.
  • Make sure we can play through a full game, with the option to start another game.

Let's get started.

Looking for old bugs

We fixed the bug where stale invalid guesses interrupt the logical flow of the program. But we only tried one set of guesses. At the end of part 11 in this series I also saw a logical error when guessing a card that's in the computer's hand, but not in my hand, followed by a valid correct guess. In that situation the invalid guess was removed from the computer's hand when it shouldn't be.

I think that bug is resolved now, but let's check:

This post is only available to paid subscribers at the moment. It will be available to everyone 6 weeks after posting. If you'd like to continue reading now, please support my work by signing up for a paid subscription.

Paid subscription options