Home >Web Front-end >HTML Tutorial >How to deal with this cycle? _html/css_WEB-ITnose

How to deal with this cycle? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:06:241055browse

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!


Reply to discussion (solution)

You can try an infinite loop with an infinite loop while(true){}

Done. It should be calculated using a recursive function.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn