This is an editor and viewer for Portable Tak Notation (PTN). It aims to be...
- Useful for transcription of live games, even on a phone.
- Intuitive, with a minimal UI that is enjoyable to use.
- Responsive, with a fluid design that works as well on a phone as it does in full-screen on a desktop.
- Quasar: https://v1.quasar.dev/quasar-cli/installation
- Firebase: https://firebase.google.com/docs/emulator-suite/install_and_configure
yarnpushd functions && npm install && popdyarn devyarn emulateyarn lintyarn buildPTN Ninja can send and receive messages with its opening or parent window using Window.postMessage(). These messages are objects containing an action, as well as a value where applicable.
For example:
{
action: "SET_UI",
value: {
showRoads: true
}
}- Add a comment to the specified ply, or the current ply if not specified
- Add the comments to the specified plies
- Add a single move specified as a string in PTN (e.g.
Sb4) to the end of the main branch. If the current position was already the end of the main branch, it will show the new move. Otherwise, the current position will remain unchanged.
- Apply the specified board transformation
[int a, int b]whereais the number of clockwise rotations [0, 3], andbis the number of horizontal flips [0, 1].
- Abort any in-progress piece movement interaction
- Delete the specified branch
- Delete the ply specified by ID
- Replace the specified comment
- Navigate to the beginning
- Flip the board horizontally
- Flip the board vertically
- Respond with a
GET_THEMEmessage whose value is an object defining the current theme, includingid,name, and all the attributes defining the theme.
- Respond with a
GET_THEMESmessage whose value is an array of objects defining the built-in themes, includingid,name, and all the attributes defining the theme.
- Respond with a
GET_URLmessage whose value is the URL of the current game.
- Navigate to the specified ply
- Highlight the squares specified as an array of string coordinates (e.g. 'a1'). If no squares are provided, the most recent ply is highlighted.
- Insert a series of moves specified as strings in PTN (e.g.
['d5', 'e4'], ord5 e4) and go backwardprevplies. If a line number is specified in place of the first ply, following plies will be inserted at that location. If the second ply is a NOP, following plies will begin with Player 2.
- Execute a single move specified as a string in PTN (e.g.
Sb4)
- Navigate to the end
- Swap a branch with its main line, specified by branch name
- Navigate forward
- Issue a notification, specifying either the message directly, or an object with the following structure:
message(<String>): Message to be displayedicon(<String>): Icon to be displayed (only applies toNOTIFY)caption(<String>): Optional message to be displayed in smaller text belowmessagetimeout(<Number>): Optional milliseconds before automatic dismissal (default 5000). Set to zero to disable timeout.position(<String>): Optional location in which to display the notification. Must be one of the following values (defaultbottom):top-righttop-leftbottom-rightbottom-lefttoprightbottomleftcenter
actions(<Array>): Optional list of buttons to display after the message, specified asObjects with the following structure:label(<String>): Button labelicon(<String>): Button iconcolor(<String>): Optional color name (default:primary)action(<String>):actionmessage property to send to the opening or parent window when the button is clickedvalue(<String>):valuemessage property to send with theactionto the opening or parent window when the button is clicked
group(<String>|<Number>): Optional group identifier that overrides the auto-generated group identifier with custom one. When a new notification is triggered with same group identifier, it replaces the old one and shows a badge with the number of times the notification was triggered.
- Stop stepping through plies
- Begin stepping through plies from current position
- Toggle between PLAY and PAUSE
- Navigate backward
- Promote a branch specified by its name
- Redo
- Remove the specified comment
- Rename a branch
- Reset any board transformation
- Rotate the board 180 degrees
- Rotate the board left 90 degrees
- Rotate the board right 90 degrees
- Replace the current game with the provided PTN
- Show the specified evaluation score on the board, where -100 is a win for Player 2, and 100 is a win for Player 1.
- Show the specified analysis information below the board. Only the
pvis required. The object has the following structure:tps(<String>): Optional TPS string of the position being analyzed. If falsy, the current position is assumed.pv(<String>|<Array>): The principle variation (or a single ply) in PTN, as a string of plies separated by spaces, or an array of strings.progress(<Null>|<Number>: [0, 100]): Optional representation of the completion of the current search. If set tonull, the progress bar will be put into the 'indeterminate' state. If omitted, the progress bar will not be shown.evaluation(<Number>: [-100, 100]): Optional evaluation of the current position, where -100 is a win for Player 2, and 100 is a win for Player 1.depth(<Number>): Optional current depth of the search.nodes(<Number>): Optional number of nodes searched so far.time(<Number>): Optional milliseconds since the search began.visits(<Number>): Optional number of visits for the pv.
- Set the game title
- Set the user as player 1 or 2, disabling input during the opponent's turn.
- Set one or more UI parameters
- Toggle evaluation notation on the current ply
- Toggle the specified UI parameter
- Remove non-active branches
- Remove plies, preserving the board state
- Remove all plies preceding the current ply
- Undo
PTN Ninja uses lz-string to encode PTN and some other parameters for use in the URL. However, it will also do its best to read these parameters when passed as plaintext.
The structure of the URL is as follows:
https://ptn.ninja/<PTN>&<param1>=<value1>&<param2>=<value2>[...]
To get a shortened URL, send a POST request to https://url.ptn.ninja/short with request body { ptn, params (optional) } where ptn is a string, and params is an optional object containing any of the parameters below. If the request is valid, you'll receive the complete shortenend URL as plain text in response. If the URL is not accessed within 30 days, it will be deleted.
- Show axis labels
- Show axis labels inside the board
- Disable board interactions
- Disable game navigation, undo/redo, and ply deletion
- Remove the PTN panel
- Remove the PTN panel toolbars
- Disable selecting the last placed stone to cycle its type
- Remove the Notes panel
- Disable undo/redo
- Show flat counts
- Show square highlights
- Title of the game
- Show analysis note notifications
- Show game notifications
- Show note notifications
- Steps per minute to be used for playback
- Index of the current ply
- Ending with
!meansplyIsDone == true
- Show all branches
- Show the Preferences button on the board
- Show the Transform button on the board
- Show playback controls
- Show the current move
- Show the PTN panel
- Show the "Play" button in the playback controls
- Show road connections
- Show the playback scrubber
- Show the Notes panel
- Show stack counts
- Name of the current branch
- ID or JSON of the theme to be used
- Show turn indicator
- Show unplayed pieces
- Enable the vertical layout for the board (unplayed pieces below, move number above)
- Automatically switch between horizontal and vertical layouts
© 2022 Craig Laparo
This work is licensed under a GNU AGPLv3 License.