I'm looking for a simple recursive PHP solution for the Min-Max
algorithm for a game of Connect 4.
Given are:
2d array: &$board[][]
dimensions: x = 1-7 (horizontal squares, 1 is left, 7 is right)
y = 1-6 (vertical squares, 1 is top, 6 is bottom)
values: 0 = empty
1 = yellow (starts)
2 = red
$current_counter: the piece which moves now
The result should be the best slot from 1-7, up to a certain depth of
the search tree.
No display, HTML, input etc. are needed -- the only value I need is as
described above (from 1 to 7).
Thanks! |