#! /usr/bin/perl -w use strict; use lib ('./'); use Dice; my $dieType = 10; my $rollQty = 6; my $dice = "$rollQty\d$dieType"; system("clear"); print "\n\$dice = $dice\n"; my $MagicMissles = Dice->grab("$dice"); my $total = $MagicMissles->rolls(1); my @rolls = $MagicMissles->faces; my $theoreticalAve = ($dieType) / 2; my $average = $total / $rollQty; sub numeric { $a <=> $b } @rolls = sort numeric (@rolls); print "\nHere are the di rolls\n@rolls\n"; $total = $MagicMissles->total; print "Total = $total\n"; @rolls = sort numeric ( $MagicMissles->reRoll('high', '3') ); print "\nAfter re-rolling the top 3 die\n@rolls\n"; $total = $MagicMissles->total; print "Total = $total\n"; @rolls = sort numeric ( $MagicMissles->reRoll('low', '2') ); print "\nAfter re-rolling the bottom 2 die\n@rolls\n"; $total = $MagicMissles->total; print "Total = $total\n"; print "\nInput the value of the Die you wish to re-roll: "; my $values = ; my @values = split(/ /,$values); @rolls = sort numeric ( $MagicMissles->reRoll('die', @values ) ); print "\nNew rolls now look like this\n@rolls\n"; $total = $MagicMissles->total; print "\nTotal damage = $total\n"; print "\nQuick rolls (unremembered any qty): "; my $qty = ; @rolls = $MagicMissles->qroll($qty); print "You rolled\n@rolls\n"; print "\nAverage should equal $theoreticalAve\nActual Average = $average\n\n";