Mark it 8, Dude
Yesterday I finally spent a good chunk of time with the bowling scorer kata and I can now confidently say that I understand how to score a bowling game. Sadly I never rolled well enough to bother to figure it out before now.
The kata itself definitely doesn’t have as simple of a solution as the change or prime factors kata, but that was one of the reasons I choose it. Learning to find an elegant solution to keep tracking of frames and rolls has been a really good exercise for me. The other, probably much bigger lesson, has been learning to follow a well worn path instead of always experimenting and wandering off into the weeds. Uncle Bob has a clear demonstration of walking through the first five tests of the kata, but rather than follow it I really wanted to try and find my own solution. However, after a few too many wasted minutes it was clear that I needed to heed his advice on what a kata is and just follow along.
I think I’ve definitely been making the same mistake with the minimax algorithm too. There are plenty of code samples out there on ways to implement it (interestingly, no two are the same), but instead of following one of those to use in my own game I just glance at the code for an idea or two and then try and integrate it into my own solution. However, at this point I think it’s safe to say I’ve spent enough time in the weeds and need to just find my way back to a proven path (although I do have just a couple more ideas to try. I swear there’s going to be an ocean over this next rise…)
This lesson of learning to follow a well-worn path as a beginner reminds me of so many things: formal education, learning a musical instrument, the apprenticeships my family in the trades have often talked about. Cymen, one of my fellow apprentices, recently wrote a great post about apprenticeships on a farm.
Sometimes it’s better to master the basics, and get a feel for the box you’re thinking in, before trying to think outside of it.