I want to make a loop about the Go algorithm.
First calculate the Qi of a chess piece (that is, determine the up, down, left, and right pieces). If there are chess pieces of the same color next to each other, then calculate the Qi of the new chess piece, and then determine whether there are chess pieces of the same color next to each other until the judgment is made. Complete all adjacent chess pieces. If the Qi is zero, these are dead sons.
How to deal with an indefinite number of loops like this? Seems simple, but difficult to handle.
Anyone with experience can give me a hint. Thank you!
You can try an infinite loop with an infinite loop while(true){}
Done. It should be calculated using a recursive function.