Thursday, February 7, 2008

The Second AI Level... waaaaay better !

All right, I'm kind of excited because what I thought would be very difficult ended up being kind of piece of cake. The first level of AI was so stupid because it merely looked for the first valid move and that's it. The second level, which is almost finished except for a little bug fixing, is far better in concept.

First, it creates an array of all the possible "combination of moves". With just this part of the definition it has two great advantages over the first level: considering all the possible moves and combining the moves allowed by each of the dice. This includes the possibility of moving the same man several times.

But what would be the objective of having a list of possible moves if you're not going to "choose" the best of them. So the second part of the implementation is a "position evaluator". This is what makes me feel like I'm on the right track. Why? because all the implementations of chess engines have an algorithm that evaluates which one is the best among a list of valid moves.

What does the position evaluator take into account? Well, so far, as positive for the rank, it considers the number of home board points that are blocked, the distance from the isolated men to the opponent's men, the advanced your men are, etc. on the negative side, the number of isolated men, the points with more than 5 men, etc.

So it's unbeatable? ... I wouldn't say so. In fact, I would say it still plays fairly bad if you compare it to an experienced human player, but it will definitely have better odds than the first level. Specially if it has just a little luck. Besides, I had to leave room for the third and final AI level.

No comments: