Go

Version 1.5.2 of piecepackr comes with built-in configurations for Go boards and stones in a variety of colors and sizes via the game_systems() function. Here are some example diagrams for a game of Multi-player go:

library("dplyr", warn.conflicts=FALSE)
library("tibble")
library("piecepackr")

dfb <- tibble(piece_side = "board_face", x=10, y=10, suit=2)
dfB <- tibble(piece_side = "bit_face",
              x = c(2,2,2, 3,3, 4,4, 5,5, 6,6,6, 7,7, 8),
              y = c(11,13,14, 12,15, 13,16, 12,16, 12,13,16, 15,17, 16),
              suit = 4)
dfR <- tibble(piece_side = "bit_face",
              x = c(3,3, 4, 5, 6, 7, 8,8, 9),
              y = c(2:3, 4, 3, 4, 4, 2:3, 2),
              suit = 1)
dfY <- tibble(piece_side = "bit_face",
              x = 20 - c(3, 4, 5,5, 7, 8, 9,9,9),
              y = 20 - c(3, 2, 2:3, 2, 5, 2:4),
              suit = 5)
dfG <- tibble(piece_side = "bit_face",
              x = 20 - c(3,3,3,3,3, 4,4,4,4, 5,5,5, 6,6),
              y = c(4,5,7,12,13, 6,7, 10,11, 7,9,10, 8,9),
              suit = 3)
dfK <- tibble(piece_side = "bit_face",
              x = c(rep(2,5), rep(3,5), rep(4,4), rep(5,5),
                    rep(6,2), rep(7,4), rep(8,7), rep(9,5),
                    rep(10,5), rep(11,4), rep(12,5),
                    rep(13,6), rep(14,2), rep(15,6),
                    rep(16,6), rep(17,2)),
              y = c(2:3,8:9,12, 4:5,10,13:14, 5,10,14:15, 6,8,10:11,14, 5,11,
                    5,7,12,14, 4,7,9,11:13,15, 3:4,11,14,16, 8:9,14:16,
                    3,6,8,15, 9:11,16,18, 6,8:9,11:12,16, 6:7,
                    5:6,8,11:12,16, 3,5,12,14,16:17, 3,16),
              suit = 2)
dfW <- tibble(piece_side = "bit_face",
              x = c(3:5, rep(6,3), rep(7,3), rep(8,2), rep(9,5),
                    rep(10,3), rep(11,4), rep(12,4), rep(13,2), 14),
              y = c(9,9,9, 7:8,10, 8,10:11, 8,10, 8:10,12:13, 10:11,13,
                    9,11,13:14, 7:8,12:13, 7,10, 11),
              suit = 6)
df <- bind_rows(dfb, dfB, dfR, dfY, dfG, dfK, dfW)

cfg <- game_systems()$go
pmap_piece(df, cfg=cfg, default.units="in")
2D Multi-player Go diagram

2D Multi-player Go diagram

It is recommended when plotting go stones in rgl to set lit=TRUE:

library("rgl")
open3d()
## glX
##   1
bg3d("white")
if (Sys.which("wmctrl") != "") system("wmctrl -r RGL -e 0,-1,-1,1080,1080")
view3d(phi=-30, zoom = 0.8)
cfg <- game_systems("sans3d")$go
pmap_piece(df, piece3d, cfg=cfg, trans=op_transform, lit=TRUE)
3D Multi-player Go diagram

3D Multi-player Go diagram

Comments


There are no comments yet.

Add a Comment

You can use Markdown or restructuredText to format your comment.

links

social