Author: Tony Werten
Date: 01:44:57 06/20/00
Go up one level in this thread
On June 20, 2000 at 03:50:36, James Robertson wrote:
>On June 20, 2000 at 03:09:49, Tony Werten wrote:
>
>>On June 19, 2000 at 19:54:39, James Robertson wrote:
>>
>>>On June 19, 2000 at 19:48:36, Larry Griffiths wrote:
>>>
>>>>I have found bitboards to be an even trade-off on my Pentium system. I have to
>>>>update about 6 bitboards when a piece moves and this generates a lot of
>>>>instructions. I get it back in my IsKingInCheck code so it evens out.
>>>
>>>While detecting check is faster with bitboards if you have many pieces on the
>>>board, I think it is actually slower in endgame positions. :(
>>
>>I don't understand this. I have written it before but here it is again. You only
>>have to look at the to and from square of the last move.
>
>I do not understand.... could you please elaborate?
Sure,
If you exclude a rochade, a check can only occur in 2 ways.
1) The piece last moved is giving check ( on the to-square )
2) The piece just moved revealed a slider which is giving check. ( behind the
from square )
The code should look something likes this. ( there might be some mistakes)
if (last_move==rochade)
{
square=king_square;
if (possible to attack square from rook_square)
{
repeat
square+=dir_of_rook;
until (square!=empty)
}
return (square==rook_square)
}
if (possible for moved_piece to attack king_square from to_square)
{
if moved_piece==KING,KNIGHT or PAWN then return (true)
square=king_square;
repeat
square+=dir_of_to_square;
until (square!=empty)
if (square==to_square return) (true)
}
if (possible for BISHOP or ROOK to attack king_square from from_square)
{
square=king_square;
repeat
square+=dir_of_from_square;
if (square!=empty) then return (piece_on_square can attack king_square)
until (square is not on board)
}
return false;
cheers,
Tony
PS If you are looking for a selfcheck, you only have to do the from_square. ( If
you didn't start of in check )
>
>Thanks,
>James
>
>>
>>It has nothing to do with the number of pieces.
>>
>>Tony
>>
>>>
>>>James
>>>
>>>> I like
>>>>to have fast move generation code, but most of my gains have been through
>>>>alpha-beta, hash-table, killer-move and movelist ordering etc.
>>>>
>>>>Larry.
This page took 0.01 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.