Bukz

Cards Concept

Mar 15th, 2011
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. alias cards_d [ 2Ace|C| 3Ace|D| 7Ace|H| 9Ace|S| 2King|C| 3King|D| 7King|H| 9King|S| 2Queen|C| 3Queen|D| 7Queen|H| 9Queen|S| 2Jack|C| 3Jack|D| 7Jack|H| 9Jack|S| 210|C| 310|D| 710|H| 910|S| 29|C| 39|D| 79|H| 99|S| 28|C| 38|D| 78|H| 98|S| 27|C| 37|D| 77|H| 97|S| 26|C| 36|D| 76|H| 96|S| 25|C| 3|D|5 75|H| 95|S| 24|C| 34|D| 74|H| 94|S| 23|C| 33|D| 73|H| 93|S| 22|C| 32|D| 72|H| 92|S|]
  2. // alias strstr_list [Ace King Queen Jack 10 9 8 7 6 5 4 3 2]
  3. alias dealt []
  4.  
  5. alias get_valid_card [
  6.   if (>= (listlen $dealt) 52) [alias dealt []; echo Shuffling the deck...]
  7.   new_c = (at $cards_d (rnd (listlen $cards_d)))
  8.   if (strstr $dealt $new_c) [get_valid_card] [
  9.     add2list dealt $new_c
  10.     result $new_c
  11.   ]
  12. ]
  13.  
  14. alias deal [
  15.   alias hand []
  16.   loop dll $arg1 [add2list hand (get_valid_card)]
  17.   echo $hand
  18. ]
Advertisement
Add Comment
Please, Sign In to add comment