#' Detect the existance of a full house
#'
#' @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 full house itself if there is one.
#' @export
#'
exists_full <- function(cards){
three_kind <- exists_n_kind(cards,3)
if(!three_kind$logical) return(list("logical" = FALSE))
three_kind <- three_kind$cards
#Now need to remove the 3 of a kind from `cards` to test
#for a pair.
cards <- remove_cards(cards,three_kind)
pair <- exists_n_kind(cards,2)
if (pair$logical){
pair <- pair$cards
cards <- c(three_kind,pair)
return(list("logical" = TRUE,"cards" = cards))
}
return(list("logical" = FALSE))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.