Chess - Play & Learn


FREE - In Google Play

FREE - in Win Phone Store


Programming Chess #3 - Always Sacrifice your Queen

Nov 28, 2010, 6:29 AM 0

As I discussed in part 2, Cirnovelty should look at just the moves it thinks are good. If it only looks at immediately good moves, though, it would miss Greek Gift-like sacrifices:

So how should Cirnovelty tell sacfirices like these apart from plain horrid moves like the ones on the board in part 1? Well, there's one thing that separates this move from the rest- it's the most exciting.

We can give each move an excitement value based on whether a piece is taken, whether the move is check, etc... and tell Cirnovelty to put more effort into condsidering exciting moves.

It can store a tree of positions it's considering right now, along with some information like the material worth, the excitement value, and how many moves ahead it's looking. Cirno considers the most promising position to look at (with 'promising' meaning a high value of [material worth]+[excitement value]-[moves ahead] ) and expands it by connecting nodes to it that represent all the other positions that can be reached from it.

Eventually Cirno will end up with a huge tree of positions, and then it (actually, since this is based on the Touhou character of the same name, let's just go with 'she' from now on) can just work backwards to find the best move. Great!

But we can still do better. Next time: optimization, and thinking like a human.

Online Now