Steve Jackson Games - Site Navigation
Home General Info Follow Us Search Illuminator Store Forums What's New Other Games Ogre GURPS Munchkin Our Games: Home

Go Back   Steve Jackson Games Forums > Roleplaying > GURPS

Reply
 
Thread Tools Display Modes
Old 11-24-2011, 01:23 PM   #21
Bruno
 
Bruno's Avatar
 
Join Date: Sep 2004
Location: Canada
Default Re: The bell-curve for Luck

Quote:
Originally Posted by Verjigorm View Post
How do you people do this stuff?!
I make computers do it.

Code:
#!perl -w
use strict;
use Games::Rolldice 'roll';
use List::Util qw(sum max min);

my %results;
my $count = 1000000;

for (my $x =0;  $x<$count; $x++) {
   my $result = min(roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'));
   $results{$result}+= 1;
}

my %result_analysis;

foreach my $roll (sort keys %results){
   $result_analysis{$roll} = sprintf('%05f',($results{$roll}/$count));
   print "$roll:\t$result_analysis{$roll}\n";
}
__________________
All about Size Modifier; Unified Hit Location Table
A Wiki for my F2F Group
A neglected GURPS blog

Last edited by Bruno; 11-24-2011 at 01:24 PM. Reason: Cleaning up messy code
Bruno is offline   Reply With Quote
Old 11-24-2011, 01:26 PM   #22
Bruno
 
Bruno's Avatar
 
Join Date: Sep 2004
Location: Canada
Default Re: The bell-curve for Luck

That really illustrates why I do it the "lazy" way - 19 lines of code (counting blank lines for readability), then I just run the stupid thing and stop thinking about it. Five minutes later, results pop out.
__________________
All about Size Modifier; Unified Hit Location Table
A Wiki for my F2F Group
A neglected GURPS blog
Bruno is offline   Reply With Quote
Old 11-24-2011, 01:30 PM   #23
bcd
 
Join Date: Aug 2009
Default Re: The bell-curve for Luck

Quote:
Originally Posted by Bruno View Post
Good job I didn't do that then. :)
No, I was referring to Grouchy Chris' table with the two rerolls statistics in it; I just didn't make it very clear that this was what I did. :P
bcd is offline   Reply With Quote
Old 11-24-2011, 01:37 PM   #24
Grouchy Chris
 
Grouchy Chris's Avatar
 
Join Date: Nov 2007
Location: The City of Subdued Excitement
Default Re: The bell-curve for Luck

Quote:
Originally Posted by bcd View Post
It seems a bit unfair to give probabilities for Luck on the premise "the first roll has already failed", side by side with probabilities for normal use without that premise. Properly therefore, the "Regular" column should be all zeros to be comparable. :P
I take your point, but I think it's useful as a benchmark for those who are used to thinking about their chances of beating, say, a 12 on one roll.
__________________
The GURPS Wiki has 581 articles and counting!
My blog, mainly about GURPS.

Last edited by Grouchy Chris; 11-24-2011 at 02:36 PM.
Grouchy Chris is offline   Reply With Quote
Old 11-24-2011, 01:49 PM   #25
mhd
 
mhd's Avatar
 
Join Date: Apr 2008
Location: Land of the Beer, Home of the Dirndls
Default Re: The bell-curve for Luck

Code:
   my $result = min(roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'));
Why is roll invoked 4 times?
mhd is offline   Reply With Quote
Old 11-24-2011, 01:53 PM   #26
Bruno
 
Bruno's Avatar
 
Join Date: Sep 2004
Location: Canada
Default Re: The bell-curve for Luck

Quote:
Originally Posted by mhd View Post
Code:
   my $result = min(roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'),roll("3d6", '-sum' => 'true'));
Why is roll invoked 4 times?
Because the last time I rand it, it was for Ts_ - who asked for a "best of 4" scenario :)
__________________
All about Size Modifier; Unified Hit Location Table
A Wiki for my F2F Group
A neglected GURPS blog
Bruno is offline   Reply With Quote
Old 11-24-2011, 01:54 PM   #27
mhd
 
mhd's Avatar
 
Join Date: Apr 2008
Location: Land of the Beer, Home of the Dirndls
Default Re: The bell-curve for Luck

Quote:
Originally Posted by Bruno View Post
Because the last time I rand it, it was for Ts_ - who asked for a "best of 4" scenario :)
Missed that, sorry ;)
mhd is offline   Reply With Quote
Old 11-24-2011, 01:56 PM   #28
Dragondog
Never Been Pretty
 
Join Date: Jan 2005
Default Re: The bell-curve for Luck

Getting an 18 in best of 4 happens once in about 2.18 billion rolls. And getting 17 is 15 times more likely.

Quote:
Originally Posted by Bruno View Post
Actually, I double checked - since I got an 18 at all in my output, it means that at least one 18 was rolled. I don't register the number in the hash table unless it comes up.

For example, I just tested the "best of 4" scenario and no 17s or 18s ever came up :)
Code:
	4x Luck	3x Luck	Regular
3:	1.8375%	1.3832%	0.5%
4:	5.3775%	4.0677%	1.389%
5:	10.0936%	7.8090%	2.740%
6:	14.9343%	12.0218%	4.616%
7:	18.5378%	15.8806%	6.945%
8:	19.2047%	18.2009%	9.736%
9:	14.7819%	16.2288%	11.564%
10:	8.9922%	11.9093%	12.473%
11:	4.2772%	7.2197%	12.509%
12:	1.5167%	3.5351%	11.649%
13:	0.3788%	1.3187%	9.736%
14:	0.0607%	0.3452%	6.920%
15:	0.0069%	0.0706%	4.626%
16:	0.0002%	0.0089%	2.795%
17:		0.0006%	1.391%
18:		0.0000%	0.458%
Dragondog is offline   Reply With Quote
Old 11-24-2011, 02:27 PM   #29
Verjigorm
 
Join Date: Jan 2005
Location: Charlotte, North Caroline, United States of America, Earth?
Default Re: The bell-curve for Luck

Quote:
Originally Posted by Bruno View Post
I make computers do it.
Could you do that with say, 4 d6, drop the lowest 2, as well as 5d6, drop lowest 2? what about roll 5 and drop the lowest three, roll 6 and drop the lowest three?
__________________
Hydration is key
Verjigorm is online now   Reply With Quote
Old 11-24-2011, 02:32 PM   #30
PseudoFenton
 
PseudoFenton's Avatar
 
Join Date: Apr 2010
Location: Land of the Britons
Default Re: The bell-curve for Luck

Quote:
Originally Posted by Verjigorm View Post
Could you do that with say, 4 d6, drop the lowest 2, as well as 5d6, drop lowest 2? what about roll 5 and drop the lowest three, roll 6 and drop the lowest three?
Is that a question or a request? It's possible, if that's what your question is.

Also, AnyDice.com does some fun statistical read outs for various die rolling methods and (as the name suggests) even fictional sided die, so you can check that out too.
__________________
...like a monkey with a wrench.
PseudoFenton is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Fnords are Off
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:30 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.