ptn

0.2.0 • Public • Published

PTN Utility

A library used to parse PTN and generate OpenTak movesets for use in Tak libraries.

Usage

import { Ptn } from 'ptn';
 
const ptn = Ptn.parse('3c3>111');
 
// Ptn {
//   ptn: '3c3>111',
//   pieceCount: '3',
//   specialPiece: undefined,
//   column: 'c',
//   row: '3',
//   movement: '>111',
//   direction: '>',
//   distribution: '111',
//   wallSmash: undefined,
//   pieceType: 'piece',
//   x: 2,
//   y: 2
// }
 
ptn.toMoveset();
 
// [{
//   action: 'pop', count: 3, x: 2, y: 2
// }, {
//   action: 'push', count: 1, x: 3, y: 2
// }, {
//   action: 'push', count: 1, x: 4, y: 2
// }, {
//   action: 'push', count: 1, x: 5, y: 2
// }]

Readme

Keywords

Package Sidebar

Install

npm i ptn

Weekly Downloads

3

Version

0.2.0

License

MIT

Last publish

Collaborators

  • baweaver