The tricky thing about evolution--and I agree that it's a philosophical issue, but no more than that--is that the problem is changing along with the solution, and the exact nature of the problem is unknown until after the fact. The problem is survival in a changing environment. The particular problem at any one time may involve an ice age, or it may involve an extended dry period or an asteroid strike, but which it is is unknown while the evolution is going on. But nature comes up with a lot of solutions, and with luck one of them matches the problem.
It's like betting on roulette. You don't know the problem (the ball lands on 18) when you bet, but there are lots of solutions (red, even, 1-18...). It doesn't take any intelligence to come up with a solution for the problem.
The point being is that an organism doesn't face one problem at a time.