Poker Dealer

Platform:  mIRC
Published  Aug 06, 2012
Updated  Aug 06, 2012
hit !deal and bot shall deal a complete random hand.
if you want more cards per hand just change the line

Code

 
to .. whatever. on *:text:!deal*:#:{ dealcards $chan }
alias dealcards {
var %figures A,K,Q,J
var %faces ♥,♦,♣,♠
var %numbers 8
var %cards 5
;figure-to-face rate = if random from 1 till %figtofacemax is bigger than %figtofacelim
;then it's a figure, otherwise it's a number
var %figtofacelim 1
var %figtofacemax 2
while (%cards) {
var %number $rand(2,%numbers)

var %x $numtok(%figures,44)
var %fig-rand $rand(1,%x)
var %figure $gettok(%figures,%fig-rand,44)

var %x $numtok(%faces,44)
var %face-rand $rand(1,%x)
var %face $gettok(%faces,%face-rand,44)

;figure-or-number rate
var %y $rand(1,%figtofacemax)
if (%y > %figtofacelim) set %hand %hand $+(%figure,%face)
else set %hand %hand $+(%number,%face)

dec %cards
}
msg $iif($1,$1,$active) dealt hand: %hand
unset %hand
}

Comments

Sign in to comment.
boxhead   -  Aug 16, 2012
I changed "var %numbers 8" to "var %numbers 10". That way it covers all cards - numbers and faces. However, sometimes it will deal the same card twice. Is there a fix for this?
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.