diff options
| author | Nicolas Paul <n@nc0.fr> | 2024-03-18 10:26:47 +0100 |
|---|---|---|
| committer | Nicolas Paul <n@nc0.fr> | 2024-03-18 10:26:47 +0100 |
| commit | 0b128bff80119216f87326137083c735383b28b2 (patch) | |
| tree | 3e2d24d624c528ce4d5bd5840d3d75e9ab9bccd9 | |
| parent | 2ff19a1f8ac10e629effb4e0db42f7320f2a97dd (diff) | |
Add README.md documentation for the @life2/format
Signed-off-by: Nicolas Paul <n@nc0.fr>
| -rw-r--r-- | life2/format/README.md | 57 | ||||
| -rw-r--r-- | life2/format/package.json | 2 |
2 files changed, 58 insertions, 1 deletions
diff --git a/life2/format/README.md b/life2/format/README.md index e69de29..16958ff 100644 --- a/life2/format/README.md +++ b/life2/format/README.md @@ -0,0 +1,57 @@ +# `@life2/format` + +[`@life2/format`][pkg-npm] is a JavaScript package to parse and load artifacts +of [Life2 games][life2] stored in the Life2 Text Format (*L2TF*) dynamically. + +The Life2 Text Format serves as a simple and readable way of storing and +sharing specific states of a board at any given time. We used it during the +study to share states we considered important with everyone member of the team. + +The file format itself is really simple: + +- Each line of a 2D board corresponds to a line in the file (with no regard to + the line delimiter used, even tho we recommend using Linux `LF` only). +- Empty cells are represented by dots (`.`), barrier cells are hash symbols + (`#`), and cells from a team are represented by the team name in lowercase + (`a` or `b`). + +For instance, the following board in JavaScript + +```javascript +const board = [[3, 3, 3, 3, 3, 3, 3, 3, 3], + [3, 0, 1, 0, 0, 0, 0, 2, 3], + [3, 0, 1, 0, 1, 2, 2, 2, 3], + [3, 0, 0, 1, 1, 2, 1, 1, 3], + [3, 0, 0, 0, 2, 2, 2, 0, 3], + [3, 3, 3, 3, 3, 3, 3, 3, 3]]; // 9x6 +``` + +can be represented in L2TF as: + +```text +######### +#.a....b# +#.a.abbb# +#..aabaa# +#...bbb.# +######### +``` + +[pkg-npm]: https://npmjs.com/package/@life2/format +[life2]: https://github.com/nc0fr/life2.git + +## Installation + +The `@life2/format` package is distributed via [NPM][npm]. It can be installed +using: + +```shell +npm install @life2/format +``` + +[npm]: https://npmjs.com + +## Legal + +`@life2/format` is part of the Life2 project and is governed by the Apache +License, Version 2.0. diff --git a/life2/format/package.json b/life2/format/package.json index 506eded..5ff597c 100644 --- a/life2/format/package.json +++ b/life2/format/package.json @@ -1,6 +1,6 @@ { "name": "@life2/format", - "version": "1.0.0", + "version": "1.0.1", "description": "Textual representation format of a Life2 board state.", "keywords": [ "cellular", |
