demo/chess/src/garbochess.js
function SeeAddKnightAttacks(target, us, attacks) {
    var pieceIdx = (us | pieceKnight) << 4;
    var attackerSq = g_pieceList[pieceIdx++];

    while (attackerSq != 0) {
        if (IsSquareOnPieceLine(target, attackerSq)) {
            attacks[attacks.length] = attackerSq;
        }
        attackerSq = g_pieceList[pieceIdx++];
    }
}
function SeeAddKnightAttacks(target, us, attacks) {
    var pieceIdx = (us | pieceKnight) << 4;
    var attackerSq = g_pieceList[pieceIdx++];

    while (attackerSq != 0) {
        if (IsSquareOnPieceLine(target, attackerSq)) {
            attacks[attacks.length] = attackerSq;
        }
        attackerSq = g_pieceList[pieceIdx++];
    }
}
function SeeAddKnightAttacks ( target , us , attacks ) { var pieceIdx = ( us | pieceKnight ) << 4 ; var attackerSq = g_pieceList [ pieceIdx ++ ] ; while ( attackerSq != 0 ) { if ( IsSquareOnPieceLine ( target , attackerSq ) ) { attacks [ attacks . length ] = attackerSq ; } attackerSq = g_pieceList [ pieceIdx ++ ] ; } }
target = attacking square, us = color of knights to look for, attacks = array to add squares to
target = attacking square us = color of knights to look for attacks = array to add squares to