I am making a game based of the asian board game called "go". I am currently trying to implement the capturing system. Basically once all of the liberties a stone has have been surrounded by the enemy the stone is taken. In the screenshot the black stone should be removed. https://i.stack.imgur.com/bO563.jpg
As well, if you connect stone together the liberties are combined, for example this is how you would capture two stones. https://i.stack.imgur.com/DU3mb.jpg also here is another example of black being captured. /lbg8BsC
I have a 2D array thats 19x19 that stores all my stone locations. Black is represented by 1 while white is 2. This is my array print out from the first image.
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000002000000000
0000000021200000000
0000000002000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
As you can see the black stone in the middle is surrounded by white stones. In this case it easy to check if that stone is surrounded, but I don't know how to do it once you have multiple stones like in the two other screen shots above. Any help is greatly appreciated.