Home Segments Index Top Previous Next

501: Mainline

The state of an individual female rabbit is determined by the month of her next delivery of a baby rabbit, expressed as an integer. To model an individual, you define the Rabbit class so as to include an instance variable that records the next month that the rabbit will deliver a new baby rabbit:

Rabbit class definition 
Object subclass: #Rabbit 
  instanceVariableNames: 'deliveryMonth' 
  classVariableNames: '' 
  poolDictionaries: '' 

When you simulate the growth of a population of rabbits, there will be just one rabbit instance at first, born at month 0.