I'm trying to make a poker probability calculator with the help of http://www.mircscripts.org/showdoc.php?type=code&id=3002 (I've only written the odds alias of the code below). I get an error with line too long referring to
var %a = $1,%b = 1
. There's something wrong with $3 and $4 when I use the odds alias, the calculations are only correct when they are set to 1


alias factorial {
var %a = $1,%b = 1
while (%a) {
var %b = %b * %a
dec %a
}
return %b
}

alias nCr {
return $calc($factorial($1) / ($factorial($$2) * $factorial($calc($1 - $2))))
msg $chan $calc($factorial($1) / ($factorial($$2) * $factorial($calc($1 - $2))))

}

alias odds { msg $chan $calc(($nCr($3,$4) * $nCr($calc($1 - $3),$calc($2 - $4))) / $nCr($1,$2))
}

;; $1 is total cards left in deck
;; $2 is number of cards drawn
;; $3 is number of outs in deck
;; $4 is outs required

Last edited by Sakana; 02/11/14 03:01 PM.