Author: Magoo
Date: 09:21:38 06/14/03
Go up one level in this thread
On June 14, 2003 at 11:46:34, Anthony Cozzie wrote: >On June 14, 2003 at 10:30:58, Magoo wrote: > >>I did some tests last night, replacing my in_check() function with attack >>tables, my thought was that it would be faster, but the result was not that >>good, ok i did a fast hack, scanning the whole board because i dont have piece >>lists, but my previous x-ray in_check function was huge. But now im wondering if >>attack tables (implemented with piece lists) are that much better than x-ray. >> >>You have to check all pieces, = 8 pieces (king checks). >>You have to check if pawns are promoted... = x pieces. >>Check two squares in front of the king. >> >>And of course, sometimes you have to do some tracing.. (sliding pieces). >>In the opening, middlegame there are usually pieces near the king, so the x-ray >>based in_check only has to trace a few directions. >>This got me thinking that the difference between the two isn't so big, am i >>correct? maybe attacks are a few % faster? > >Could you explain what you are doing? I was under the impression (and it seems >to work in Zappa) that in_check() is simply: > >Get_All_Bishop_Moves(KingSquare), see if there are enemy Bishops/Queens at the >tips. >.... >etc. > >I tried writing an is_check(Position, Move) once, but it turned out to be too >annoying. Hum, get_all_bishop_moves, i don't understand what you mean "at the tips", if you generate the moves you would have a BxK move. The way i do it is to trace from the king square to all directions and see what the ray hits. With attack tables i store the values so that i can compare attacker square - king square, i use 0x88 by the way, with this i know if a piece at square x can attack square y. If it can i have to trace a ray, the good about this is that often you don't have to trace, you dont have to trace at all for Knight, Kings, Pawns, the question is how much better attack tables are than brute-force tracing.
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.