summaryrefslogtreecommitdiff
path: root/package.json
AgeCommit message (Collapse)Author
2024-03-09format: Add L2TF implementationNicolas Paul
(A spec might come later) The Life2 Text Format (L2TF) is a ASCII-based file format that allows the sharing of a Life2 board easily. The format is designed to be easy to parse by both machines and humans, as it is pretty natural, reprensenting a grid as a set of lines. As said in the beginning, the format is currently only defined in the index.js file, however a specification will be done later (probably during the week), for now, this is enough. Currently, the format is composed of the following: CELL KIND CHARACTER UINT8 REPR EMPTY . 0 TEAM_A a 1 TEAM_B b 2 BARRIER # 3 A grid is supposedly a set of lines composed of the aforementionned characters, for illustration, a Boad like the following: 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 will be represented in the following file: (file: //.../board.l2tf) #########\n #.a....b#\n #.a.abbb#\n #..aabaa#\n #...bbb.#\n #########\n The current implementation, in JavaScript, exposes only three elements: two functions and a string-based C-like enumeration. The API is really simple, only being based on the parse() and stringify() methods. JavaScript experts may recognize a similar pattern as the standard JSON API available. A typical user flow of the system may be: import * as Life2 from '@life2/game'; import * as L2TF from '@life2/format'; const game = new Life2.World(...); // ... init game // Save the current board state in a file to share it with others const curr = game.board.getGrid(); const text = L2TF.stringify(curr); shareFile(new File(text)); Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-08Add World library facadeNicolas Paul
The World class is a Facade pattern which manages the main logic of the Life2 simulation game: iterating over the board given a set of rules. The World class mainly represents a single simulation. Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-08Move NPM projets to the @life2 scopeNicolas Paul
I have reserved the @life2 scope on the NPM registry to allow publishing our packages, which is required for the game to work. Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-05Fix Clang-Format command in NPM ScriptsNicolas Paul
The previous command was not finding the files to format, making Clang-Format always fail in CI even tho everything was correct. Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-05Fix ESLint googlejsNicolas Paul
GoogleJS ESlint configuration was actually named "closure" and not GoogleJS, as Closure is the public name for JSCompiler. Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-04Configure ESLintNicolas Paul
ESLint is a popular linting framework and static analyzer in the JavaScript Ecosystem. Our configuration follows the Google JavaScript Style Guide, as seen in issues. Closes: https://github.com/nc0fr/life2/issues/4 Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-03-04Make the project Open Source under APL2Nicolas Paul
Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-02-22simulator: Initialisation du projetNicolas Paul
Simulator est une application orientée Web complexe permettant l'exécution et l'étude d'automates cellulaires dans le style du jeu de la vie. Grâce à des fonctionnalités d'étude en temps réel, le système pourra permettre la gestion (ajout, suppression, ...) de règles durant l'exécution, ainsi que la modification des états de cellules (assigner des "équipes", bloquer une cellule sur un état perpetuelle, ...). Signed-off-by: Nicolas Paul <n@nc0.fr>
2024-02-22Création du workspace NPMNicolas Paul
Un Workspae NPM permet d'utiliser l'écosystème de module de NPM au sein d'un monorepo. Signed-off-by: Nicolas Paul <n@nc0.fr>