[R] disappointed (card model)

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Fri Oct 24 11:00:59 CEST 2003


Bjørn-Helge Mevik wrote:
> Don't be disappointed, be glad:  It gives you the opportunity to
> contribute by writing one yourself!
> 
> (Remember, R is developed by volunteers.)
> 

  Hmmmm how would this work?


 > myDeck <- deck() # create fresh deck of 52 cards

 > shuffle(myDeck)

 > myDeal <- deal(myDeck,hands=4,cards=2)  # this modifies myDeck, 
removing the dealt cards

 > myDeal[1]
[1] "Ace of Hearts" "King of Diamonds"

 > myDeal[2]
[1] "Three of Clubs" "Jack of Diamonds"

 > Flop <- deal(myDeck, cards=3, hands=1)[1]

 > Flop
[1] "Queen of Spades" "Jack of Clubs" "Ten of Diamonds"

 > bestHand(c(myDeal[1],Flop))
[1] "Straight to Ace"

 > bestHand(c(myDeal[2],Flop))
[1] "Pair of Jacks"

 > bestHand(c(myDeal[2],Flop)) > bestHand(c(myDeal[1],Flop))
[1] FALSE

- then I could write my Texas Hold'Em poker tactics in R, but I dont 
think my poker playing friends would be happy with my laptop at the 
poker table...

Baz




More information about the R-help mailing list