The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

hettlage (136) [Avatar] Offline
There might be a subtle issue in the code for solving the missionaries and cannibals problem: When (motivated by Exercise 3) I change MAX_NUM to, say, 5, doesn't seem to stop. The reason seems to be that the in operator (used for checking whether a state is in the explored list already) is unreliable for MCState. Adding an __eq__ and a __hash__ method seems to solve the issue.

(And while I know that "missionaries and cannibals" is a standard name, I personally think that basing the problem on missionaries and cannibals is unfortunate, as (although this is certainly not intended) it ultimately makes use of the rather colonial stereotype of noble (white?) missionaries vs savage (black?) indigenous people.)
David Kopec (15) [Avatar] Offline
Thanks for the feedback! I'm going to put a disclaimer into the exercise about this coding issue.