ajax333221 / isepic-chess

♞ JavaScript chess utility library.
MIT License
16 stars 3 forks source link

count the times a square is defended/guarded #33

Closed ajax333221 closed 2 years ago

ajax333221 commented 2 years ago

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).