rchess provides chess move generation and validation, piece placement and
movement, game-state inspection, and board visualization from R. It wraps the
bundled chess.js library and includes both
an HTML widget and a ggplot2 board renderer.
Package status:
rchesswas archived on CRAN on November 14, 2023. Install the maintained development version from GitHub while a new CRAN release is prepared.
Install the development version with pak:
pak::pak("jbkunst/rchess")library(rchess)
game <- Chess$new()
game$moves()
game$move("e4")$move("e5")
game$fen()
game$history()Render the current position as an interactive HTML widget:
plot(game)Or return a ggplot2 board:
plot(game, type = "ggplot")Detailed move history is returned as a modern tibble:
game$history(verbose = TRUE)
game$history_detail()For a complete walkthrough—based on the original gh-pages example—see the
complete rchess tour.
The full function reference and examples are available on the pkgdown website. The site uses this Markdown document as its home page, so GitHub and the package documentation stay aligned.
Issues and pull requests are welcome in the GitHub repository.