[R] card games

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Oct 23 01:04:34 CEST 2008


2008/10/22 Erin Hodgess <erinm.hodgess at gmail.com>:
> This is for programming purposes.
>
> I wanted my students to do some games, but I wanted to see if there
> were items already out there.

 A quick googling (oooh, if ONLY R was called something more googly!)
found Duncan Murdoch's poker package:

http://www.stats.uwo.ca/faculty/murdoch/repos/html/pokerv0.0.html

 v0.0 could give your students something to start on. It has some card
handling and shuffling packages as well as hand evaluations.

 Here's my poker calculator:

 action = function(hand, bet, cash){
   if(rubbish(hand)){
      drink() ; drink()
      if(drunk()) {
         return(bluff)
          }else{
         return(fold)
       }
   } else {
    drink()
    bet = runif(1,min,max)
    return(bet)
   }
}

 It's a pretty accurate simulation. *hic*

Barry



More information about the R-help mailing list