Friday, April 21, 2006

Despair

I reached my moment of despair tonight. Alpha-Beta pruning. Wow! It looked so much easier than it was turning out to be. I was contemplating the droppage of tears when I decided I would take a more simplified, cleaner approach to my visualization of the information. That's when I learned that my research missed an important point: The evaluation must change based upon who is to move. If it's an even ply everything was working great, the odd ply's were killing me. Until I added a condition where I negate the positional eval of the odd ply.

So this:

pval = scorePosition();

becomes:

if ((MAXPLY & 1) == 1) {
pval = -scorePosition();
} else {
pval = scorePosition();
}

And Alpha-Beta is very, very happy. As was I! I was hurting. Bad. All of the pseudo-code that I found on the Internet that talked about Alpha-Beta simply said to call your "eval" function... it never talked about having to negate. So there it is.

At 9pm tonight I had my chess game. I was pretty happy that my opponent blundered early and soon resigned, because I really wanted to get back to work. I hope that doesn't sound too mean, but my project is my life for a little bit longer.

I started my list of what I want to accomplish this weekend. Wow again! I hadn't really thought about how much more there really was. Alpha-Beta seemed like such a big thing! Here we go:

Castling
Check
Checkmate
En-Passant
50-move rule
3-fold repetition of position
Stalemate
Pawn Promotion
Time
Mating Material
UCI Protocol (finish implementation)
Quiescent Search (want to evaluate quiet positions)
Opening Book
Attack Squares Bitboards
Move Ordering (to increase alpha-beta cutoffs)

Let's hope they go quickly... because I know at least a few of them will be tough! And I've got a lot more to do so I really need to get these done. If I can get these all done this weekend, then I think I'm in reasonable shape to finish up in time.

Wish me luck.

Ed.

No comments: