If you use Connect6 on the final board, then a possible view for this game would be a list of lists of variables that were originally unrelated. You "place the stone" by combining the variable with one of the black or white atoms. Then you can check if the position of P remains empty with var(P) . This view should be much faster to manage than the stone/3 terminology list. This works because in Connect6 you can never remove a stone.
I assume that by heuristic you mean a rating function suitable for minimax, negamax, or alpha beta search. Given the rules of the game, I would suggest that for each player you count the number of lines five in length and rate them 5, evaluate them four four in length, etc. This gives you two indicators S 1 and S 2 . Subtracting S 2 from S 1 gives a relative advantage for player 1. Then find a way to normalize them in the range [-1,1] or compare the situation when the game is at infinity minus infinity. (How to imagine everything that remains in the Prolog as an exercise.)
source share