Extract local play detection into helper function