An AI Puzzle - Just For Fun
- Here's the puzzle
- Only 2 persons on the raft at a time
- The father can not stay with any of the daughters without
the mother's presence
- The mother can not stay with any of the sons without the
father's presence
- The thief can not stay with any family member if the policeman
is not there
- Only the father, the mother and the policeman know how to operate
the raft
ArrayList Class
- Notice that it implements the List interface
- Notice that it uses generics, a feature new in Java 5.0
Some ArrayList Class Methods (look at online documentation)
- constructor
- add
- clear
- contains
- get
- indexOf
- isEmpty
- remove
- set
- size
Sample Code