Perhaps as a board method (only calculates on demand) or a square property (always calculated).
Also maybe instead of just the count, to do the balance after doing the subtraction of attacked minus guarded?
If always calculated (square property) it would be easy to implement a way to color green/yellow/red squares in the UI. But it will be very wasteful in computing all of them (so I think it would be better to be a board method).
Perhaps as a board method (only calculates on demand) or a square property (always calculated).
Also maybe instead of just the count, to do the balance after doing the subtraction of attacked minus guarded?
If always calculated (square property) it would be easy to implement a way to color green/yellow/red squares in the UI. But it will be very wasteful in computing all of them (so I think it would be better to be a board method).