added stalemate and fixed castle bug