Description Usage Arguments Value Author(s) Examples
Sees if you have a straight, and if so, finds the strength of your hand. Used by handeval().
1 | straight1(x)
|
x |
returns the highest card of your straight, or 0 if you don't have one.
Frederic Paik Schoenberg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(x){
a1 = sort(unique(x))
if (length(a1)<4.5) return(0)
a3 = 0
n = length(a1)
if(a1[n] == 14) a1 = c(1,a1) ## count ace as both 1 and 14
a2 = length(a1)
for(j in c(5:a2)){ ## j will be the potential highest card of straight
if( sum(15^c(1:5) * a1[(j-4):j]) == sum(15^c(1:5) * ((a1[j]-4):a1[j]))) a3 = a1[j]
}
a3
} ## end of straight1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.