Over the weekend I wrote a small package to evaluate poker hands and to do some small simulations with them. If anyone is interested in looking at it, I'd appreciate comments and/or contributions.
The package is available at http://www.stats.uwo.ca/faculty/murdoch/software. (Look at the bottom of the list.) So far only the Texas Hold'em variation has been programmed. There's support for wild cards and fairly general schemes of putting together hands for evaluation, so it wouldn't be too hard to add other games. There's no support for betting or simulating different strategies, but again, if you want to write that, it should be possible. Here's a quick example, where I've asked it to simulate hands until it came up with one I won. In the first case I start with a pair of aces and won on the first hand; in the second another player started with aces, and it took 7 hands to find me a winner. poker> select.hand(pocket = card("Ah As"), players = 4) Showing: 4H 3S 2D 6S 4C Rank Name Cards Value 1 1 Self AH AS Two pair 2 2 1 8S 3C Two pair 3 3 2 QD KH Pair of 4s 4 4 3 8H 9D Pair of 4s Would win 4 person game Required 1 hand. poker> select.hand(players = list(card("Ah As"), NULL, NULL)) Showing: AD 4H 7D 2C 8S Rank Name Cards Value 1 1 Self 6H 5H Straight 2 2 1 AH AS 3 of a kind 3 3 2 AC 3C Pair of As 4 4 3 9D 6D A high Would win 4 person game Required 7 hands. Duncan Murdoch ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html