Quick aside: A comment on 'Magic Numbers'.

First off, avoid 'Magic numbers' at all times in your program! It is extremely rare for a single use of a fudge factor in any program. Honestly, these adjustment numbers will, not might, WILL pop-up elsewhere as the program grows.
The only instances where such a number is used, that I can think of, would be in a mathematical equation (which really should be in its own routine anyways) or as a throw-away value only needed for debugging, e.g. the actual value does not matter just as long it is the same for each debugging session.

If a number is needed, consider making it a user defined value instead of a named constant. Many times the user will have a better idea as to the preffered value than the developer. (And many times the user will be a gormless git that will make a complete hash of things. But that is another rant.)
Case in point is the colour of the playing pieces. Now Black and White are considered traditional. But earlier, before mono-chrome displays, red was often used as the second colour in a number of games, i.e. Black and Red for backgammon and less commonly White and Red for chess. And what about adding an additional player? That third colour should be used?

No comments: