A college course on compassion helped a freshman calibrate her interactions with a world that isn’t always kind.