Aleks Peshkov wrote:
- Code: Select all
//Set Starting Variables
iMoveStrength = NEG_INFINITY * 100;
If MinMax sees a forced mate it will return NEG_INFINITY. I wanted to make sure it chooses the forced mate over not moving. I do not want the engine to resign.
Sven Schüle wrote:2. then write a function that checks whether the enemy king is in check (and call it e.g. in the very beginning of each node, so that AlphaBeta returns +INFINITY for illegal positions) [EDIT: you probably have it already but use it within FindAllLegalMoves()],
At the moment I have a function that checks to see if the king is on the board. So I catch illegal positions in the alpha beta search a move after they happen.
I have a function already that checks to see if a square (in this case the king's square) is under attack, and that is the way that I check for legal moves at the moment.
Sven Schüle wrote:3. then write a perft function and fix your perft numbers,
Yeah I am making some guesses right now on where it is not working and setting up positions to test it out. It could not be pawn promotion, in 4 ply pawn promotion is impossible. As is castling. That leaves En Passant. Thats what it has to be, otherwise 3 ply would of been wrong too.
Sven Schüle wrote:BrettVsop wrote:
- Code: Select all
int CMinMax::GetFutureImbalance(CReferee *chessboard, bool check_white, int iTime)
{
int iValue = Min(chessboard,check_white,iTime);
return iValue;
}
What is the meaning of "GetFutureImbalance", and what does your "Min()" function do?
Sven
There are two functions that are missing: Min and Max. Min will return the value of the lowest Evaluation result for the each possible move for the position. Max will return the highest. If time is greater then zero, then min will call max with time minus one.
GetFutureImbalance, is just a entry point into minmax. I wanted a generic function name so I could swap MinMax with AlphaBeta, or any other search algorithm by changing one line in one function. So to swap to AlphaBeta I change the line in GetFutureImbalance to say AlphaBeta instead of Min.