Graph Theory37 sections · 1633 units
Open in Course

Debugging Game Code

(Verification strategies)

Test on small examples first. For a 33-vertex graph, you can trace the entire game tree by hand and verify your code's output. Print the state graph for small inputs. Verify terminal states are marked correctly. Use assertions to check invariants: every state should eventually be marked as winning, losing, or drawing.

If not, your algorithm has a bug. Start by printing the game state at each recursive call. Check that terminal positions return correct values. Verify your transition logic matches the game rules exactly.