My question is what the function obstructed() does. Moreover, I would like to know whether opRQ refers to the rooks and queens. And whether opBQ refers to the bishops and queens.
I found the CPW to be not up do date with some implementations.
There is a more efficient way to resolve pins and checks which in essence literally takes one & instruction.
A pinned knight cannot move.
A pinned slider can only move along its pinned direction including the enemy piece that pins it.
No piece can be pinned multiple times.
Special piece:
Pawns. Pins for move and take work like sliders.
EP has some special extra pins.
The trick is that pins are two bitboards: HV, D12 - its the absolute optimum I found.
I also have some optimal code regarding check evasion. IMO I really solved BBs like no one else.
So a full legal only knight move BB looks like this:
uint64_t moves = Lookup[knightsquare] & EnemyOrEmpty & checkmask & ~(pinHV | pinD12)
Translated:
From all Knightsquares take those which are enemy or empty. Take those who stop a check if it exists. But only if the knight is not pinned.
Adding an "if" makes this 10x slower.
Please check out the URL in my signature for exactly the question you are asking!
My question is what the function obstructed() does. Moreover, I would like to know whether opRQ refers to the rooks and queens. And whether opBQ refers to the bishops and queens.
Thanks.
yes opRQ contains both opposite rooks and queens, it's useful because the queen is just a rook + bishop, so you can save computation.
obstructed returns the bits between sq (the possible pinner) and squareOfKing
My question is what the function obstructed() does. Moreover, I would like to know whether opRQ refers to the rooks and queens. And whether opBQ refers to the bishops and queens.
Thanks.
yes opRQ contains both opposite rooks and queens, it's useful because the queen is just a rook + bishop, so you can save computation.
obstructed returns the bits between sq (the possible pinner) and squareOfKing