From ac522526e753b08e6de84dd1281dd2713406e3db Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Fri, 15 Dec 2023 18:16:58 -0800 Subject: [PATCH] Add replay specification --- REPLAY.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 REPLAY.md diff --git a/REPLAY.md b/REPLAY.md new file mode 100644 index 0000000..06b3902 --- /dev/null +++ b/REPLAY.md @@ -0,0 +1,54 @@ +# Specification of bgammon.org replay file + +Replays are stored as .match files. + +## Match format (.match) + +A .match file contains one or more games concatenated together. + +The games are prefixed with a table listing the index of each game. + +### Index table + +The index table consists of one or more lines in the following format: + +`bgammon-replay ` + +Games are in chronological order. +The index specifies the index of the first byte of the first line of a game. +The index is always eight digits with leading zeroes. + +### Game + +#### Metadata + +The first line of the file specifies the metadata. + +`i ` + +#### Index table + +The index table consists of one or more lines in the following format: + +`g ` + +The index specifies the index of the first byte of each line corresponding to each turn in the game. +The index is always eight digits with leading zeroes. + +#### Events + +##### Double + +Accepted: + +`d 2 1` + +Declined: + +`d 2 0` + +##### Roll and move + +Moves are always specified from player 1's perspective. + +`r 5-3 13/8 24/21`