hettlage (133) [Avatar] Offline
#1
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, missionaries.py 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 (8) [Avatar] Offline
#2
Thanks for the feedback! I'm going to put a disclaimer into the exercise about this coding issue.