A solver for the river crossing puzzle