|
-
Aug 1st, 2012, 07:00 AM
#1
Thread Starter
New Member
Life
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
-
Aug 1st, 2012, 08:44 AM
#2
Re: Life
Moved to Chit Chat from Visual Basic 6 and Earlier
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 1st, 2012, 08:56 AM
#3
Re: Life
Life? Don't talk to me about Life!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|