I am implementing Othello game in Prolog. The game board is represented as list of lists.
I am facing a problem with flipping pieces after making a move.
My strategy is to look in all 8 directions from position where I placed my piece (say black),
and find the enclosing black piece and flip every white piece between my pieces.
So, I have 8 separate predicates to do that.
The problem is I call them sequentially after I make a move, and if any one of these predicates fails, the whole thing fails.
Is there any way to get around this? Or maybe my approach is wrong?
As suggested by Cari Norum I just make my predicates never fail. So if one fails, I just make it return the current board state. That seems to work.