! Copyright (c) 2009 Aaron Schaefer. All rights reserved. ! 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 formatting fry kernel math math.combinatorics poker poker.private sequences sequences.product ; IN: benchmark.poker-hands ! Test the evaluator by generating all 2,598,960 possible five card hands, ! calculating each hand's distinct value, and displaying the frequency count of ! each hand type. ! Most of the time is spent generating the 52 5 nCk combinations of hands. : poker-hands ( -- ) 5 9 0 [ '[ hand-value value>rank _ [ 1 + ] change-nth ] each-combination ] keep print-frequency ; MAIN: poker-hands