code of checkmate,

its checks checkmate condition.