Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias holdem {
- if (!$1) { return }
- var %x = $sorttok($_cn($_ns($1-)),32,nr), %d = $dupe(%x), %n = $_cn(%x).c, %a = $gettok(%n,1,32), %s = $sorttok($_cn($1-),32,nr)
- if ($regex(%s,/\b(\d+?)(c|d|h|s)(?:.+?\2){4}/i)) && ($_straight(%d)) {
- var %a = $v1, %c = $regml(2), %n = $num(%a,$calc(%a - 4)).42, %n = $regsubex($regsubex(%n,/(.+?)\*1$/,14*\1),/(\d+?)(?=\*|$)/g,\1 $+ %c)
- if (* $+ %n $+ * iswm %s) { return $iif($prop == n,9. $+ %a,A $iif(%a == 14,Royal flush,Straight flush ( $+ $_cl($_cn(%a).c) high))) }
- }
- if ($regex(%x,/\b(\d+?)\s\1\s\1\s\1/)) { return $iif($prop == n,$+(8.,$zpad($regml(1),2),.,$remtok(%x,$regml(1),0,32)),4 of a kind ( $+ $_cl($_cn($regml(1)).c).s $+ )) }
- if ($regex(%x,/(\b(\d+?)\s\2.+?\b(\d+?)\s\3\s\3|\b(\d+?)\s\4\s\4.+?\b(\d+?)\s\5)/)) {
- var %a = $iif($count($regml(1),$regml(2)) == 3,$regml(2),$regml(3)), %b = $iif($count($regml(1),$regml(2)) == 2,$regml(2),$regml(3))
- return $iif($prop == n,$+(7.,%a,.,%b),A Full house ( $+ $_cl($_cn(%a).c).s over $_cl($_cn(%b).c).s $+ ))
- }
- if ($regex(%s,/(\d+?)(c|d|h|s)(?:.+?\2){4}/i)) { return $iif($prop == n,6. $+ $regml(1),A Flush of $_sl($regml(2)).s ( $+ $_cl($_cn($regml(1)).c) high $+ ) ) }
- if ($_straight(%d)) { %a = $v1 | return $iif($prop == n,5. $+ %a,A Straight ( $+ $_cl($_cn(%a).c) high $+ )) }
- if ($regex(%x,/\b(\d+?)\s\1\s\1/)) { return $iif($prop == n,$+(4.,$zpad($regml(1),2),.,$zpad($gettok($remtok(%x,$regml(1),0,32),1,32),2)),A set of $_cl($_cn($regml(1)).c).s)) }
- if ($regex(%x,/\b(\d+?)\s\1.+?\b(\d+?)\s\2/)) { return $iif($prop == n,$+(3.,$zpad($regml(1),2),.,$zpad($regml(2),2),.,$zpad($gettok($remtok($remtok(%x,$regml(2),0,32),$regml(1),0,32),1,32),2)),Two pair ( $+ $_cl($_cn($regml(1)).c).s and $_cl($_cn($regml(2)).c).s $+ )) }
- if ($regex(%x,/\b(\d+?)\s\1/)) { return $iif($prop == n,$+(2.,$zpad($regml(1),2),.,$zpad($gettok($remtok(%x,$regml(1),0,32),1,32),2)),A pair of $_cl($_cn($regml(1)).c).s) }
- return $iif($prop == n,1. $+ $zpad($gettok(%x,1,32),2),$_cl(%a) high)
- }
- alias _straight {
- var %x = 1, %y = $numtok($1-,32), %a, %n
- while (%x <= %y) {
- %n = $gettok($1-,%x,32)
- %a = $iif(%n == 5 && 14 isin $1-,$num(%n,$calc(%n - 3)).32,$num(%n,$calc(%n - 4)).32)
- if (%a isin $1-) { return $gettok(%a,1,32) }
- else { inc %x }
- }
- return $false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement