I am not sure if min-max produces a good result for tron. Since there are usually many commutative movements on the grid, inflating the search space. Maybe for a small field and / or a small search depth. But you can try to use negation as a rejection for min-max, and you get alpha-beta cropping for free (I think so).
In games without uncertainty, the min-max algorithm calculates the minimum gain of the opponent, who, on the other hand, tries to maximize his gain. Let me run along the players and j move over the opponent. This leads to a recursive formula as follows:
Worst-Opponents-Gain = min_i (max_j ( Worst-Opponents-Gain_i_j) )
Since we are dealing with a zero-sum game, the victory of our opponents is our victory. So we have Opponents-Gain = - Win. We can reformulate the min-max search to the maximum search. Each player is a maximizer.
Best-Win = max_i ( - Best-Win_i).
When your winnings are in the range {-1, 0, 1}, you can use negation as a failure. Just follow these predicates to simulate your game:
% move(+Board,+Player,-Board) % init(+Board) % win(+Board,+Player) % oposite(+Player,-Player) % tie(+Board,+Player)
The above predicates will fully simulate the game in the Arguments, so the state of the game will be stored in a local variable. The game is then “parsed” using the following predicate:
% best(+Board,+Player,-Board) best(X,P,Y) :- move(X,P,Y), (win(Y,P) -> true; oposite(P,Q), \+ tie(Y,Q), \+ best(Y,Q,_)).
You might want to add additional parameters to limit the depth of your search or return a symbolic reflection of movement.
Bye
PS: You will find an example of tic-tac-toe here .