]> gitweb.factorcode.org Git - factor.git/commitdiff
Make a deck of cards an actual tuple
authorAaron Schaefer <aaron@elasticdog.com>
Thu, 7 May 2009 01:44:25 +0000 (21:44 -0400)
committerAaron Schaefer <aaron@elasticdog.com>
Thu, 7 May 2009 01:44:25 +0000 (21:44 -0400)
extra/poker/poker.factor

index 15e9a96d42f55d52d9a43f8ce991db7eca164fae..b4353dc92528cdeed175f779fb3a1e5c9c372dbd 100644 (file)
@@ -194,8 +194,12 @@ M: hand equal?
 : >value ( hand -- str )
     hand-rank VALUE_STR nth ;
 
+TUPLE: deck
+    { cards sequence } ;
+
 : <deck> ( -- deck )
-    RANK_STR SUIT_STR 2array [ concat >ckf ] product-map ;
+    RANK_STR SUIT_STR 2array [ concat >ckf ] product-map deck boa ;
 
-ALIAS: shuffle randomize
+: shuffle ( deck -- deck )
+    [ randomize ] change-cards ;