From 0878006bd0d7b783062272a0eef1b57663995c59 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Thu, 7 May 2009 10:29:44 -0400 Subject: [PATCH] Speed up best-hand by not converting to ckf repeatedly --- extra/poker/poker.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/poker/poker.factor b/extra/poker/poker.factor index df8d93d9fa..a749be239b 100644 --- a/extra/poker/poker.factor +++ b/extra/poker/poker.factor @@ -195,7 +195,8 @@ M: hand equal? hand-rank VALUE_STR nth ; : best-hand ( str -- hand ) - " " split 5 all-combinations [ " " join ] map infimum ; + parse-cards 5 all-combinations + [ dup hand-value hand boa ] map infimum ; TUPLE: deck { cards sequence } ;