Today I continued working on introducing a dumb computer player into my Tic Tac Toe game.
I had a ringing in my ear saying “do the smallest thing to get it to work”, a nice message from my mentors (I must be learning something). So I figured the smallest thing to introduce a computer player was to create a new constructor that would accept a computer player and a human player.
At first this bothered me, because I wanted to introduce more abstraction straightaway. A class called GameSetup, that would setup a game and that object would then be passed in the game or…a factory object that would create different types of games, Human v Human, Computer v Computer etc….the temptation was great but I resisted.
In the end I accepted that firstly I must write the simplest and smallest (but not necessarily clean) code that will fulfil the spec, then I can go refactor to my hearts content once all tests are green, this is a lesson in discipline.
After all….. that is why I’m here (among other things of course).