This question has more to do with the validity of the alogirthm than help per se. I'm unsure if this works with all board setups or just this one, or if it's valid at all.
I'm going to start with a 9x9 board setup like this (current piece is showing mouse location, only middle is taken):
https://i.stack.imgur.com/dh14Y.png
From here it may look like reds next move can be any piece but if we reduce the board to what it looks like here something becomes apparent: https://i.stack.imgur.com/cHZ9K.png
We only need to take hexes marked with a red dot (and by extension the black marked hexes). This is because if we take one of these red dot hexes, it is connected to the middle square by two hexes. We don't need to take these hexes as they are already ours. If the other player tries to block us off by taking one of these squares, we take the other one and nothing has changed.
From this point the moves of the other player don't matter. We have 6 hexes we can take and the other player can't block all of them as they only get one move. Whereever the other player tries to block, we can pick a different red marked hex, and once we have that hex they can't stop us from connecting it. From here we take a black or red marked hex that furthers our goal. Each hex that we take adds at least 2 hexes (following the same rule) that moves us closer to connecting our two sides. Each time the other player tries to take a hex between two of our hexes, we take the other one and it's like their move never happened. Now they have to block more squares than they have moves. The other player never gains the initiative and the game is finished when we have connected a chain of hexes connected by two hexes. As we've already established, from here they can't block our chain as there are two possbilities for us to take each turn and they can only take one.
Sorry if something similar is already known in the Mathematics community, but nothing I could find gave an algorithm like this that scales to any board. I can only post 2 links, but this works for a 10x10 board as well.