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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-24-2011, 01:23 PM   #13
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
 


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 02:03 PM.


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