dragonchild has asked for the wisdom of the Perl Monks concerning the following question:
The situation: I'm writing a program that will play the game of Othello. (This is a precursor to playing the game of Go.) I want to write this as a OO program, both because I think it's the right way to do it and because I want practice in writing as true an OO-program as I can.
The issue: The size of the board is playing a part in a huge number of calculations, spread across all the objects. (For example, the AI object wants to know the bounds of the board. The Point object wants to know if its on the edge of the board or not. And, so on.)
Discussion: Now, one thing I'm gagging on (and this may just be unfamiliarity with the process) is should every object have a pointer to the Board? I mean, should the Point know who its Board is, so to speak?
Possible OO solutions: Maybe, have the Board give the AI a list of open squares? Maybe, have the Board tell the point, when it makes it, what sides of the Board it's on? Is this the way OO works??
We are the carpenters and bricklayers of the Information Age.
Vote paco for President!