public final void gen_attack_wknight(Board board, int square) {
		int mobility_all = 0;
		int mobility_safe = 0;
		int mobility_total = 0;
		int attackedSquare;
		
		// Loop through the 8 different deltas
		for(int i = 0; i < 8; i++)
		{
			attackedSquare = square + knight_delta[i];
			if((attackedSquare & 0x88) ==0)
			{
				// Add the attack
				WB[attackedSquare] |= MINOR_BIT;
				WB[attackedSquare]++;
				
				// If square is empty add mobility
				if(board.boardArray[attackedSquare] == EMPTY_SQUARE)
				{
					mobility_all++;
					if((BB[attackedSquare] & PAWN_BIT) == 0)
					{
						mobility_safe++;
					}
				}
			}				
		}
		
		// The total mobility is 2 times the safe mobility plus the unsafe mobility
		mobility_total = (2*mobility_safe + mobility_all);
		
		// If the piece only can move to one safe square it's mobility is so restricted
		// that it is likely to be trapped so penalize this
		if(mobility_safe == 1)
		{
			// A 'trapped' piece further up on the board is worse than closer to home
			// since it risks being captured further up
			mobility_total -= ((Board.rank(square)+1) *5)/2;
		}
		// If the piece have no safe squares it is just as good as trapped so penalize
		// this even harder
		else if(mobility_safe == 0)
		{
			mobility_total -= ((Board.rank(square)+1)*5);
		}
		
		evalDetail.mobility.wm += mobility_total;
		evalDetail.mobility.we += mobility_total;
	}