knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "readme-fig/README-" )
knitr::opts_chunk$set(echo = TRUE)
library(gogamer) library(magrittr) stateat(mimiaka, 127) %>% plot()
Install by
devtools::install_github("kota7/gogamer")
Use by
library(gogamer)
read_sgf
reads a text file written in sgf format, and creates a gogame
class object.
x <- read_sgf(system.file("extdata/mimiaka.sgf", package = "gogamer")) class(x) print(x)
stateat
function shows the board configuration at an arbitrary move number,
# argument 'at' specifies the move number stateat(x, at = 127)
and plotat
function draws the image.
plotat(x, at = 127)
The image object inherits ggplot
,
hence you can save it with ggsave
function.
library(ggplot2) ggsave("goimage.pdf", width = 5, height = 5)
Images are fully customizable.
plotat(x, at = 127, boardcolor = "gray15", gridcolor = "gray85", starcolor = "gray85", blackcolor = "black", whitecolor = "white", stonelinecolor = "gray50", axislabels = FALSE, lastmovemarker = 2)
kifu
function creates an one-page kifu object, which prints on the console as below.
kifu(x, from = 1, to = 50)
kifuplot
function draws the image.
Again, the object supports ggsave
function.
kifuplot(x, from = 1, to = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.