"Tic-Tac-Toe! 4-in-a-row!"

That's how it goes, right?

August 26, 2021

Well, it's been a whirl-wind week for me and my little tic-tac-toe app. This week saw many improvements. Here's the full feature list as it now stands:

  1. Grid sizes:
    • 3x3*
    • 4x4
  2. Player configurations:
    • Human (X) vs. Human (O)
    • Computer (X) vs. Human (O)*
    • Human (X) vs. Computer (O)
    • Computer (X) vs. Computer (O)
  3. Computer AI now has 3 difficulty levels:
    • Easy (random)
    • Medium (mix of random and minimax)
    • Hard (minimax)*
  4. Terminal UI indicates which cells are available and allows user to select all of the above.
  5. On top of all that, there's now a GUI implemented with the Quil animation library!

* already supported, except that it was more difficult to support an unbeatable AI with 4x4 boards...

Here's a little demo of the GUI in action:

Supporting 4x4 grids required a major overhaul of the core code and I'm really happy with the result.

I'm only moderately pleased with the GUI code. I guess it wasn't bad for my first real forray into GUI programming with quil, but hardly any of it is covered by automated tests. The state data structure has so much stuff on it, even for this tiny app. The real decision-making happens in the various update functions, which I could cover with tests--there's just a lot of initial state to setup to make that happen. Stay tuned...

-Michael Whatcott