knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "readme-fig/README-"
)
knitr::opts_chunk$set(echo = TRUE)

Build Status CRAN Status

gogamer: R Package for Go Game Data

library(gogamer)
library(magrittr)
stateat(mimiaka, 127) %>% plot() 

Installation and import

Install by

devtools::install_github("kota7/gogamer")

Use by

library(gogamer)

Functionalities

Read sgf file

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)

Game snapshot

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 document

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)


kota7/gogamer documentation built on May 20, 2019, 1:10 p.m.