Made the Four in-a Row AI a little less dumb.[/highlight]
The "Four in-a Row" AL has been upgraded a little, this morning.
It's not "Evil", and can still be beaten every other game, but it's making less mistakes than it was, earlier.
Not a complete rewrite of the AI, but a fairly significant redoing of the way that the AI finds a final placement.
-=-=-
Rather than making a specific move halfway through the AI routine, the thing now runs through all 8 places, gives them a score, and then re-runs those 8 columns, giving a random point when the random generator is within a threshold, determined by the column's score.
If the place is an obvious point where the Human player can next move to win, it'll score higher.
If the place is where the AI player will win, it'll also score higher.
If the place ABOVE it is a place where the Human player might land a win, it'll score lower.
And so on..
A quick loop of the random additions ensures that each column has a slightly different value, and then it's simply a case of picking the column with the highest value, to make the move.
This means that the seemingly random placements are now slightly more calculated, with an ever so slight look-ahead being added into the mix, to (hopefully) stop it from stupidly placing counters exactly where they'll help you win!!
Views 125, Upvotes 17
Shoebox