I made a quick modification inspired by SilverWarior's suggestion.
I hope the code is clearer than my explanation would be.
And here is an example of a bad move than the previous formula used to avoid : DDCC (computer plays black).Code:aux := Max(a); //if Max(a) >= BONUS[3] then if (aux >= BONUS[4]) or (aux >= BONUS[3]) and (RandomAB(1, 2) < 2) then result := IndexOf(a, Min(a))
Bookmarks