wolf, goat, cabbage puzzle C++ solution is OK, need simplified