I have the problem to write the AI to game(like tron lightcycles). I write all the graphics and movements on C using ncurses. Now i need to write the bot's ai on the prolog. I'm using swi prolog.
I save the current game field(all matrix), current human position and current bot position(like matrix cells i, j). They saves like predicats in the .pl file from c.
My game field is a matrix which contains 1 and 0( 1 - visited, 0 - unvisited ). Like this:
human_current_position(0,1).
bot_current_position(1,2).
matrix([[1,1,0,0],
[1,1,1,0],
[0,0,0,0],
[0,0,0,0]]).
Then i need to analyze this matrix like:
analyze(matrix).
So the analyze function in prolog will return some direction(left, down, up or right) save into file and my c program read this file and move the bot.
So I have the question - How i can analyze this matrix in Prolog. I read something about min-max algorithm, but i can't realize this in Prolog. Can anyone helps or show the direction how to make work min max algorithm with my matrix and current positions in Prolog?