Author: John Scalo
Date: 11:19:05 01/13/98
Go up one level in this thread
On January 13, 1998 at 12:57:43, Stuart Cracraft wrote: >Years ago I remember reading something where Dan and Kathe Spracklen >(remember them?) said that the addition of the square-of-the-pawn >rule-of-thumb to their program increased is strength significantly. >(I think they said a whole USCF class!) > >Anyway, now that I have passed pawns stored in my pawn transposition >table, it would be simple to use them in some calculation to get a >square-of-the-pawn assessment. > >How have you implemented square-of-the-pawn? Are there any strange >implementation issues or things to watch for? What kind of strength >improvement did your program get and how did you determine this >strength improvement. > >Thanks ahead! > >Stuart I've messed around with making a promoted pawn calculation part of the positional eval when the material drops below a certain level. So far it looks promising - I've seen the game go for a series of exchanges that left it with a pawn that can march without hazard. Without doing the calculation formulaicly it would have had to search several plys deeper to find that the pawn promotes. Here's the code. It's long but fairly efficient. if (gameState.turn == white) { if ((float)gameState.numBlackPawns == blackPoints) //black has only pawns on the board { for (i=1; i<=8; i++) //loop through all of white's pawns and check for promotion of passed pawns { file = gameState.pieceLocation.whitePawns[i].file; rank = gameState.pieceLocation.whitePawns[i].rank; if (file && !((file == wKingFile) && (wKingRank > rank)) && //make sure the king isn't blocking the pawn (squareMasks[file][rank] & gameState.whitePassedPawns)) { if (rank == 2) { if ((2 >= bKingRank) || (abs(file - bKingFile) >= 6)) points -= 7.0; } else //standard calculation { if ((rank > bKingRank) || (abs(file - bKingFile) > (8 - rank))) points -= 7.0; } } } } if ((float)gameState.numWhitePawns == whitePoints) //white has only pawns on the board { //remember it's white's move here for (i=1; i<=8; i++) //loop through all of black's pawns and check for promotion of passed pawns { file = gameState.pieceLocation.blackPawns[i].file; rank = gameState.pieceLocation.blackPawns[i].rank; if (file && !((file == bKingFile) && (bKingRank < rank)) && //make sure the king isn't blocking the pawn (squareMasks[file][rank] & gameState.blackPassedPawns)) { if (rank == 7) { if (((7 <= wKingRank - 1) && (abs(file - wKingFile) > 1)) || (abs(file - wKingFile) >= 7)) points += 7.0; } else //standard calculation { if ((rank < wKingRank - 1) || (abs(file - wKingFile) > rank)) points += 7.0; } } } } } else //black's move { if ((float)gameState.numWhitePawns == whitePoints) //white has only pawns on the board { for (i=1; i<=8; i++) //loop through all of black's pawns and check for promotion of passed pawns { file = gameState.pieceLocation.blackPawns[i].file; rank = gameState.pieceLocation.blackPawns[i].rank; if (file && !((file == bKingFile) && (bKingRank < rank)) && //make sure the king isn't blocking the pawn (squareMasks[file][rank] & gameState.blackPassedPawns)) { if (rank == 7) { if ((7 <= wKingRank) || (abs(file - wKingFile) >= 6)) points += 7.0; } else //standard calculation { if ((rank < wKingRank) || (abs(file - wKingFile) >= rank)) points += 7.0; } } } } if ((float)gameState.numBlackPawns == blackPoints) //black has only pawns on the board { //remember it's black's move here for (i=1; i<=8; i++) //loop through all of white's pawns and check for promotion of passed pawns { file = gameState.pieceLocation.whitePawns[i].file; rank = gameState.pieceLocation.whitePawns[i].rank; if (file && !((file == wKingFile) && (wKingRank > rank)) && //make sure the king isn't blocking the pawn (squareMasks[file][rank] & gameState.whitePassedPawns)) { if (rank == 2) { if (((2 >= bKingRank + 1) && (abs(file - bKingFile) > 1)) || (abs(file - bKingFile) > 6)) points -= 7.0; } else //standard calculation { if ((rank > bKingRank + 1) || (abs(file - bKingFile) > (9 - rank))) points -= 7.0; } } } } }
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.