The Crossing Problem
father son1 son2 / /
... / /
. . / /
... / /
| ... ... / /
------- . . . . / /
| ... ... / \ boat / /
| | r| / \________/ /
| ------- -------- max load
/ \ | | 200 lbs.
/ \ / \ / \
200 100 100
lbs. lbs. lbs.
trip ==> crossings. crossings ==> done. crossings ==> do-crossing crossings do-crossing ==> select-passengers check-load change-sides
trip do the full crosing problem trip2 trip2 is a debugging tool crossing do the sequence of crossings do_crossing do a single crosing init starting values, all on side1, none on side2 done succeed if boat and all passengers at side2 select_apssengers pick subset of passengers and mve move_from select passengers and do the move stop_repeats make sure we donot repeat a previous configuration check_load succeed if baot not overloaded member succeed if item is in List subset pick subset or test if a subset member_out remove item from ListOld giving ListNew set_member succeed if Set is found in list of sets setminus substract out a set setplus add two sets set_equal test if two sets are equal select_subset select a subset