cat_piece() generates plaintext piecepack diagrams and
outputs them using base::cat(). cat_move() generates
a plaintext diagram for a move within a game. cat_game()
renders an animation of a game in the terminal.
Usage
cat_piece(
df,
color = NULL,
reorient = "none",
annotate = FALSE,
...,
file = "",
annotation_scale = NULL,
style = c("Unicode", "Game Bit Mono", "Game Bit Duo")
)
cat_move(game, move = NULL, ...)
cat_game(game, ..., fps = 1)Arguments
- df
Data frame containing piece info.
- color
How should the text be colorized. If
FALSEwon't colorize output at all. If"html"will colorize output for html. Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences.- reorient
Determines whether and how we should reorient (the angle) of pieces or symbols:
The default "none" (or
FALSE) means don't reorient any pieces/symbols."all" (or
TRUE) means setting the angle to zero for all pieces (reorienting them all “up”)."symbols" means just re-orient suit/rank symbols but not the orientation of the piece itself. In particular, in contrast with "all" this preserves the location of the upper-left "corner" of piecepack tile faces.
- annotate
If
TRUEor"algebraic"annotate the plot with “algrebraic” coordinates, ifFALSEor"none"don't annotate, if"cartesian"annotate the plot with “cartesian” coordinates.- ...
Passed to
cat()- file
fileargument ofcat(). Default ("") is to print to standard output.NULLmeans we don'tcat()- annotation_scale
Multiplicative factor that scales (stretches) any annotation coordinates. By default uses
attr(df, "scale_factor") %||% 1.- style
If "Unicode" (default) only use glyphs in Unicode proper. If "Game Bit Duo" use glyphs in Private Use Area of "Game Bit Duo" font. If "Game Bit Mono" use glyphs in Private Use Area of "Game Bit Mono" font.
- game
A list containing a parsed ppn game (as parsed by
read_ppn)- move
Which move to cat game state (after the move, will use
game$dfs[[move]]) unlessNULLin which case will cat the game state after the last move.- fps
Frames per second.
See also
See https://github.com/trevorld/game-bit-font for more information about the “Game Bit” family of fonts.