Advertisement
Flip

Untitled

May 21st, 2011
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.28 KB | None | 0 0
  1. alias holdem {
  2.   if (!$1) { return }
  3.   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)
  4.   if ($regex(%s,/\b(\d+?)(c|d|h|s)(?:.+?\2){4}/i)) && ($_straight(%d)) {
  5.     var %a = $v1, %c = $regml(2), %n = $num(%a,$calc(%a - 4)).42, %n = $regsubex($regsubex(%n,/(.+?)\*1$/,14*\1),/(\d+?)(?=\*|$)/g,\1 $+ %c)
  6.     if (* $+ %n $+ * iswm %s) { return $iif($prop == n,9. $+ %a,A $iif(%a == 14,Royal flush,Straight flush ( $+ $_cl($_cn(%a).c) high))) }
  7.   }
  8.   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 $+ )) }
  9.   if ($regex(%x,/(\b(\d+?)\s\2.+?\b(\d+?)\s\3\s\3|\b(\d+?)\s\4\s\4.+?\b(\d+?)\s\5)/)) {
  10.     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))
  11.     return $iif($prop == n,$+(7.,%a,.,%b),A Full house ( $+ $_cl($_cn(%a).c).s over $_cl($_cn(%b).c).s $+ ))
  12.   }
  13.   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 $+ ) ) }
  14.   if ($_straight(%d)) { %a = $v1 | return $iif($prop == n,5. $+ %a,A Straight ( $+ $_cl($_cn(%a).c) high $+ )) }
  15.   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)) }
  16.   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 $+ )) }
  17.   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) }
  18.   return $iif($prop == n,1. $+ $zpad($gettok(%x,1,32),2),$_cl(%a) high)
  19. }
  20. alias _straight {
  21.   var %x = 1, %y = $numtok($1-,32), %a, %n
  22.   while (%x <= %y) {
  23.     %n = $gettok($1-,%x,32)
  24.     %a = $iif(%n == 5 && 14 isin $1-,$num(%n,$calc(%n - 3)).32,$num(%n,$calc(%n - 4)).32)
  25.     if (%a isin $1-) { return $gettok(%a,1,32) }
  26.     else { inc %x }
  27.   }
  28.   return $false
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement