"If it looks like a , and quacks like a , we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands." - Douglas Adams (English Writer) 1952-2001
0 Members and 36 Guests are viewing this topic.
Just woke up.
Went to the dentist with my son ridiculously early. Worked. Tinkered with my ftp client, without understanding anything. Logged on here, noting that Dunc had solved the attachment/avatar problem. Have to get more sleep, sooner or later.
import randomclass Person(): def __init__(self, age=(0,0), gender=random.randrange(0,1), timetobirth=(0,0), children=0): self.age = age self.gender = gender self.timetobirth = timetobirth self.children = children def update(self, poplist): self.age = addtime(self.age,(0,1)) if self.gender == 0 and self.age[0] >= 12: self.timetobirth = addtime(self.timetobirth,(0,1)) if self.timetobirth[1] >=40: self.timetobirth = (0,0) self.children = self.children + 1 poplist = poplist + [Person()] return poplistdef addtime((years1, weeks1), (years2, weeks2)): weeks = weeks1 + weeks2 years = years1 + years2 while weeks >= 52: years = years + 1 weeks = weeks - 52 return (years, weeks)##########Initialise data########date = (0,0) #start date set at 0 years, 0 weekstimetobirth = (0,0) #40 weeks for pregnancypoplist = [Person((18,0),0,(0,40)),Person((18,0),0,(0,40)),Person((18,0),0,(0,40)), Person((18,0),1,(0,0)),Person((18,0),1,(0,0)),Person((18,0),1,(0,0))]for i in poplist: print (i.age, i.gender, i.timetobirth)print ''###########Main loop########counter = 0for i in range(5220): #Insert run length in weeks# if date[1] == 0 #uncomment for yearly update if counter == 520 or if date == (0,0): #Print an update every decade and once at the start counter = 0 print "" print "Date ==", date print "Population ==", len(poplist) age0_11 = 0 age12_18 = 0 age19_64 = 0 age65_99 = 0 age100_199 = 0 age200_499 = 0 age500_999 = 0 age1000plus = 0 for i in poplist: if i.age[0] <= 11: age0_11 = age0_11 + 1 elif i.age[0] >=12 and i.age[0] <=18: age12_18 = age12_18 + 1 elif i.age[0] >=19 and i.age[0] <= 64: age19_64 = age19_64 + 1 elif i.age[0] >= 65 and i.age[0] <= 99: age65_99 = age65_99 + 1 elif i.age[0] >= 100 and i.age[0] <= 199: age100_199 = age100_199 + 1 elif i.age[0] >= 200 and i.age[0] <= 499: age200_499 = age200_499 + 1 elif i.age[0] >= 500 and i.age[0] <= 999: age500_999 = age500_999 + 1 else: age1000plus = age1000plus + 1 print "Age 0 to 11 ==", age0_11 print "Age 12 to 18 ==", age12_18 print "Age 19 to 64 ==", age19_64 print "Age 65 to 99 ==", age65_99 print "Age 100 to 199 ==", age100_199 print "Age 200 to 499 ==", age200_499 print "Age 500 to 999 ==", age500_999 print "Age 1000+ ==", age1000plus children= age0_11 + age12_18 adults = age19_64 + age65_99 + age100_199 + age200_499 + age200_499 + age500_999 + age1000plus try: print "Children per adult ==", float(children)/adults except: print 0 counter = counter + 1 date = addtime(date, (0,1)) index = -1 for i in range(len(poplist)): index = index + 1 poplist = poplist[index].update(poplist)
((18, 0), 0, (0, 40))((18, 0), 0, (0, 40))((18, 0), 0, (0, 40))((18, 0), 1, (0, 0))((18, 0), 1, (0, 0))((18, 0), 1, (0, 0))Date == (10, 0)Population == 45Age 0 to 11 == 39Age 12 to 18 == 0Age 19 to 64 == 6Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 6.5Date == (20, 0)Population == 249Age 0 to 11 == 210Age 12 to 18 == 27Age 19 to 64 == 12Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 19.75Date == (30, 0)Population == 1119Age 0 to 11 == 957Age 12 to 18 == 111Age 19 to 64 == 51Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 20.9411764706Date == (40, 0)Population == 6195Age 0 to 11 == 5388Age 12 to 18 == 519Age 19 to 64 == 288Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 20.5104166667Date == (50, 0)Population == 33456Age 0 to 11 == 28710Age 12 to 18 == 3357Age 19 to 64 == 1383Age 65 to 99 == 6Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 23.0863930886
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?
I wrote a little program to simulate population growth after the biblical flood. It assumes the population grows under near-miraculous levels of fertility and zero mortality, with each female producing a baby every 40 weeks once they're 12 years old. Unfortunately I suck at coding, so it's very inefficient and slows almost to a halt on my machine after about 50 years, when the population is 33456. Dates are given as (years,weeks), counting from (0,0) at the start of the run.Code: [Select]import randomclass Person(): def __init__(self, age=(0,0), gender=random.randrange(0,1), timetobirth=(0,0), children=0): self.age = age self.gender = gender self.timetobirth = timetobirth self.children = children def update(self, poplist): self.age = addtime(self.age,(0,1)) if self.gender == 0 and self.age[0] >= 12: self.timetobirth = addtime(self.timetobirth,(0,1)) if self.timetobirth[1] >=40: self.timetobirth = (0,0) self.children = self.children + 1 poplist = poplist + [Person()] return poplistdef addtime((years1, weeks1), (years2, weeks2)): weeks = weeks1 + weeks2 years = years1 + years2 while weeks >= 52: years = years + 1 weeks = weeks - 52 return (years, weeks)##########Initialise data########date = (0,0) #start date set at 0 years, 0 weekstimetobirth = (0,0) #40 weeks for pregnancypoplist = [Person((18,0),0,(0,40)),Person((18,0),0,(0,40)),Person((18,0),0,(0,40)), Person((18,0),1,(0,0)),Person((18,0),1,(0,0)),Person((18,0),1,(0,0))]for i in poplist: print (i.age, i.gender, i.timetobirth)print ''###########Main loop########counter = 0for i in range(5220): #Insert run length in weeks# if date[1] == 0 #uncomment for yearly update if counter == 520 or if date == (0,0): #Print an update every decade and once at the start counter = 0 print "" print "Date ==", date print "Population ==", len(poplist) age0_11 = 0 age12_18 = 0 age19_64 = 0 age65_99 = 0 age100_199 = 0 age200_499 = 0 age500_999 = 0 age1000plus = 0 for i in poplist: if i.age[0] <= 11: age0_11 = age0_11 + 1 elif i.age[0] >=12 and i.age[0] <=18: age12_18 = age12_18 + 1 elif i.age[0] >=19 and i.age[0] <= 64: age19_64 = age19_64 + 1 elif i.age[0] >= 65 and i.age[0] <= 99: age65_99 = age65_99 + 1 elif i.age[0] >= 100 and i.age[0] <= 199: age100_199 = age100_199 + 1 elif i.age[0] >= 200 and i.age[0] <= 499: age200_499 = age200_499 + 1 elif i.age[0] >= 500 and i.age[0] <= 999: age500_999 = age500_999 + 1 else: age1000plus = age1000plus + 1 print "Age 0 to 11 ==", age0_11 print "Age 12 to 18 ==", age12_18 print "Age 19 to 64 ==", age19_64 print "Age 65 to 99 ==", age65_99 print "Age 100 to 199 ==", age100_199 print "Age 200 to 499 ==", age200_499 print "Age 500 to 999 ==", age500_999 print "Age 1000+ ==", age1000plus children= age0_11 + age12_18 adults = age19_64 + age65_99 + age100_199 + age200_499 + age200_499 + age500_999 + age1000plus try: print "Children per adult ==", float(children)/adults except: print 0 counter = counter + 1 date = addtime(date, (0,1)) index = -1 for i in range(len(poplist)): index = index + 1 poplist = poplist[index].update(poplist)Quote from: output((18, 0), 0, (0, 40))((18, 0), 0, (0, 40))((18, 0), 0, (0, 40))((18, 0), 1, (0, 0))((18, 0), 1, (0, 0))((18, 0), 1, (0, 0))Date == (10, 0)Population == 45Age 0 to 11 == 39Age 12 to 18 == 0Age 19 to 64 == 6Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 6.5Date == (20, 0)Population == 249Age 0 to 11 == 210Age 12 to 18 == 27Age 19 to 64 == 12Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 19.75Date == (30, 0)Population == 1119Age 0 to 11 == 957Age 12 to 18 == 111Age 19 to 64 == 51Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 20.9411764706Date == (40, 0)Population == 6195Age 0 to 11 == 5388Age 12 to 18 == 519Age 19 to 64 == 288Age 65 to 99 == 0Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 20.5104166667Date == (50, 0)Population == 33456Age 0 to 11 == 28710Age 12 to 18 == 3357Age 19 to 64 == 1383Age 65 to 99 == 6Age 100 to 199 == 0Age 200 to 499 == 0Age 500 to 999 == 0Age 1000+ == 0Children per adult == 23.0863930886
just noticed a thing i posted about my OCD on another site has been categorised under "sex confessions" and i don't know why
Quote from: Soph on April 11, 2008, 07:28:51 PMjust noticed a thing i posted about my OCD on another site has been categorised under "sex confessions" and i don't know whyOooh you dirty girl