Skip to contents

Renders card codes with their suit symbols, so "CA" prints as the ace of clubs rather than as a bare string.

Usage

# S3 method for class 'sk_card'
format(x, ...)

# S3 method for class 'sk_card'
print(x, ...)

# S3 method for class 'sk_card'
x[i, ...]

Arguments

x

An sk_card object.

...

Ignored; present for consistency with the S3 generics.

i

An index, passed on to the default [ method.

Value

format() returns a character vector of pretty card labels, the same length as x, in the order x holds them. print() returns x invisibly and is called for the side effect of printing; it sorts the cards into suit blocks for reading, the way a player fans a hand, while x itself keeps its order. [ returns an sk_card object, so subsetting a hand stays a hand.

See also

Examples

format(sk_full_deck()[1:4])
#> [1] "♣7" "♣8" "♣9" "♣J"
print(sk_card("C", "A"))
#> 1 Skat card: ♣A
sk_full_deck()[1:4]
#> 4 Skat cards: ♣J ♣9 ♣8 ♣7