That seems way too hairy. It can be seen as just a game tree with a set of possible moves. You cache positions so you can detect loops*, and then you just search the resultant tree.
Folks who wrote chess/othello sorts of games could program this up real quick.
* A move that returns to a prior position forms a loop, and thus can't be making progress towards an end state.