1 func for check&mate