PDA

View Full Version : Destroying the world in half an hour

Dr Bwaa
2008-02-29, 10:48 PM
So one of my friends' girlfriends, in a small fit of D&D hatred, suggested that any time someone rolls a 1, that person should die. Furthermore, people should have to roll to continue breathing all the time.

I told her this was a terrible idea and that the world would soon go extinct, which, I think you'll all agree with me, is true. However, I then wanted to see just how long we'd survive.

So, I wrote a quick program in java to figure it out. It rolls a die for everyone on the planet, and then kills off the people who rolled ones. Then it repeats, until everyone is dead. I also included the world's current population growth (estimated at 1.14% per year) to offset this a little. The results? It takes somewhere between 35-45 minutes for everyone to die (much more than I'd expected!). It also takes about two hours for my computer to run this thing on the full world population of ~6.65 billion. I guess I asked for that.

-a circle composed of dots, which disappear as people die.
-a long list of names to draw from, to get a play-by-play of WHO dies.
-putting it online (working on it)

Anyone? Comments? Questions? Suggestions? Ideas for some kind of real application of this?

My code:

/**
* WorldKiller.java
* By Henry Keiter
* 2/29/08
*
* This program takes the original double "population" as the current population of the world.
* It then runs a scenario in which everyone must make a check to continue breathing every round.
* This check fails on a 1, and if a person fails the check he/she dies.
* A growth rate of 1.14% per year is included in the calculations (by the exponential growth formula).
* This accounts for why larger populations will tend to live slightly longer than smaller ones.
* The simulation continues until the world runs out of living humans.
*/

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.applet.Applet;
import java.lang.Math;

public class WorldKiller extends Applet{

/**
*
*/
private static final long serialVersionUID = 1L;
double population = 6650000.000;
double numberOfDeaths;

public static void main(String[] args) {

DateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");
java.util.Date date1 = new java.util.Date();
String time1 = dateFormat1.format(date1);

//Setting up a very crude timer

WorldKiller killer = new WorldKiller();
Random randGen = new Random();
int x = 0;
//this will measure how many rounds it takes to kill everyone.

while(killer.population>0){

System.out.println(x+" rounds have passed. World Population is now "+killer.population);
for(double i=0.; i<killer.population; i++){

//roll one die for everyone in the world. A botch means death.

int roll = randGen.nextInt(20) + 1;
if(roll==1){

killer.numberOfDeaths++;
}
/*if(i%1000000. == 0){

System.out.println(i); //this is just to watch progress, which can appear very slow.
}*/
}
killer.population = (long) (killer.population * Math.pow(1.0114,0.00000019065049950430870128879737 664913));

//this is the estimated population growth of the world per round, based on growth of
//1.14% per year (using the exponential growth formula)
killer.population = killer.population - killer.numberOfDeaths;
killer.numberOfDeaths = 0; //reset this so we don't recount old deaths
x++;
}
System.out.println(x+" rounds have passed. World Population is now "+killer.population);
int y = x/10;
System.out.println("It took "+x+" rounds to kill the human race, or about "+y+" minutes. Good job!");

DateFormat dateFormat2 = new SimpleDateFormat("HH:mm:ss");
java.util.Date date2 = new java.util.Date();
String time2 = dateFormat2.format(date2);

System.out.println("Calculations began at "+time1+" and ended at "+time2);

}

}

Sample output (on 6.65 million people, rather than billion):

0 rounds have passed. World Population is now 6650000.0
1 rounds have passed. World Population is now 6317057.0
2 rounds have passed. World Population is now 6001192.0
3 rounds have passed. World Population is now 5700996.0
4 rounds have passed. World Population is now 5415854.0
5 rounds have passed. World Population is now 5144557.0
6 rounds have passed. World Population is now 4887285.0
7 rounds have passed. World Population is now 4642948.0
8 rounds have passed. World Population is now 4410504.0
9 rounds have passed. World Population is now 4189974.0
10 rounds have passed. World Population is now 3979640.0
11 rounds have passed. World Population is now 3780937.0
12 rounds have passed. World Population is now 3591783.0
13 rounds have passed. World Population is now 3411859.0
14 rounds have passed. World Population is now 3241423.0
15 rounds have passed. World Population is now 3079720.0
16 rounds have passed. World Population is now 2926030.0
17 rounds have passed. World Population is now 2780150.0
18 rounds have passed. World Population is now 2641238.0
19 rounds have passed. World Population is now 2508705.0
20 rounds have passed. World Population is now 2382769.0
21 rounds have passed. World Population is now 2263527.0
22 rounds have passed. World Population is now 2150505.0
23 rounds have passed. World Population is now 2042508.0
24 rounds have passed. World Population is now 1940604.0
25 rounds have passed. World Population is now 1843870.0
26 rounds have passed. World Population is now 1751368.0
27 rounds have passed. World Population is now 1663644.0
28 rounds have passed. World Population is now 1580600.0
29 rounds have passed. World Population is now 1501271.0
30 rounds have passed. World Population is now 1426440.0
31 rounds have passed. World Population is now 1354895.0
32 rounds have passed. World Population is now 1287132.0
33 rounds have passed. World Population is now 1222994.0
34 rounds have passed. World Population is now 1161691.0
35 rounds have passed. World Population is now 1103663.0
36 rounds have passed. World Population is now 1048344.0
37 rounds have passed. World Population is now 996144.0
38 rounds have passed. World Population is now 946564.0
39 rounds have passed. World Population is now 899252.0
40 rounds have passed. World Population is now 854269.0
41 rounds have passed. World Population is now 811232.0
42 rounds have passed. World Population is now 770946.0
43 rounds have passed. World Population is now 732375.0
44 rounds have passed. World Population is now 695845.0
45 rounds have passed. World Population is now 660941.0
46 rounds have passed. World Population is now 628173.0
47 rounds have passed. World Population is now 596942.0
48 rounds have passed. World Population is now 566994.0
49 rounds have passed. World Population is now 538532.0
50 rounds have passed. World Population is now 511591.0
51 rounds have passed. World Population is now 486241.0
52 rounds have passed. World Population is now 462084.0
53 rounds have passed. World Population is now 439105.0
54 rounds have passed. World Population is now 417076.0
55 rounds have passed. World Population is now 396272.0
56 rounds have passed. World Population is now 376306.0
57 rounds have passed. World Population is now 357563.0
58 rounds have passed. World Population is now 339365.0
59 rounds have passed. World Population is now 322377.0
60 rounds have passed. World Population is now 306229.0
61 rounds have passed. World Population is now 290777.0
62 rounds have passed. World Population is now 276197.0
63 rounds have passed. World Population is now 262073.0
64 rounds have passed. World Population is now 249058.0
65 rounds have passed. World Population is now 236660.0
66 rounds have passed. World Population is now 224813.0
67 rounds have passed. World Population is now 213702.0
68 rounds have passed. World Population is now 203073.0
69 rounds have passed. World Population is now 193041.0
70 rounds have passed. World Population is now 183323.0
71 rounds have passed. World Population is now 174317.0
72 rounds have passed. World Population is now 165558.0
73 rounds have passed. World Population is now 157213.0
74 rounds have passed. World Population is now 149275.0
75 rounds have passed. World Population is now 141857.0
76 rounds have passed. World Population is now 134788.0
77 rounds have passed. World Population is now 128144.0
78 rounds have passed. World Population is now 121767.0
79 rounds have passed. World Population is now 115835.0
80 rounds have passed. World Population is now 110052.0
81 rounds have passed. World Population is now 104426.0
82 rounds have passed. World Population is now 99089.0
83 rounds have passed. World Population is now 94208.0
84 rounds have passed. World Population is now 89545.0
85 rounds have passed. World Population is now 85075.0
86 rounds have passed. World Population is now 80754.0
87 rounds have passed. World Population is now 76628.0
88 rounds have passed. World Population is now 72839.0
89 rounds have passed. World Population is now 69145.0
90 rounds have passed. World Population is now 65697.0
91 rounds have passed. World Population is now 62419.0
92 rounds have passed. World Population is now 59263.0
93 rounds have passed. World Population is now 56308.0
94 rounds have passed. World Population is now 53502.0
95 rounds have passed. World Population is now 50811.0
96 rounds have passed. World Population is now 48335.0
97 rounds have passed. World Population is now 45922.0
98 rounds have passed. World Population is now 43609.0
99 rounds have passed. World Population is now 41387.0
100 rounds have passed. World Population is now 39405.0
101 rounds have passed. World Population is now 37452.0
102 rounds have passed. World Population is now 35548.0
103 rounds have passed. World Population is now 33717.0
104 rounds have passed. World Population is now 32034.0
105 rounds have passed. World Population is now 30412.0
106 rounds have passed. World Population is now 28866.0
107 rounds have passed. World Population is now 27384.0
108 rounds have passed. World Population is now 25964.0
109 rounds have passed. World Population is now 24639.0
110 rounds have passed. World Population is now 23392.0
111 rounds have passed. World Population is now 22169.0
112 rounds have passed. World Population is now 21071.0
113 rounds have passed. World Population is now 20009.0
114 rounds have passed. World Population is now 19035.0
115 rounds have passed. World Population is now 18109.0
116 rounds have passed. World Population is now 17182.0
117 rounds have passed. World Population is now 16316.0
118 rounds have passed. World Population is now 15490.0
119 rounds have passed. World Population is now 14668.0
120 rounds have passed. World Population is now 13910.0
121 rounds have passed. World Population is now 13260.0
122 rounds have passed. World Population is now 12646.0
123 rounds have passed. World Population is now 12067.0
124 rounds have passed. World Population is now 11402.0
125 rounds have passed. World Population is now 10785.0
126 rounds have passed. World Population is now 10231.0
127 rounds have passed. World Population is now 9732.0
128 rounds have passed. World Population is now 9231.0
129 rounds have passed. World Population is now 8722.0
130 rounds have passed. World Population is now 8294.0
131 rounds have passed. World Population is now 7862.0
132 rounds have passed. World Population is now 7478.0
133 rounds have passed. World Population is now 7074.0
134 rounds have passed. World Population is now 6731.0
135 rounds have passed. World Population is now 6389.0
136 rounds have passed. World Population is now 6048.0
137 rounds have passed. World Population is now 5748.0
138 rounds have passed. World Population is now 5475.0
139 rounds have passed. World Population is now 5201.0
140 rounds have passed. World Population is now 4932.0
141 rounds have passed. World Population is now 4703.0
142 rounds have passed. World Population is now 4460.0
143 rounds have passed. World Population is now 4240.0
144 rounds have passed. World Population is now 4036.0
145 rounds have passed. World Population is now 3831.0
146 rounds have passed. World Population is now 3625.0
147 rounds have passed. World Population is now 3432.0
148 rounds have passed. World Population is now 3262.0
149 rounds have passed. World Population is now 3112.0
150 rounds have passed. World Population is now 2963.0
151 rounds have passed. World Population is now 2827.0
152 rounds have passed. World Population is now 2684.0
153 rounds have passed. World Population is now 2538.0
154 rounds have passed. World Population is now 2406.0
155 rounds have passed. World Population is now 2285.0
156 rounds have passed. World Population is now 2179.0
157 rounds have passed. World Population is now 2074.0
158 rounds have passed. World Population is now 1959.0
159 rounds have passed. World Population is now 1873.0
160 rounds have passed. World Population is now 1786.0
161 rounds have passed. World Population is now 1679.0
162 rounds have passed. World Population is now 1607.0
163 rounds have passed. World Population is now 1532.0
164 rounds have passed. World Population is now 1454.0
165 rounds have passed. World Population is now 1380.0
166 rounds have passed. World Population is now 1306.0
167 rounds have passed. World Population is now 1255.0
168 rounds have passed. World Population is now 1180.0
169 rounds have passed. World Population is now 1118.0
170 rounds have passed. World Population is now 1067.0
171 rounds have passed. World Population is now 1014.0
172 rounds have passed. World Population is now 961.0
173 rounds have passed. World Population is now 903.0
174 rounds have passed. World Population is now 862.0
175 rounds have passed. World Population is now 819.0
176 rounds have passed. World Population is now 771.0
177 rounds have passed. World Population is now 721.0
178 rounds have passed. World Population is now 682.0
179 rounds have passed. World Population is now 651.0
180 rounds have passed. World Population is now 617.0
181 rounds have passed. World Population is now 583.0
182 rounds have passed. World Population is now 553.0
183 rounds have passed. World Population is now 527.0
184 rounds have passed. World Population is now 498.0
185 rounds have passed. World Population is now 473.0
186 rounds have passed. World Population is now 450.0
187 rounds have passed. World Population is now 428.0
188 rounds have passed. World Population is now 410.0
189 rounds have passed. World Population is now 391.0
190 rounds have passed. World Population is now 372.0
191 rounds have passed. World Population is now 351.0
192 rounds have passed. World Population is now 335.0
193 rounds have passed. World Population is now 320.0
194 rounds have passed. World Population is now 307.0
195 rounds have passed. World Population is now 292.0
196 rounds have passed. World Population is now 280.0
197 rounds have passed. World Population is now 268.0
198 rounds have passed. World Population is now 253.0
199 rounds have passed. World Population is now 247.0
200 rounds have passed. World Population is now 234.0
201 rounds have passed. World Population is now 218.0
202 rounds have passed. World Population is now 208.0
203 rounds have passed. World Population is now 189.0
204 rounds have passed. World Population is now 178.0
205 rounds have passed. World Population is now 170.0
206 rounds have passed. World Population is now 156.0
207 rounds have passed. World Population is now 151.0
208 rounds have passed. World Population is now 143.0
209 rounds have passed. World Population is now 138.0
210 rounds have passed. World Population is now 128.0
211 rounds have passed. World Population is now 123.0
212 rounds have passed. World Population is now 118.0
213 rounds have passed. World Population is now 117.0
214 rounds have passed. World Population is now 111.0
215 rounds have passed. World Population is now 106.0
216 rounds have passed. World Population is now 102.0
217 rounds have passed. World Population is now 101.0
218 rounds have passed. World Population is now 96.0
219 rounds have passed. World Population is now 90.0
220 rounds have passed. World Population is now 87.0
221 rounds have passed. World Population is now 82.0
222 rounds have passed. World Population is now 76.0
223 rounds have passed. World Population is now 74.0
224 rounds have passed. World Population is now 72.0
225 rounds have passed. World Population is now 70.0
226 rounds have passed. World Population is now 67.0
227 rounds have passed. World Population is now 64.0
228 rounds have passed. World Population is now 60.0
229 rounds have passed. World Population is now 57.0
230 rounds have passed. World Population is now 56.0
231 rounds have passed. World Population is now 54.0
232 rounds have passed. World Population is now 51.0
233 rounds have passed. World Population is now 48.0
234 rounds have passed. World Population is now 48.0
235 rounds have passed. World Population is now 42.0
236 rounds have passed. World Population is now 37.0
237 rounds have passed. World Population is now 37.0
238 rounds have passed. World Population is now 37.0
239 rounds have passed. World Population is now 35.0
240 rounds have passed. World Population is now 35.0
241 rounds have passed. World Population is now 35.0
242 rounds have passed. World Population is now 32.0
243 rounds have passed. World Population is now 30.0
244 rounds have passed. World Population is now 28.0
245 rounds have passed. World Population is now 26.0
246 rounds have passed. World Population is now 23.0
247 rounds have passed. World Population is now 23.0
248 rounds have passed. World Population is now 23.0
249 rounds have passed. World Population is now 22.0
250 rounds have passed. World Population is now 22.0
251 rounds have passed. World Population is now 20.0
252 rounds have passed. World Population is now 17.0
253 rounds have passed. World Population is now 16.0
254 rounds have passed. World Population is now 14.0
255 rounds have passed. World Population is now 13.0
256 rounds have passed. World Population is now 13.0
257 rounds have passed. World Population is now 11.0
258 rounds have passed. World Population is now 11.0
259 rounds have passed. World Population is now 10.0
260 rounds have passed. World Population is now 10.0
261 rounds have passed. World Population is now 10.0
262 rounds have passed. World Population is now 9.0
263 rounds have passed. World Population is now 9.0
264 rounds have passed. World Population is now 8.0
265 rounds have passed. World Population is now 8.0
266 rounds have passed. World Population is now 8.0
267 rounds have passed. World Population is now 8.0
268 rounds have passed. World Population is now 7.0
269 rounds have passed. World Population is now 7.0
270 rounds have passed. World Population is now 7.0
271 rounds have passed. World Population is now 6.0
272 rounds have passed. World Population is now 6.0
273 rounds have passed. World Population is now 6.0
274 rounds have passed. World Population is now 5.0
275 rounds have passed. World Population is now 5.0
276 rounds have passed. World Population is now 5.0
277 rounds have passed. World Population is now 5.0
278 rounds have passed. World Population is now 4.0
279 rounds have passed. World Population is now 4.0
280 rounds have passed. World Population is now 4.0
281 rounds have passed. World Population is now 4.0
282 rounds have passed. World Population is now 4.0
283 rounds have passed. World Population is now 4.0
284 rounds have passed. World Population is now 3.0
285 rounds have passed. World Population is now 2.0
286 rounds have passed. World Population is now 2.0
287 rounds have passed. World Population is now 2.0
288 rounds have passed. World Population is now 2.0
289 rounds have passed. World Population is now 2.0
290 rounds have passed. World Population is now 2.0
291 rounds have passed. World Population is now 2.0
292 rounds have passed. World Population is now 2.0
293 rounds have passed. World Population is now 2.0
294 rounds have passed. World Population is now 2.0
295 rounds have passed. World Population is now 2.0
296 rounds have passed. World Population is now 2.0
297 rounds have passed. World Population is now 2.0
298 rounds have passed. World Population is now 2.0
299 rounds have passed. World Population is now 2.0
300 rounds have passed. World Population is now 1.0
301 rounds have passed. World Population is now 1.0
302 rounds have passed. World Population is now 1.0
303 rounds have passed. World Population is now 1.0
304 rounds have passed. World Population is now 1.0
305 rounds have passed. World Population is now 1.0
306 rounds have passed. World Population is now 1.0
307 rounds have passed. World Population is now 1.0
308 rounds have passed. World Population is now 1.0
309 rounds have passed. World Population is now 1.0
310 rounds have passed. World Population is now 1.0
311 rounds have passed. World Population is now 1.0
312 rounds have passed. World Population is now 1.0
313 rounds have passed. World Population is now 1.0
314 rounds have passed. World Population is now 1.0
315 rounds have passed. World Population is now 1.0
316 rounds have passed. World Population is now 1.0
317 rounds have passed. World Population is now 1.0
318 rounds have passed. World Population is now 1.0
319 rounds have passed. World Population is now 1.0
320 rounds have passed. World Population is now 1.0
321 rounds have passed. World Population is now 0.0
It took 321 rounds to kill the human race, or about 32 minutes. Good job!
Calculations began at 21:58:13 and ended at 21:58:21

Jayngfet
2008-02-29, 10:52 PM
just the human race? elves and orcs must be kinda lonley now...

[FLUX]
2008-02-29, 10:52 PM
That's hilarious, the best use of Java I've ever seen. Also, what prompted her fit of rage?

EDIT FOR NINJA: Well, we can't rightly know the breathing and breeding rates of Orcs and Elves, seeing as there are none. Are there any fantasy authors who have drawn out the stats on nonsense like that?

deathbyhokie
2008-02-29, 11:07 PM
Sucks to be the last human, left looking at all the corpses for 3+ minutes, hoping that you somehow luck out forever.

Entertaining program. I've also go to ask though, what prompted this rage?

Zincorium
2008-02-29, 11:08 PM
On average, 5% of the entire population will statistically roll ones. Given such a huge population, if you're getting significantly different than that the computer program might be a bit biased. This is 5% every six seconds.

Technically, it will take a very, very long time for everyone to die, however most of the population will be dead rather quickly.

Starting with a population of 6 billion, you'd be down to 3.6 billion in the first minute. Including growth. Five minutes in, you're at 500 million or so, 40 million approaching ten minutes, and so on. Again, statistically, but the program should reflect a percentage varying only very slightly from the statistical average.

Dr Bwaa
2008-02-29, 11:18 PM
On average, 5% of the entire population will statistically roll ones. Given such a huge population, if you're getting significantly different than that the computer program might be a bit biased. This is 5% every six seconds.

Technically, it will take a very, very long time for everyone to die, however most of the population will be dead rather quickly.

Starting with a population of 6 billion, you'd be down to 3.6 billion in the first minute. Including growth. Five minutes in, you're at 500 million or so, 40 million approaching ten minutes, and so on. Again, statistically, but the program should reflect a percentage varying only very slightly from the statistical average.

Your analysis corresponds pretty well to my actual results.
Round 10 (minute one): 3.9 million remaining (starting at 6.6 million rather than billion).
Round 50 (minute ten): 511 thousand remaining.

They're off by a power of 1000, but I started from 1 billion/1000, so there you go.

Sucks to be the last human, left looking at all the corpses for 3+ minutes, hoping that you somehow luck out forever.

I agree.

The fit of rage was less a fit of rage than a fit of frustration brought on by being the only non-D&D-player at the dinner table and failing to be able to contribute much to the conversation, I believe.

Collin152
2008-02-29, 11:33 PM
And this assumes normal human populations, who get no bonus to their breathing check?
The PCs would still be alive for months.

Dr Bwaa
2008-02-29, 11:38 PM
people can only fail on a botch, and a botch is regarded as auto-fail (and therefore auto-death). I'm using the real-life world population and growth rate (estimated), but that's obviously easy to change.

Citizen Joe
2008-02-29, 11:39 PM
I think the typical person can hold their breath for about a minute, so someone would have to fail 10 consecutive checks in order to die. The chance of failing 10 consecutive checks in one minute is 0.05^10.... that amounts to 51 people out of a trillion dying each year due to failure to breathe. Meanwhile billions are being born to replace them.

Collin152
2008-02-29, 11:42 PM
people can only fail on a botch, and a botch is regarded as auto-fail (and therefore auto-death). I'm using the real-life world population and growth rate (estimated), but that's obviously easy to change.

What if I play with a "1 is a -20 penalty" variant? Can epic level characters pass their Breathign check on a natural one?
Wow, this is fun to talk about like it's real.

zaei
2008-02-29, 11:46 PM
I think the typical person can hold their breath for about a minute, so someone would have to fail 10 consecutive checks in order to die. The chance of failing 10 consecutive checks in one minute is 0.05^10.... that amounts to 51 people out of a trillion dying each year due to failure to breathe. Meanwhile billions are being born to replace them.

It's not suffocation that kills, in this case; it's rolling a 1. Having to check every round for breathing just ensures that you'll roll a 1 that much sooner.

LibraryOgre
2008-02-29, 11:48 PM
I think the survival program needs to be altered... it doesn't take into account girlfriends getting annoyed at gamer boyfriends and taking out entire gaming groups because they turn their annoyance at gamespeak into an excuse for more gamespeak. ;-)

Suzuro
2008-02-29, 11:49 PM
Hmm...this is possibly one of the greatest uses of Java, and we should really do more like it.

On a side note, even if you're using the "a is a negative 20 modifier" It's still going to be nigh impossible to reach epic levels before dying...

-Suzuro

Citizen Joe
2008-02-29, 11:54 PM
OK, I'll just take 10 on my breathing checks then...

Collin152
2008-02-29, 11:59 PM
Hmm...this is possibly one of the greatest uses of Java, and we should really do more like it.

On a side note, even if you're using the "a is a negative 20 modifier" It's still going to be nigh impossible to reach epic levels before dying...

-Suzuro

Naw, just start the campaign in epic levels.
Yeah, it works that way.

zaei
2008-02-29, 11:59 PM
OK, I'll just take 10 on my breathing checks then...

That would work, as long as you weren't threatened or distracted. Since you aren't rolling, you can't roll a 1, so you won't die from that.

Collin152
2008-03-01, 12:01 AM
That would work, as long as you weren't threatened or distracted. Since you aren't rolling, you can't roll a 1, so you won't die from that.

So... this is a world of asthmatics?

Ascension
2008-03-01, 12:09 AM
This is beautiful. You should have the BBEG in your next campaign start up an oxygen-destroying device right before you enter battle with him, and he should cackle "In the next 32 minutes, the human race will be exterminated!"

Use your program to determine how many people are left alive after you beat him.

Dr Bwaa
2008-03-01, 12:35 AM
This is beautiful. You should have the BBEG in your next campaign start up an oxygen-destroying device right before you enter battle with him, and he should cackle "In the next 32 minutes, the human race will be exterminated!"

Use your program to determine how many people are left alive after you beat him.

Awesome. That's great. Now to stat an oxygen-destroying device...

=D

zaei
2008-03-01, 01:17 AM
So... this is a world of asthmatics?

Worse; It's a world where people can do NOTHING except concentrate on breathing.

Write a program to figure out how long it will take the entire world to starve to death, since no one can eat. You may ignore population growth since, well, you have to concentrate on breathing ;)

Icewalker
2008-03-01, 04:43 AM
Wait, you didn't specify...35-45 minutes at one roll per minute? Or more or less?

I like how simple the code is. :smallbiggrin:

kentma57
2008-03-01, 11:47 AM
Wait, you didn't specify...35-45 minutes at one roll per minute? Or more or less?

I like how simple the code is. :smallbiggrin:

You accidently made a good point; why is the entire world acting in combat scale rounds?

Zincorium
2008-03-01, 11:53 AM
You accidently made a good point; why is the entire world acting in combat scale rounds?

Probably because combat rounds are used to represent stressful situations where time needs to be monitored carefully.

Frankly, I personally would see the people around me dying as I try desperately not to screw up my own breathing long enough to procreate... as rather stressful.

Cuddly
2008-03-01, 01:50 PM
I take ten on my breathing check.

Dr Bwaa
2008-03-01, 01:59 PM
Sorry, I didn't even notice that. Yes, everyone is making a check every combat round.

Taking 10

When your character is not being threatened or distracted, you may choose to take 10. Instead of rolling 1d20 for the skill check, calculate your result as if you had rolled a 10. For many routine tasks, taking 10 makes them automatically successful. Distractions or threats (such as combat) make it impossible for a character to take 10. In most cases, taking 10 is purely a safety measure —you know (or expect) that an average roll will succeed but fear that a poor roll might fail, so you elect to settle for the average roll (a 10). Taking 10 is especially useful in situations where a particularly high roll wouldn’t help.

Emphasis mine; I think everyone around you beginning to drop dead counts as a distraction =P

Tengu
2008-03-01, 02:31 PM
Write a program to figure out how long it will take the entire world to starve to death, since no one can eat. You may ignore population growth since, well, you have to concentrate on breathing ;)

That'd be actually pretty easy - nobody is rolling for anything, so you only have to count how much time would it take for the toughest man on earth to drop dead from starvation, and that's all.

UglyPanda
2008-03-01, 03:06 PM
This is amusing, but I'm a bit confused at some of the code.

Why do you use the exponential growth formula? Can't you just multiply since you're recalculating every round? (This is assuming that being born takes place in combat rounds as well)
You declare roll every time you iterate the loop. You should declare int outside of the loop, I think it's faster that way.
I'm confused as to why population is a double. You can't have a fraction of a person. Is it just so that the pow function works?

A geometric distribution also models this pretty well.
Survivors approximately equal to (World population)*(19/20)^(number of rounds passed), which gives about 50 minutes before 6 billion people are gone.

Collin152
2008-03-01, 03:23 PM
(This is assuming that being born takes place in combat rounds as well)

Yes. The process of childbirth is always a comabt situation.

Dr Bwaa
2008-03-01, 04:12 PM
Why do you use the exponential growth formula? Can't you just multiply since you're recalculating every round? (This is assuming that being born takes place in combat rounds as well)

The current estimated population growth is 1.14% per year. dividing that down to a percent/round does not give the same results (12% per year is less than 1% per month for a year), so I used exponential growth.

You declare roll every time you iterate the loop. You should declare int outside of the loop, I think it's faster that way.

Technically, you're right. However, adding 1 operation to a loop that runs in O(n) time (http://en.wikipedia.org/wiki/Big_O_notation) (where n is the current world population), while technically slowing down the program, still results in a loop that runs in O(n) time, because adding a constant doesn't matter.

I'm confused as to why population is a double. You can't have a fraction of a person. Is it just so that the pow function works?

Yes. Memory is cheap. =)

Jayngfet
2008-03-01, 04:16 PM
;4006166']That's hilarious, the best use of Java I've ever seen. Also, what prompted her fit of rage?

EDIT FOR NINJA: Well, we can't rightly know the breathing and breeding rates of Orcs and Elves, seeing as there are none. Are there any fantasy authors who have drawn out the stats on nonsense like that?

well, given the lifespan of orcs and elves I'd say that orcs breathe a bit deeper or faster, and elves slower, judging by the cell deterioration of aging.

Rune Katashima
2008-03-02, 06:18 AM
On average, 5% of the entire population will statistically roll ones. Given such a huge population, if you're getting significantly different than that the computer program might be a bit biased. This is 5% every six seconds.

This would statistically mean everyone would be dead in 2 minutes. Technically, even with a 5% chance, you could very well NEVER roll a 1. Highly unlikely but it all doesn't mean much. The randomly generated roll is best.

Hecore
2008-03-02, 06:58 AM
This would statistically mean everyone would be dead in 2 minutes.

It actually works out to a little more then 44 minutes via the statistical method (assuming 6.6 billion people at the start). Also speaking statistically, including growth over such a short period of time makes no real difference, especially if you include natural deaths into your figures.

Stiz
2008-03-02, 07:29 AM
The next time you are all at the dinner table again, you should let the girlfriend know about how many posts this thread got.... that should send her right over the edge!
HAHA!

Arbitrarity
2008-03-02, 10:12 AM
Hm. Is breathing CON based?

Ok... so we need...

Some sort of rogue/Exemplar/crusader/swordsage, with massive INT, and... um.... steady concentration and... that's all I can think of.

Aura of order, huge skill mastery, and steady concentration mind over body, etc for saves.

Flickerdart
2008-03-02, 10:18 AM
Are we counting Epic Resilience for this? Anyone with that will stay alive.

Also, if we have some fun with the rules and make Epic Resilience hereditary, we can repopulate the earth with only two epic-level characters. Actually, only one; the Epic-level female could just take advantage of someone before they die. But then we don't have the Epic Resilience as a certain for the offspring.

Zincorium
2008-03-02, 11:16 AM
This would statistically mean everyone would be dead in 2 minutes. Technically, even with a 5% chance, you could very well NEVER roll a 1. Highly unlikely but it all doesn't mean much. The randomly generated roll is best.

5% of the current number.

Not 5% of the starting number.

Not sure how you screwed that up.

The randomly generated roll was getting almost exactly what the probabilities would suggest, if you read Lordhenry4000's reply to my post. It was off by only fractions of a percentage, meaning the possible bias I suggested wasn't showing up at all, and the program was working fine.

Maerok
2008-03-02, 11:49 AM
That's why I took levels in Exemplar for breathing. Now I'm a diplo-breather!

Collin152
2008-03-02, 07:14 PM
Do Greater Dieties auto-succeed on their Breathing Check?

kingpocky
2008-03-02, 07:41 PM
I really have to wonder, what kind of situation prompted such an . . . unusual suggestion?

Animefunkmaster
2008-03-02, 07:58 PM
ring of sustinance
auquatic template
warforged
... the list goes on.

hewhosaysfish
2008-03-03, 09:42 AM
Does Iron Heart Surge work against mortality?

Dr Bwaa
2008-03-03, 11:22 AM
Does Iron Heart Surge work against mortality?

I'm not familiar with that; though by the sound of it I would say tentatively no.

That's why I took levels in Exemplar for breathing. Now I'm a diplo-breather!

Gross. =P

Do Greater Dieties auto-succeed on their Breathing Check?

I think so.

I really have to wonder, what kind of situation prompted such an . . . unusual suggestion?

I believe she just wanted everyone to die so she could have her boyfriend back.