Yesterday morning I learned about the Factory Pattern and implemented it for my player setup. After that I started another run at the minimax algorithm. Last Friday I deleted all of my original code so it was the first time I’d even tried it in a week. I worried that the break would be a setback— and for what felt like a good hour I had a series of false starts trying to get going. Fortunately, the time I spent working on the N-Queens solution really helped me to develop a process for stepping through a complex problem, and within a few hours I’d gotten to a point that had taken me days just a few weeks ago.

Part of that process is using my tests to check that my code is actually doing what I think it’s doing (= != ==). A second part is using a properly placed puts statement to confirm that each line is doing what I think it’s doing. The other big part of the process is plain old pencil and paper. Sometimes I diagram out responsibilities, sometimes I sketch a process and recently I’ve actually just started handwriting code snippets. Just as our brains process things differently when we speak them they definitely work differently when hand writing things out too. Plus, drawing out the blow-by-blow a lá John Madden is something I can’t do on my laptop yet. …and here’s where Ebert decided to pull the guard to send him around the end in preparation for the lateral to the next method… Hopefully my code will end up clean enough that no diagram is necessary, but in the meantime I need to do some strategizing.