#' Detects and return the existence of nKind
#'
#' @param cards A list of objects from the S4 class 'card'.
#'
#' @return A list containing a logical representing if there is a flush,
#' and the n-kind itself if there is one.
#' @export
#'
#' @examples
exists_n_kind <- function(cards,n){
groups <- group_cards(cards)
for (i in 1:length(groups)){
cards <- groups[[i]]
if (length(groups[[i]]) >= n) return(list("logical" = TRUE,"cards" = cards[1:n]))
}
return(list("logical"=FALSE))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.