Fork me on GitHub

Game starting arrangement functions

The package ppgames contains functions that generate the starting piece arrangements for several piecepack games. These functions return data frames that can be used directly with piecepackr::pmap_piece or ppgames::cat_piece to generate piecepack game diagrams or they can be used with ppgames' Portable Piecepack Notation parser read_ppn to initially setup the game pieces.

Directly generating starting diagrams

The game start functions all return a data frame that can be used directly with piecepackr::pmap_piece or ppgames::cat_piece:

library("ppgames")
cat_piece(df_fide_chess())
Unicode text diagram for Chess
download.file("https://trevorldavis.com/piecepackr/share/demo_cfgs.RData")
cfgs <- new.env()
load("demo_cfgs.RData", envir=cfgs)
pmap_piece(df_fide_chess(), cfg=cfgs$chess5, op_scale=0.5,
           trans=op_transform, default.units="in")
3D diagram for Chess

Use with Portable Piecepack Notation

The game start functions can also be used with Portable Piecepack Notation to initially set the game pieces via the metadata field GameType:

GameType: Four Field Kono

1. b1:b3 1... d3:b3 2. c1:c3 2... a3:c3 3. c2-c1 3... b4:b2 4. a1-b1 4... b3:b1
5. d1:b1 5... c3-c2 6. a2-a3 6... b2:d2 7. a3-b3 7... c4-c3 8. c1-d1 8... d4-d3
9. b1-b2 9... d2:b2 10. b3-a3 10... b2-b1 {Player 1's loss is assured with the
 separation of their two remaining pieces and they should resign in a real game}
11. a3-a2 11... b1-c1 12. d1-d2 12... c1-d1 13. a2-a3 13... a4-b4
14. a3-a4 14... b4-c4 15. a4-b4 15... c4-d4 16. b4-a4 16... d4:d2 {Player 2 wins}
Four Field Kono example

It is also possible to pass in arguments to the game start function by passing a "mapping" to the GameType field:

---
GameType:
  Name: Fujisan
  Coins: "44452n24n3aa/a25335325ann"
...
1. a1-b1 2. n2-k2 3. b1-e1 4. e1-j1 5. j1-j2 6. j2-l2 7. k2-m2
8. m2-m1 9. l2-l1 10. n1-k1 11. m1-i1 12. i1-d1 13. d1-d2 14. l1-i1
15. i1-i2 16. k1-k2 17. k2-e2 18. i2-c2 19. a2-f2 20. e2-h2 21. h2-g2
22. c2-h2 23. h2-h1 24. d2-h2 25. f2-b2 26. b2-b1 27. b1-g1
Animation of a Fuji-san game

Table of Supported Game Start Functions

Game Start Functions
game df_names ruleset comment
Alice Chess df_alice_chess X  
Alien City df_alien_city    
Alquerque df_alquerque    
Awithlaknannai Mosona df_awithlaknannai_mosona    
Backgammon df_backgammon X  
Breakthrough df_breakthrough    
Cell Management df_cell_management   Not very PPN friendly
Chaturaji df_chaturaji    
(American) Checkers df_american_checkers, df_english_draughts, df_checkers X  
(International) Chess df_international_chess, df_chess X  
Cribbage (Board) df_cribbage_board X Just a (piecepack) cribbage board (no cards)
Crossings df_crossings    
Desfases df_desfases    
Everest df_everest    
Four Field Kono df_four_field_kono X  
Four Seasons Chess df_four_seasons_chess X  
Froggy Bottom df_froggy_bottom    
Fujisan df_fujisan    
Ice Floe df_ice_floe    
Ley Lines df_ley_lines    
Lines of Action df_lines_of_action    
Nine Men's Morris df_nine_mens_morris X  
Plans of Action df_plans_of_action    
Rect Board Tiles df_rect_board_tiles   Makes a rectangular board made from tiles
Relativity df_relativity    
Salta df_salta    
San Andreas df_san_andreas    
Shogi (Japanese Chess) df_shogi    
Tablut df_tablut X  
The "In" Crowd df_the_in_crowd    
Triactor df_triactor    
Turkish Draughts df_turkish_draughts    
Twelve Men's Morris df_twelve_mens_morris X  
Ultima df_ultima, df_baroque_chess X  
Xiangqi (Chinese Chess) df_xiangqi X  
Wormholes df_wormholes    
Some games supported in ppgames

Some games supported in ppgames

Comments


There are no comments yet.

Add a Comment

You can use Markdown or restructuredText to format your comment.

links

social