diff --git a/extra/poker/poker.factor b/extra/poker/poker.factor index b4353dc925..df8d93d9fa 100644 --- a/extra/poker/poker.factor +++ b/extra/poker/poker.factor @@ -2,8 +2,8 @@ ! The contents of this file are licensed under the Simplified BSD License ! A copy of the license is available at http://factorcode.org/license.txt USING: accessors arrays ascii binary-search combinators kernel locals math - math.bitwise math.order poker.arrays random sequences sequences.product - splitting ; + math.bitwise math.combinatorics math.order poker.arrays random sequences + sequences.product splitting ; IN: poker ! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with @@ -194,6 +194,9 @@ M: hand equal? : >value ( hand -- str ) hand-rank VALUE_STR nth ; +: best-hand ( str -- hand ) + " " split 5 all-combinations [ " " join ] map infimum ; + TUPLE: deck { cards sequence } ;