Hey what’s up guys, Code Monkey King’s here. In this video we gonna be generating castling moves for both kings bearing in mind that castling is available if appropriate castle bit is set up (king didn’t move or rooks didn’t move), when there are now pieces in between king & rooks and neither king nor nearby squares it’s stepping through to castle are not under attack of the opposite side.
SOURCE CODE:
16:34 Not sure why we don't discard casting to g1 by checking if that square is attacked. Does it make a difference if we check for it here rather than when making the move? It feels weird to have it displayed as a possible move when it is not legal.
Since it is a little bit surprising that you do not check attacks on the castling king's target square you could explain that in a comment line and not only in the video.
You can use lichess.org/editor to edit your boards easily, it returns the FEN notation