based on the code from Constructing Intelligent Agents Using Java by Joseph and Jennifer Bigus