Just make a 8x8 matrix and after check whether a king is under attack. Be careful with the difference between white and balck pawns.