Foraging by a wood-decomposing fungus is ecologically adaptive.