Add >5 card evaluator word to poker vocab
parent
5e4e1ee48f
commit
e2c73b543a
|
@ -2,8 +2,8 @@
|
||||||
! The contents of this file are licensed under the Simplified BSD License
|
! 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
|
! A copy of the license is available at http://factorcode.org/license.txt
|
||||||
USING: accessors arrays ascii binary-search combinators kernel locals math
|
USING: accessors arrays ascii binary-search combinators kernel locals math
|
||||||
math.bitwise math.order poker.arrays random sequences sequences.product
|
math.bitwise math.combinatorics math.order poker.arrays random sequences
|
||||||
splitting ;
|
sequences.product splitting ;
|
||||||
IN: poker
|
IN: poker
|
||||||
|
|
||||||
! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with
|
! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with
|
||||||
|
@ -194,6 +194,9 @@ M: hand equal?
|
||||||
: >value ( hand -- str )
|
: >value ( hand -- str )
|
||||||
hand-rank VALUE_STR nth ;
|
hand-rank VALUE_STR nth ;
|
||||||
|
|
||||||
|
: best-hand ( str -- hand )
|
||||||
|
" " split 5 all-combinations [ " " join <hand> ] map infimum ;
|
||||||
|
|
||||||
TUPLE: deck
|
TUPLE: deck
|
||||||
{ cards sequence } ;
|
{ cards sequence } ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue