Life, from a VBA perspective. Consider it open source
(please excuse use of tabs)

Code:
function life(adult_age as integer, retirement_age as integer, _
			  life_expectancy as integer) as integer

	dim year as integer, luck as integer
	dim mantra as string, brainwash as string

	' childhood
	mantra = "grow up"
	for year = 0 to adult_age
		brainwash = mantra
	next year

	' adulthood
	mantra = "get a job"
	for year = year to retirement_age
		brainwash = mantra
		luck = year + Int((7 * Rnd) - 3) ' randomly +/- 0 to 3
		if luck >= retirement_age or luck >= life_expectancy then exit for
	next year

	' retirement
	mantra = "retire"
	for year = year to life_expectancy
		brainwash = mantra
		luck = year + Int((7 * Rnd) - 3) ' randomly +/- 0 to 3
		if luck >= life_expectancy then exit for		
	next year

	life = 0
end function