{"id":24752841,"url":"https://github.com/adri326/5dchess-notation","last_synced_at":"2025-10-10T23:30:41.176Z","repository":{"id":49959798,"uuid":"287779188","full_name":"adri326/5dchess-notation","owner":"adri326","description":"My attempt at a notation for 5D chess","archived":false,"fork":false,"pushed_at":"2021-07-25T10:32:30.000Z","size":535,"stargazers_count":21,"open_issues_count":3,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T03:51:01.189Z","etag":null,"topics":["5d-chess","chess-notation","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adri326.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-15T16:01:43.000Z","updated_at":"2024-12-08T07:09:07.000Z","dependencies_parsed_at":"2022-09-23T21:30:28.867Z","dependency_job_id":null,"html_url":"https://github.com/adri326/5dchess-notation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/adri326/5dchess-notation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adri326%2F5dchess-notation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adri326%2F5dchess-notation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adri326%2F5dchess-notation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adri326%2F5dchess-notation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adri326","download_url":"https://codeload.github.com/adri326/5dchess-notation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adri326%2F5dchess-notation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005573,"owners_count":26083919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["5d-chess","chess-notation","parser"],"created_at":"2025-01-28T10:51:30.620Z","updated_at":"2025-10-10T23:30:40.872Z","avatar_url":"https://github.com/adri326.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shad's 5D chess algebraic notation (5dpgn)\n\nThis is my take at an algebraic notation for [5D Chess](https://5dchesswithmultiversetimetravel.com/), which has been adopted as the standard notation for interfacing with programs, for storing games and is commonly used to write out complex moves.\nThis algebraic notation is meant to be an extension of [PGN](https://en.wikipedia.org/wiki/Portable_Game_Notation) for 5D chess.\n\nOther, publicly available notations for 5D Chess include:\n\n- [\"Axel's algebraic, a take on 5D chess notation\"](https://docs.google.com/document/d/1G456NzkPc_ZsAj3HBpdTZuTP3tP-g1k98GdoRE38E5A/view)\n- [Matrix Notation](https://drive.google.com/drive/folders/10332r6crq_pD-d4pG4VSynM8ziu1uT98)\n- [Hexicube's adaptation of Axel' AN](https://github.com/Hexicube/5D-Chess-Game-Viewer)\n- [nidlatam's notation](https://github.com/nidlatam/my-5d-chess-notation)\n- [AverageHuman's Simplified 5D Algebraic notation](https://pastebin.com/raw/EwVSTFbj)\n- [AquaBaby's analysis of several notations and proposal for a modern notation](https://docs.google.com/document/d/1-SnsdYIzrGao0ToyGXSaoEd_0tYKxYePO1C-Bp5ziXA/view)\n- [Alexbay's notation as part of their library **\\[DEPRECIATED\\]**](https://gitlab.com/alexbay218/5d-chess-js/)\n- [AquaBaby's client, written in Java and using a custom notation for both moves and FEN](https://github.com/Slavrick/5dChessGUI/)\n\nThe priorities of this notation, as of right now, are:\n\n- Accurate transcription of games (any state of the game should be able to be transcribed)\n- Ease of writing by a human\n- Ease of reading for a computer (there should be no need to hold the state of the game while initially parsing the moves)\n- Ease of reading for a human\n- Ability to convert from/to other notations\n- Ease of writing by a computer (a computer should be able to automatically transcribe any state of the game)\n\nTo accomplish this, the notation is built around the following components:\n\n- Coordinates, to describe where the pieces move from and to\n- Piece names, to describe which pieces move\n- A move notation, to describe a single move\n- A turn notation, to describe a sequence of moves\n- Headers, to store the metadata of a game, including the different variants\n\n## Included converter\n\nThis repository includes a converter and previewer. For information on how to run it and use it, check [USAGE.md](USAGE.md).\n\n## TOC\n\n- [Shad's 5D chess algebraic notation (5dpgn)](#shads-5d-chess-algebraic-notation-5dpgn)\n  - [Included converter](#included-converter)\n  - [TOC](#toc)\n  - [Vocabulary](#vocabulary)\n  - [Coordinates](#coordinates)\n  - [Moves](#moves)\n    - [Castling](#castling)\n    - [Jumps](#jumps)\n    - [Promotions](#promotions)\n    - [Inactive timeline reactivation](#inactive-timeline-reactivation)\n    - [Complex scenarios](#complex-scenarios)\n  - [Turns](#turns)\n  - [Tags](#tags)\n  - [Examples](#examples)\n    - [Rook Tactics I](#rook-tactics-i)\n    - [Knight tactics III](#knight-tactics-iii)\n    - [Actual game](#actual-game)\n  - [5DFEN and custom variants](#5dfen-and-custom-variants)\n    - [Additional Metadata](#additional-metadata)\n    - [Examples](#examples-1)\n  - [Export or minimal notation](#export-or-minimal-notation)\n    - [Export moves](#export-moves)\n    - [Export turns](#export-turns)\n  - [Hashing](#hashing)\n    - [5DFEN Strictness](#5dfen-strictness)\n    - [Examples](#examples-2)\n  - [Notes](#notes)\n    - [Even-numbered starting boards](#even-numbered-starting-boards)\n    - [Branching](#branching)\n    - [Omission](#omission)\n    - [Turn zero](#turn-zero)\n    - [FEN](#fen)\n\n## Vocabulary\n\n- A **turn** is an alternation between white's sub-turn and black's sub-turn. Each player may only make moves during their (sub-)turn. This differs from a board **step**, as playing on some boards becomes optionnal when new timelines are created.\n- A **move** happens when a player moves one of their pieces to a legal position. Moves that were not submitted with the submit button yet are referred to as **temporary moves**, but we will only consider moves that were already submitted.\n- An **actions** is a sequence of moves within a player's turn.\n- A **board** is the state of the chess board at any point in time. Each time a player moves a piece, one or two new board(s) is/are created, with the new piece disposition(s).\n- A **multiverse** or a **timeline** is an alternate version of one of the game's universe. A new multiverse is created when a piece from another dimension or from the future jumps to an already-played board. Each game starts with at least one multiverse.\n- A **jump** is when a piece moves outside of its board; if it jumps to another board whose turn is the current player's turn, no new multiverse is created. Otherwise, a new multiverse is created containing the piece that jumped.\n- A **step** is the unit of time between board states. It is made up of two **sub-steps**, each being a board in time.\n- **Physical** coordinates and moves are coordinates and moves within a single board.\n- **Super-physical** coordinates and moves are those that span across boards. Both time- and multiverse travels are super-physical moves or jumps.\n- **Check** is a state of the game where one or more pieces directly attack one or more of the opponent's kings *and* the opponent can make one or more moves to get out of this situation.\n- **Checkmate** is the state of the game where one or more pieces directly attack one or more of the opponent's kings *and* the opponent has no legal move.\n- **Softmate** is the state of the game where one or more pieces directly attack one or more of the opponent's kings *and* the opponent may only travel back in time.\n\n## Coordinates\n\nWithin a board, each tile is numbered as it would be with the classical chess notation: `a1` refers to the bottom-left corner of the board and `h8` to the top-right corner of an 8 by 8 board.\n\nBoards themselved are localized using their time coordinate (denoted in-game with `T1`, `T2`, ...) and their timeline coordinate (in-game: `L`, `1L`, `-1L`, `2L`, `-2L`).\nSince players can only interact with boards belonging to their sub-turns, it is not necessary to annotate the sub-turn of boards.\n\nSuper-physical coordinates use the following notation: `(L\u003ca\u003e T\u003cb\u003e)`, which can be shortened to `(\u003ca\u003eT\u003cb\u003e)`.\nBoth should be considered valid by parsers, though the latter is the recommended form and will be used throughout this document.\n\n`\u003ca\u003e` is the multiverse coordinate, it is an integer ranging from `-n` to `n`. Timelines created by the white player are given the next, unused positive integer; while timelines created by black are given the next, unused negative integer.\n`\u003cb\u003e` is the time coordinate, it is an integer ranging from `0` to `n'`.\n\n*Note:* On even timelines, the centermost timelines have as coordinates `-0` and `+0`. More information on this can be found in the [Notes](#notes) section.\n\n*Note:* On turn zero variants, the turn zero board(s) has as time coordinate `T0`, while the others have `T1`, `T2`, etc. On non-turn-zero variants, no board has as time coordinate `T0`.\n\n*Example:* A `Standard` game starts with one empty timeline on `L0`.\nUsing this notation, the first board of a `Standard` game is referred to as `(0T1)` or `(L0 T1)`.\n\nWhen combined with physical coordinates, super-physical coordinates are written before the physical coordinates: `(-1T6)e4` is the square `e4` on the `(L-1 T6)` board.\n\n## Moves\n\n### Physical moves\n\nPhysical moves are written the same as traditional chess [standard algebraic notation](https://en.wikipedia.org/wiki/Algebraic_notation_%28chess%29).\n\n*Note:* omissions follow similar rules, which can be found in the [Notes](#notes) section.\n\nThey *must* be preceded by their board's coordinates if there is more than one timeline at the currently described state of the game.\nIf there is only one timeline up to this point, then physical moves may be written without their corresponding board's coordinate.\n\nPiece letters are the same as standard algebraic notation, with additional letters used for fairy pieces:\n\n- `P` for **p**awn\n- `W` for bra**w**n\n- `K` for **k**ing\n- `C` for **c**ommon king (non-royal king)\n- `Q` for **q**ueen\n- `Y` or `RQ` for ro**y**al queen (the former is the recommended one)\n- `S` or `PR` for princes**s** (the former is the recommended one)\n- `N` for k**n**ight\n- `R` for **r**ook\n- `B` for **b**ishop\n- `U` for **u**nicorn\n- `D` for **d**ragon\n\nThe following informations about checks can be appended to the move:\n\n- `+` if the move checks the opponent's king\n- `*` if the move softmates the opponent's king (if the softmate is the result of a sequence of moves, the last move of that sequence should have the softmate indicator)\n- `#` if the move checkmates the opponent's king (similarly, the last move contributing to the checkmate should have the checkmate indicator)\n\n### Castling\n\nCastling moves have the same super-physical prefix requirements as normal moves.\n\nOn starting positions with the white king on `e1` and the black king on `e8`, `O-O` (using the upper case latin letter O, not the digit zero) may be used to denote castling towards `g1` and `g8` for either player, whereas `O-O-O` may be used to denote castling towards `c1` and `c8` for either player.\n\nOn starting positions with more than one king for either player or kings in other places than `e1` and `e8`, the notation `K\u003cfile_from\u003e\u003crank_from\u003e\u003cfile_to\u003e\u003crank_to\u003e` must be used. `file_from` and `rank_from` may be left out if no other king can go to `(file_to, rank_to)`.\n\n*Note:* `O-O` can be seen as a shortcut for `Ke1g1`/`Ke8g8` and `O-O-O` as a shortcut for `Ke1c1`/`Ke8c8`.\n\n### Jumps\n\nJumps use the following syntax:\n\n- The super-physical coordinate of the origin board\n- The piece's letter\n- The piece's physical coordinate\n- `\u003e\u003e` if the jump is branching, `\u003e` if the jump isn't branching\n- `x` if a piece is being taken\n- The super-physical coordinate of the target board\n- The physical coordinate of the target square\n- Promotions, if any (see [Promotions](#promotions))\n- `+`, `*` or `#` if the moves checks, softmates or checkmates the adversary\n- `~` if the jump is branching and the present is being moved to the new branch\n\nAll put together, it looks like this: `(-1T4)Nc3\u003e\u003ex(0T2)c3+~` (\"The knight from board -1L, T4, c3 jumps and takes on L, T2, c3, creating a new timeline (-2L) and moving the present\").\n\nA non-branching jump may look like this: `(0T6)Pd5\u003e(1T6)d5`.\n\n### Promotions\n\nUnderpromotion in the base game is not available, but other clients for the game have implemented underpromotion.\n\nPromotions are denoted by adding the `=` symbol at the end of the move (before `+`, `*` or `#`), followed by the piece that the pawn/brawn promotes as (`Q` for queen, `N` for knight, etc).\n\n### Inactive timeline reactivation\n\nShould a past, inactive timeline be reactivated, the following token may be put after a move to clarify where the present gets put back:\n\n`(~Tx)`, with `x` being replaced by the corresponding turn.\n\nThere is no need to precise which sub-turn it is, as the current player will have to play on any now-activated board that they may play on (leaving the present to the opponent's sub-turn after these moves), unless another branching move is made to bring the present even further back.\n\n### Complex scenarios\n\nIn complex scenarios, especially with inactive timelines being reactivated or created, it may become hard for humans to keep track of which timelines were created.\nTo aid this, one may put the following token after a move:\n\n`(\u003eLx)`, with `x` being replaced by the new timeline's index.\n\nA fully-detailled, complex move may thus look like this: `(-1T4)Nc3\u003e\u003ex(0T2)c3+ (\u003eL2) (~T1)`\n\nBoth present movement and created timeline tokens are purely for better human comprehension and should match with what can be induced from the described state of the game (if the piece of notation needs to be parsed).\n\n## Turns\n\nDuring their turn, each player may make several moves. Each move is written next to each other, separated by one or more spaces.\nSub-turns are separated by a forward slash (`/`).\n\nA turn's basic syntax is the following:\n\n- `\u003cx\u003e.` or `\u003cx\u003ew.`, with `\u003cx\u003e` being the turn number; the former is the recommended syntax for simple turns\n- White's moves\n- `/` or `\u003cx\u003eb.`; the former is the recommended syntax for simple turns\n- Black's moves\n\nSuch a turn looks like this:\n\n```\n1. (0T1)d4 / (0T1)d6\n```\n\nIn some rare cases, especially in puzzles, black's moves need to be annotated first.\nIn this case, the first turn should ommit white's moves:\n\n```\n1b. (0T10)Qg6+\n2w. (0T11)Kh1 / (0T11)Bb7+\n3. (0T12)Nf3 / (0T12)Qg6\u003e\u003e(0T8)g2#~\n```\n\n## Headers\n\nMetadata is stored as **Headers** or tags. They are formatted like PGN headers.\nA header's format is as follows:\n\n```pgn\n[HeaderName \"Header Value\"]\n```\n\n*Note:* There must be at least one space between the header name and the header value. Several headers can be on the same line, but it is recommended to put them on different lines.\n\n*Note:* The header value is encoded as a unicode string, unlike classical PGN.\n\nIt is recommended to include the metadata also used for PGN (`White`, `Black`, `Result`, `Date`, etc.); additionally, this format recommends the use of its specific headers:\n\n- `Board`: which variation was chosen (`Standard`, `Simple - No Queens`, etc.), defaults to `Standard`\n- `Size`: the size of the board (`8x8`, `7x7`, `5x5`), recommended for non-standard variants and required for custom variants\n- `Mode`: should always be set to `5D`\n- `Puzzle`: used for puzzles, to indicate what kind of puzzle it is (mate in N, aid mate, find the best move, etc.)\n- `Promotions`: a space-separated list of piece letters, describing which pieces pawns can promote into, recommended for non-standard variants and required for custom variants\n\n## Comments\n\nComments may be put within curly braces: `{}`.\nNested comments are not supported.\n\n## Full examples\n\n### Rook Tactics I\n\n```pgn\n[Size \"5x5\"]\n[Mode \"5D\"]\n\n1. (0T1)Kb2 / (0T1)Ke4\n2. (0T2)Re1 / (0T2)Kd3\n3. (0T3)Re5# {attacks (0T1)Ke5}\n```\n\n### Knight tactics III\n\n```pgn\n[Size \"5x5\"]\n[Mode \"5D\"]\n\n1. (0T1)Nd2 / (0T1)c3\n2. (0T2)Nb3 / (0T2)c2\n3. (0T3)Nb3\u003e\u003e(0T1)a3 / (1T1)Ke4\n4. (1T2)Nb5# {attacks (0T3)Kd5}\n```\n\n### Actual game\n\nFollowing is an example of a game, encoded in the described standard:\n\n```pgn\n[White \"Teln0\"]\n[Black \"Shad Amethyst\"]\n[Board \"Simple - No Queens\"]\n[Size \"7x7\"]\n[Date \"2020.08.14\"]\n[Result \"1-0\"]\n[Mode \"5D\"]\n\n1. (0T1)Nd3 / (0T1)Nc5\n2. (0T2)Nxc5+ / (0T2)bxc5\n3. (0T3)g3 / (0T3)g4\n4. (0T4)Bg2 / (0T4)d5\n5. (0T5)O-O {to the right} / (0T5)Be5\n6. (0T6)Nb1\u003e\u003e(0T5)b3 / (1T5)Bb6\n7. (1T6)Nc3 / (0T6)Ne7\u003e(1T6)e5\n8. (0T7)a4 (1T7)O-O {to the right} / (0T7)Be5\u003e\u003e(0T6)e4\n9. (-1T7)Bxe4 / (-1T7)dxe4 (1T7)c4\n10. (1T8)Nb3\u003e(0T8)d3 (-1T8)a4 / (-1T8)Bd4 (0T8)Kd7\u003e(1T8)d6\n11. (-1T9)Ra3 (0T9)Ra3 (1T9)b3 / (-1T9)Bd4\u003ex(0T9)d3 (1T9)cxb3\n12. (-1T10)d3 (0T10)cxd3 (1T10)Ba3 / (-1T10)Nd5 (0T10)Rb7 (1T10)c5?\n13. (-1T11)dxe4 (0T11)Rc3 (1T11)axb3 / (0T11)Rg5 (1T11)Ne5\u003ex(-1T11)e4\n14. (-1T12)Rd3 (0T12)d4 (1T12)b4 / (-1T12)c4 (0T12)c4 (1T12)cxb4\n15. (-1T13)Rd4 (0T13)d3 (1T13)Ba4+ / (-1T13)O-O-O {to the left} (0T13)cxd3 (1T13)Bc5\n16. (-1T14)Rxe4 (0T14)exd3 (1T14)Bxc5+ / (0T14)Bg2 (-1T14)Nd5\u003ex(1T14)c5\n17. (-1T15)Rc4 (0T15)Rc6 (1T15)Ra5 / (-1T15)e5 (0T15)Bd3+ (1T15)Ne4\n18. (-1T16)Rb4+ (0T16)Kg1 (1T16)Nxe4 / (-1T16)Kb7\u003ex(0T16)c6 (1T16)dxe4\n19. (-1T17)Rb4\u003e(1T17)b4 (0T17)Bxg5 / (-1T17)Bc4 (0T17)Bc4 (1T17)Nd5\n20. (-1T18)Be3 (0T18)Rc1 (1T18)Rd4 / (-1T18)Rd7 (0T18)Kc6\u003e(1T18)b6?\n21. (-1T19)Bb6+ {checks (1T19)d6} (0T19)Rb1 (1T19)Raxd5+ / (-1T19)c6\u003e(0T19)c6 {blocks (-1T20)Bb6\u003e\u003ex(1T20)d6 1-0} (1T19)exd5\n22. (-1T20)Bb6\u003ex(0T20)b7+ {checks (1T20)d7} (1T20)Rxd5+ / (-1T20)Bc4\u003e\u003ex(-1T18)a4\n23. (-2T19)Bb6 / (-2T19)Rb7\n24. (-2T20)Bb6\u003e\u003ex(-1T20)a6+ {checks (1T20)b6, (2T20)b6 also checks (1T19)b6} 1-0 {Black forfeits}\n```\n\nHere is what the end of that game looks like:\n\n![End of the aforementioned game](https://cdn.discordapp.com/attachments/740361438375313540/743827989321744467/unknown.png)\n\nThis is another game, between Shad and PseudoAbstractMeta, using the modern features of the notation:\n\n```pgn\n[Mode \"5D\"]\n[Board \"Standard - Half Reflected\"]\n[Size \"8x8\"]\n[White \"Shad Amethyst\"]\n[Black \"PseudoAbstractMeta\"]\n[Date \"2021.01.22\"]\n[Result \"1-0\"]\n\n1. f4 / e5\n2. f5 / f6\n3. g3 / Bd6\n4. b3? {This turned out later to be a weak move} / Qh5\n5. Bh3 / Qg5\n6. Nf3 / (0T6)Qg5\u003e\u003ex(0T4)g3+~\n7. (-1T5)hxg3 / (-1T5)e4\n8. (-1T6)e3 / (-1T6)g6?\n9. (0T7)Bh3\u003e\u003ex(0T5)h5~ / (1T5)Nc6\n10. (1T6)Be8+ / (1T6)Kxe8 {Forced}\n11. (-1T7)Ne2 (1T7)e3 / (-1T7)gxf5 (0T7)Ne7 (1T7)h5 {Forced}\n12. (0T8)Nf3\u003ex(-1T8)f5 (1T8)Nh3 / (-1T8)Qg6 (0T8)Bd6\u003e(1T8)d5\n13. (1T9)Nh3\u003e\u003ex(1T8)h5~ / (2T8)Kd8!\n14. (0T9)Rf1 (-1T9)Nxd6 (2T9)Qg4 / (-1T9)cxd6 (0T9)Ng8! {Protects (L+2)g7} (1T9)Nd4? (2T9)b6\n15. (-1T10)Ba3 (0T10)Ba3 {Threatening mate on f8} (1T10)exd4 (2T10)Ne2 {Protecting (L+1)e4} / (-1T10)f5! (0T10)d6! (1T10)b6 (2T10)Nge7\n16. (-1T11)Rg1 (0T11)Qd1\u003e(2T11)f3 (1T11)Nc3 / (-1T11)Nc6 (0T11)Nc6 (1T11)Bxh1? (2T11)Bb7\n17. (-1T12)Nf4 {Threatening the queen} (0T12)Nc3 (2T12)Rh1\u003ex(1T12)h1 / (-1T12)Qg6\u003e\u003ex(-1T9)d6~ (\u003eL-2)\n18. (-2T10)Rg1 / (-2T10)h5\n19. (-2T11)Nf4 / (-2T11)Qg5\n20. (-2T12)Qe2 / (-2T12)h4 (0T12)Nd4 (1T12)Ne7 (2T12)Kc8 {Time trouble for black}\n21. (2T13)Qg4\u003e\u003ex(2T10)g7~! (\u003eL+3) / (3T10)Bd6\u003e\u003ex(1T10)d4~ (\u003eL-3)\n22. (3T11)Qg7g6*! (-3T11)Qh5+ / (-3T11)Rxh5 (2T13)Bd6\u003e\u003ex(2T9)d2~ {One of the two legal moves, black is losing} (\u003eL-4)\n23. (-4T10)Bxd2 / 1-0 {White wins by timeout; possible continuation would have been (-4T10)d4; 24. (-4T10)Qxd4#}\n```\n\nThe final position looks like this (a dummy move was made on `(3T11)` to highlight the checks causing the softmate).\n\n![End of the second aforementionned game](https://cdn.discordapp.com/attachments/592381888778207242/802304944307961906/Screenshot_2021-01-22_23-33-02.png)\n\n## 5DFEN and custom variants\n\nYou can encode custom variants and puzzles using the 5DFEN extension of that notation.\nThe formal grammar of 5DFEN can be found in [here](./fen.ebnf) in [EBNF](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) format.\n\nTo use this extension, you need to set the board tag to `\"custom\"` and encode the initial boards as 5DFEN board strings.\n\nA board is considered initial if one of the following conditions is true:\n- it does not emanate from any other board (eg. the first board in standard)\n- there weren't any moves from the board that it emanated that would yield that board (eg. the second board in standard - turn zero)\n\nA *board string* is the 5DFEN way of describing the state of an initial board.\nA board string is enclosed within square brackets (`[]`) and is made of several fields, separated by colons (`:`).\nThere should be no spaces, as to not confuse a board string with a regular header.\n\nThe first field contains the board's pieces.\nThe different rows of the board are separated by slashes (`/`), the rows are read from top to bottom.\nEach row is a string of pieces, encoded using letters (optionally preceded by a `+`), and blanks, encoded using numbers.\n\nA white piece is encoded as an uppercase letter and a black piece as a lowercase letter.\nTo extend the number of pieces that can be encoded without sacrificing readability, a piece's corresponding letter may be *preceded*\nby a `+`.\n\nThe list of the pieces' corresponding letters is as follows:\n- `P/p` for **p**awn\n- `B/b` for **b**ishop\n- `R/r` for **r**ook\n- `N/n` for k**n**ight\n- `K/k` for **k**ing\n- `Q/q` for **q**ueen\n- `U/u` for **u**nicorn\n- `D/d` for **d**ragon\n- `S/s` for prince**s**s\n- `W/w` for bra**w**n\n- `C/c` for **c**ommon king\n- `Y/y` for ro**y**al queen\n\nBlanks are encoded using numbers:\n- If there is a one-piece blank, then it is encoded using `1`.\n- If there is a two-piece blank, then it is encoded using `2`.\n- If there is a ten-piece blank, then it is encoded using `10`.\n- If there is a N-piece blank, then it is encoded by writing `N` out in base 10.\n\nIf a piece is sensitive to having been moved already or not and hasn't moved yet, then it must be followed by an asterisk (`*`):\n- An unmoved white pawn is encoded as `P*`\n- An unmoved black king is encoded as `k*`\n\nThe other three fields are (in order):\n- Timeline, may be `-1`, `-0`, `0`, `+0`, `+1`, etc.\n- Turn, as displayed in-game, may be `0`, `1`, `2`, etc.\n- Player color, may be `w` for white and `b` for black\n\n### Additional Metadata\n\nThe following metadata fields are required to have within the headers of a game using this extension:\n\n- `Board = \"custom\"`, as to indicate that 5DFEN needs to be used\n- `Size = \"WxH\"`, with `W` the width of the boards and `H` the height of the boards\n- `Puzzle = \"mate-in-N\"`, with `N` the number of actions to be made by the current player. This is only required if the position is meant\n  as a puzzle and where a mate in N is possible. Other kinds of puzzles may also be encoded in a similar way.\n- `Promotions = \"Q,R\"`, a comma-separated list of pieces that pawns and brawns can promote to. It should be ordered from most important to least important (putting the queen/princess first is a good rule of thumb). *A default behavior has yet to be decided on.*\n\n### Examples\n\nThis is how the standard position would be encoded:\n\n```pgn\n[Size \"8x8\"]\n[Board \"custom\"]\n[r*nbqk*bnr*/p*p*p*p*p*p*p*p*/8/8/8/8/P*P*P*P*P*P*P*P*/R*NBQK*BNR*:0:1:w]\n```\n\nThis is how `Rook Tactics I` would be encoded:\n\n```pgn\n[Size \"5x5\"]\n[Puzzle \"mate-in-1\"]\n[Board \"custom\"]\n[4k/5/5/5/K1R2:0:1:w]\n\n1. Kb2 / Ke4\n2. Re1 / Kd3\n```\n\n## Export or minimal notation\n\nDepending on the usecase, the exported, formatted data may not need to or cannot contain all of the information that this notation tries to convey.\nThe following is a raw or \"minimalized\" version of this notation, which can later be parsed again into the full notation.\n\n*This raw notation is still a proposal!*\n\n### Export moves\n\nAn export move is made up of:\n\n- the super-physical coordinates of the starting board `(\u003cl\u003eT\u003ct\u003e)`\n- *the piece's letter (optional)*\n- the physical coordinates of the moving piece\n- the super-physical coordinates of the target board\n- the physical coordinates of the target square\n\nCastling is encoded as the king moving two pieces: `(0T6)Ke1(0T6)g1`. The rook's movement when castling is not annotated.\n\n### Export turns\n\nAn export turn is made up of an introductory token, which indicates which player is playing, and a set of space-separated raw moves.\n\nThe introductory token is for white `w.` and for black `b.`\n\nSuch a raw turn would thus look like:\n\n```\nw. (0T1)d2(0T1)d4\nb. (0T1)d7(0T1)d6\n```\n\n## Hashing\n\nFor certain applications, getting a hash or checksum of either the full state (all boards) or a single board is desired. To facilitate standardization, hashing both the full state and a single board should be create by the following processes.\n\n*This standard is still just a proposal and not official yet!*\n\nFor single board hashing:\n\n  1. Create the 5DFEN string of the single board, stripping any and all whitespaces (including newlines)\n  2. Feed the resulting string (encoded as UTF-8) into the MD5 message-digest algorithm\n  3. Extract the resulting hash as hexadecimal digits\n  4. Convert to UTF-8 string (alphabet characters should be lowercase)\n\nFor full state hashing:\n\n  1. Grab the 5DFEN string of all boards.\n  2. Concatenate all of these 5DFEN strings together (sorting boards by timeline (ascending) first and then by turn (ascending)), stripping any and all whitespaces (including newlines)\n  3. Feed the resulting string (encoded as UTF-8) into the MD5 message-digest algorithm\n  4. Extract the resulting hash as hexadecimal digits\n  5. Convert to UTF-8 string (alphabet characters should be lowercase)\n\n### 5DFEN Strictness\n\nFor purposes of sorting, timeline -0 is considered lower than timeline +0.\n\nFor strictness, extracting 5DFEN strings should standardize on move sensitivity. The following pieces should be marked as unmoved if needed (the rest of the pieces should not include the unmoved marking):\n\n  - Pawn\n  - Rook\n  - King\n  - Brawn\n\n### Examples\n\nFor the `Standard` variant, both the single board and full state have the same hash:\n\n```\nmd5('[r*nbqk*bnr*/p*p*p*p*p*p*p*p*/8/8/8/8/P*P*P*P*P*P*P*P*/R*NBQK*BNR*:0:1:w]')\n\n                |\n                V\n\n'd574889fd9da3f2bc65249ff27249b00'\n```\n\nFor the `Standard - Two Timeline` variant, the full state hash looks like this:\n\n```\nmd5('[r*nbqk*bnr*/p*p*p*p*p*p*p*p*/8/8/8/8/P*P*P*P*P*P*P*P*/R*NBQK*BNR*:-0:1:w][r*nbqk*bnr*/p*p*p*p*p*p*p*p*/8/8/8/8/P*P*P*P*P*P*P*P*/R*NBQK*BNR*:+0:1:w]')\n\n                |\n                V\n\n'3672761404ffcd15ae644c75401812be'\n```\n\n## Notes\n\n### Even-numbered starting boards\n\nOriginally, this notation planned to not number boards `-0` and `+0`.\nThere are some arguments for this:\n\n- Under IEEE 754, [`-0 == 0`](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Signed_zero)\n- Internally in the game, `-0` is `-1`\n\nArguments for numbering boards using `-0` and `+0` are:\n\n- The game shows you the board indices as such, making it easier to manually transcribe a game\n- The displayed timeline index gives a hint about who has or hasn't branching priority\n- It can be converted when parsed and later stored as `-0.5` and `+0.5`\n- Axel's notation, Hexicube's parser and the Matrix notation already use `-0` and `+0`\n\nThus, this notation now allows using `-0` and `+0` as starting board indices.\n\nIf `-0` and `+0` are used, the `+` sign is mandatory (just like how it's always displayed in such cases in the game).\nThe `+` sign can be omitted for other integers.\n\nThe included parser goes around the signed zero equality issue by converting during the token parsing phase `\"-0\"` to `-0.5` and `\"+0\"` to `0.5`.\nThe reverse conversion is done whenever we need to write/export the coordinates.\n\n### Branching\n\nBranching notation (as in SAN+RAV) is not yet supported, and it is unknown how it should behave with the super-physical coordinates.\nPossibilities include:\n\n- Keeping parenthesis-enclosed super-physical coordinates and simply introducing branching (both are compatible as long as token priority is introduced or if a recursive block is introduced with a space-isolated parenthesis)\n- Having square bracket-enclosed super-physical coordinates and parenthesis-enclosed branches\n- Having square bracket-enclosed super-physical coordinates *in* parenthesis-enclosed branches\n- Remove the parentheses around super-physical coordinates, at the cost of readability\n- Use indentation to indicate recursive blocks\n- Include the block depth within the turn indicator (`2w1.` or `2~1w.`, for instance)\n\n### Omission\n\nAs in SAN, parts of the source square's coordinates may be omitted.\nWhile the parser bundled here could handle omission in super-physical moves, this format requires you to specify these coordinates nonetheless.\n\nIn some cases, moving a piece to an otherwise valid square is illegal because it would put the king in check.\nIn those cases, this piece can be considered pinned and may be left out of the equation when looking for omission.\nHowever, because checks in 5D chess aren't as trivial as in traditional chess (sometimes requiring a specific move order between boards), the source square's coordinates should still be specified.\n\nThe super-physical coordinates may now be omitted in one-timeline scenarios.\nNo omissions beyond that are currently considered, but suggestions are always welcome!\n\n### Turn zero\n\nTurn zero boards have recently been introduced. They can be referenced with `T0`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadri326%2F5dchess-notation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadri326%2F5dchess-notation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadri326%2F5dchess-notation/lists"}