build logic for checking king