I can declare a wier if player gets five of their tokens in a row, and now I am trying to implement the feature of capturing opponent's pieces. For example, I am player X I can trap Os pieces like this X00X in any direction on the board. In order to implement this, is the following logic correct: Find all neighbors around O, check and see if the neighbor is an X or an O, if there are two 0s in a row surrounded by an X on each side, I can take those pieces. Is there a better way to approach this problem?
