Saturday, November 6, 2010

Generating Moves

Since the code should be as readable as possible I'll start with some move generating pseudo-code. I want to be able to generate few moves at a time so I'll start with the capturing moves.

- checking moves
- capturing moves (preferably ordered Least Valuable Attacker/Most Valuable Victim)
- promotions moves
- castling moves
- other moves
- check evasion moves

Just a reminder to myself: the board should be able to continue where it left off doing moves after an UnmakeMove is done.

First decision is where to start generating: with the attackers or the victims.

Attacker approach:

Player.Knights.ForEach(x => x.YieldAttackingMoves);
Player.Bishops.ForEach(x => x.YieldAttackingMoves);
Player.Rooks.ForEach(x => x.YieldAttackingMoves);
Player.Queens.ForEach(x => x.YieldAttackingMoves);

etc.

Victim approach:
Ponderer.AttackedPieces.ForEach(x => x.Attackers.ForEach(y => y.YieldAttackOn(x)));


Since I want to have the possibility to have the LVA/MVV ordering I'll go for the victim approach. AttackedPieces should be ordered MV first and Attackers LV first.

Note for later: The LVA/MVV may fail, so I might need to add a on the fly Static Exchange Evalutation later.

I start doing this pseudo code creation to get insight into what my Board class will have keep track of.

No comments:

Post a Comment