This is a "good to have" suggestion.
Since the board / stones / group code is trying to be efficient, it got more complexity.
Adding more tests to detect abnormal conditions could help but is not the best because:
- we still follow the same algorithm (hence some defects cannot be detected or debugged easily at runtime)
- adding this testing code (or worse, test data) will clutter the main code
So one solution could be to create an other sub system, as separate as possible from the main one, that will simply monitor if the rules are respected.
The good news is this alternate system does not need to be very efficient since it has no speed constraints.
For example we could give a move list and a resulting board to the system and it would verify all went well.
This is a "good to have" suggestion.
Since the board / stones / group code is trying to be efficient, it got more complexity.
Adding more tests to detect abnormal conditions could help but is not the best because:
So one solution could be to create an other sub system, as separate as possible from the main one, that will simply monitor if the rules are respected.
The good news is this alternate system does not need to be very efficient since it has no speed constraints.
For example we could give a move list and a resulting board to the system and it would verify all went well.