@slugbugblue/trax 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/engine.d.ts CHANGED
@@ -1,175 +1,236 @@
1
1
  /** A digital representation of a Trax game. */
2
2
  export class Trax {
3
3
  /** @readonly */
4
- static readonly version: '1.1.1'
5
- /** @readonly @type {Record<TraxVariant, string>} */
4
+ static readonly version: '1.3.0'
5
+ /**
6
+ @readonly
7
+ @type {Record<TraxVariant, string>}
8
+ */
6
9
  static readonly names: Record<TraxVariant, string>
7
10
  /** @readonly */
8
11
  static readonly variants: Set<string>
9
- /** Create an x,y Point object with special functions.
10
- * @arg {number|PointLike} x - either the x value, or an object with x,y keys
11
- * @arg {number} [y] - if x is a number, y must be provided as well
12
- * @returns {Point} a new Point object
13
- */
12
+ /**
13
+ Create an x,y Point object with special functions.
14
+ @param {number|PointLike} x - either the x value, or an object with x,y keys
15
+ @param {number} [y] - if x is a number, y must be provided as well
16
+ @returns {Point} a new Point object
17
+ */
14
18
  static point: (x: number | PointLike, y?: number) => Point
15
- /** Given a player number, get the color.
16
- * @arg {number} playerNumber - the player number, 1 or 2
17
- * @returns {Color} the color of that player, w or b
18
- */
19
+ /**
20
+ Given a player number, get the color.
21
+ @param {number} playerNumber - the player number, 1 or 2
22
+ @returns {Color} the color of that player, w or b
23
+ */
19
24
  static colorOf: (playerNumber: number) => Color
20
- /** Given a color, get the player number.
21
- * @arg {string} color - the color, w or b
22
- * @returns {number} the player number, 1 or 2
23
- */
25
+ /**
26
+ Given a color, get the player number.
27
+ @param {string} color - the color, w or b
28
+ @returns {number} the player number, 1 or 2
29
+ */
24
30
  static playerNumber: (color: string) => number
25
- /** Given a color, get the other color.
26
- * @arg {string} color - the color, w or b
27
- * @returns {Color} the other color, b or w
28
- */
31
+ /**
32
+ Given a color, get the other color.
33
+ @param {string} color - the color, w or b
34
+ @returns {Color} the other color, b or w
35
+ */
29
36
  static other: (color: string) => Color
30
- /** Encode a numeric column number into the Trax notation column letter.
31
- * @arg {number} col - the colum number, with 0 just to the left of the tiles
32
- * @returns {string} the encoded column letter
33
- */
37
+ /**
38
+ Encode a numeric column number into the Trax notation column letter.
39
+ @param {number} col - the column number, with 0 just to the left of the tiles
40
+ @returns {string} the encoded column letter
41
+ */
34
42
  static encodeCol: (col: number) => string
35
- /** Decode a Trax notation column letter back to a number.
36
- * @arg {string} col - the Trax column letter
37
- * @returns {number} the column number
38
- */
43
+ /**
44
+ Decode a Trax notation column letter back to a number.
45
+ @param {string} col - the Trax column letter
46
+ @returns {number} the column number
47
+ */
39
48
  static decodeCol: (col: string) => number
40
- /** Create a new Trax game
41
- * @arg {TraxVariant} [rules='trax'] - the variant to play
42
- * @arg {string|string[]} [moves=''] - the initial moves to pre-play
43
- * @arg {string} [id='trax'] - an id used to differentiate tiles from multiple games
44
- */
49
+ /**
50
+ Create a new Trax game
51
+ @param {TraxVariant} [rules='trax'] - the variant to play
52
+ @param {string|string[]} [moves=''] - the initial moves to pre-play
53
+ @param {string} [id='trax'] - an id used to differentiate tiles from multiple games
54
+ */
45
55
  constructor(rules?: TraxVariant, moves?: string | string[], id?: string)
46
56
  id: string
47
57
  rules: TraxVariant
48
- move: number
49
58
  turn: number
50
59
  over: boolean
51
60
  left: number
52
61
  right: number
53
62
  top: number
54
63
  bottom: number
55
- notation: string
64
+ count: number
65
+ /** @type {string[]} */
66
+ moves: string[]
67
+ /** @type {Map<TileId, Point>} */
68
+ frontier: Map<TileId, Point>
56
69
  /** @type {Record<TileId, Tile>} */
57
70
  tiles: Record<TileId, Tile>
58
- /** @type TileId[] */
71
+ /** @type {TileId[]} */
59
72
  path: TileId[]
60
73
  invalid: boolean
61
- /** Save the current game data to a variable.
62
- * @returns {SaveState} an opaque save state object
63
- * @see restore for restoring the state
64
- */
74
+ /**
75
+ Save the current game data to a variable.
76
+ @returns {SaveState} an opaque save state object
77
+ @see restore for restoring the state
78
+ */
65
79
  save(): SaveState
66
- /** Restore a previously saved position.
67
- * @arg {SaveState} saved - the previously saved state
68
- * @see save for saving the state
69
- */
80
+ /**
81
+ Restore a previously saved position.
82
+ @param {SaveState} saved - the previously saved state
83
+ @see save for saving the state
84
+ */
70
85
  restore(saved: SaveState): void
86
+ /**
87
+ Lightweight checkpoint for internal rollback. Valid only for ancestor restores.
88
+ Callers must be in a non-over, valid game state — rewind() restores those
89
+ fields to those fixed values rather than saving and restoring them.
90
+ @returns {Checkpoint} a lightweight snapshot of mutable board dimensions
91
+ @typedef {{ move: number, count: number, turn: number, left: number, right: number, top: number, bottom: number }} Checkpoint
92
+ */
93
+ checkpoint(): {
94
+ move: number
95
+ count: number
96
+ turn: number
97
+ left: number
98
+ right: number
99
+ top: number
100
+ bottom: number
101
+ }
102
+ /**
103
+ Rewind to a checkpoint. Only valid for ancestor restores.
104
+ @param {Checkpoint} cp - the checkpoint to rewind to
105
+ */
106
+ rewind(cp: {
107
+ move: number
108
+ count: number
109
+ turn: number
110
+ left: number
111
+ right: number
112
+ top: number
113
+ bottom: number
114
+ }): void
71
115
  /** The name of this variant. */
72
116
  get name(): string
73
- /** The number of tiles currently in play. */
74
- get count(): number
117
+ /** The move number of the last-played move. */
118
+ get move(): number
75
119
  /** The color of the current player, w or b. */
76
120
  get color(): Color
77
121
  /** True if the game is over. */
78
122
  get gameOver(): boolean
79
123
  /** 1 or 2 for a win, 0 for a tie, false if the game is still in progress. */
80
124
  get winner(): number | false
81
- /** Provides the tile ID for the tile at the given location.
82
- * @arg {PointLike} loc
83
- * returns {TileId}
84
- */
85
- tileId(loc: PointLike): string
86
- /** Add a tile to the board. Note that no validity checking is done here,
87
- * except that invalid tiles are not actually placed on the board, so this
88
- * should only be called externally.
89
- * @arg {TileType} type
90
- * @arg {Point} loc
91
- * @returns {Tile} the tile placed on the board.
92
- */
125
+ /**
126
+ Provides the tile ID for the tile at the given location.
127
+ @param {PointLike} loc - the location
128
+ @returns {TileId} a string key encoding this game's id and the location
129
+ */
130
+ tileId(loc: PointLike): TileId
131
+ /**
132
+ Add a tile to the board. Note that no validity checking is done here,
133
+ except that invalid tiles are not actually placed on the board, so this
134
+ should only be called externally.
135
+ @param {TileType} type - letter 'a'-'f' for valid tiles, 'x' for invalid
136
+ @param {Point} loc - the location
137
+ @returns {Tile} the tile placed on the board
138
+ */
93
139
  addTile(type: TileType, loc: Point): Tile
94
- /** The type of tile at the given location.
95
- * @arg {PointLike} loc - the location the tile is in
96
- * @returns {ValidTiles|undefined} the type of tile, or undefined if no tile
97
- */
140
+ /**
141
+ The type of tile at the given location.
142
+ @param {PointLike} loc - the location the tile is in
143
+ @returns {ValidTiles|undefined} the type of tile, or undefined if no tile
144
+ */
98
145
  tileAt(loc: PointLike): ValidTiles | undefined
99
146
  validTile(type: string, loc: Point): type is ValidTiles
100
- /** Get a list of possible tiles that can be played in this location.
101
- * @arg {Point} loc - the location to check
102
- * @arg {string | boolean} s=false - if provided, a direction modifier, '/', '\\', or '+'
103
- * @returns {TileType[]}
104
- */
105
- possibleTiles(loc: Point, s?: string | boolean): TileType[]
147
+ /**
148
+ Get a list of possible tiles that can be played in this location.
149
+ @param {Point} loc - the location to check
150
+ @param {string} [slashFilter] - if provided, a direction modifier, '/', '\\', or '+'
151
+ @returns {TileType[]} the list of valid tile types for this location
152
+ */
153
+ possibleTiles(loc: Point, slashFilter?: string): TileType[]
106
154
  get height(): number
107
155
  get width(): number
108
- /** Determine if a location is valid to play in.
109
- * @arg {Point} loc - the location to check
110
- * @returns {boolean}
111
- */
156
+ /**
157
+ Determine if a location is valid to play in.
158
+ @param {Point} loc - the location to check
159
+ @returns {boolean} true if a tile can be placed here
160
+ */
112
161
  validLocation(loc: Point): boolean
113
- /** Find all possible locations to play in. Note that these are not
114
- * necessarily valid locations, just empty ones that border existing tiles.
115
- */
162
+ /**
163
+ Find all possible locations to play in. Note that these are not
164
+ necessarily valid locations, just empty ones that border existing tiles.
165
+ @returns {Point[]} all frontier locations
166
+ */
116
167
  possibleLocations(): Point[]
117
- /** Find all possible moves as a list of notations,
118
- * ie: ['@1+', '@1/', '@1\\', ...]
119
- *
120
- * Note that moves are not guaranteed to be valid.
121
- */
168
+ /**
169
+ Find all possible moves as a list of notations,
170
+ ie: ['@1+', '@1/', '@1\\', ...]
171
+
172
+ Note that moves are not guaranteed to be valid.
173
+ @returns {string[]} all valid move notations from the current position
174
+ */
122
175
  possibleMoves(): string[]
123
- /** Called after a move was just played, to determine the forced moves.
124
- * @arg {Point} loc - the location just played at
125
- * @returns {Tile[]} a list of tiles that should be added as part of the move
126
- */
176
+ /**
177
+ Called after a move was just played, to determine the forced moves.
178
+ @param {Point} loc - the location just played at
179
+ @returns {Tile[]} a list of tiles that should be added as part of the move
180
+ */
127
181
  forcedMoves(loc: Point): Tile[]
128
- /** Determine the notation for a move. Note that this must be determined
129
- * BEFORE the move is placed on the board.
130
- * @arg {ValidTiles} type - the tile placed on the board
131
- * @arg {Point} loc - the location the tile is placed
132
- * @returns {string} the notation of the move
133
- */
182
+ /**
183
+ Determine the notation for a move. Note that this must be determined
184
+ BEFORE the move is placed on the board.
185
+ @param {ValidTiles} type - the tile placed on the board
186
+ @param {Point} loc - the location the tile is placed
187
+ @returns {string} the notation of the move
188
+ */
134
189
  notate(type: ValidTiles, loc: Point): string
135
- /** Turn a move notation into a tile type and location.
136
- * @arg {string} notation - a notation for a single move to be played at
137
- * the current board position
138
- * @returns {RawMove} the tile type and location of the move
139
- */
190
+ /**
191
+ Turn a move notation into a tile type and location.
192
+ @param {string} notation - a notation for a single move to be played at
193
+ the current board position
194
+ @returns {RawMove} the tile type and location of the move
195
+ */
140
196
  decodeNotation(notation: string): RawMove
141
- /** Follow a color from one location through one or more tiles to the other
142
- * end of the color line.
143
- * @arg {Color} color - the color to follow
144
- * @arg {Point} loc - the location to start
145
- * @arg {string} from - the edge of the tile to start from
146
- * @returns {LineEnd} the ending location and a list of the tile ids the path
147
- * takes to get there.
148
- */
197
+ /**
198
+ Follow a color from one location through one or more tiles to the other
199
+ end of the color line.
200
+ @param {Color} color - the color to follow
201
+ @param {Point} loc - the location to start
202
+ @param {string} from - the edge of the tile to start from
203
+ @returns {LineEnd} the ending location and a list of the tile ids the path
204
+ takes to get there
205
+ */
149
206
  follow(color: Color, loc: Point, from: string): LineEnd
150
- /** Given a tile and a color, follow the line for that color to each end.
151
- * @arg {Color} color - the color of ends of interest
152
- * @arg { Point} loc - the location of the tile of interest
153
- * @returns {LineEnd[]} a list of two items, each one end of the line
154
- */
207
+ /**
208
+ Given a tile and a color, follow the line for that color to each end.
209
+ @param {Color} color - the color of ends of interest
210
+ @param {Point} loc - the location of the tile of interest
211
+ @returns {LineEnd[]} a list of two items, each one end of the line
212
+ */
155
213
  findEnds(color: Color, loc: Point): LineEnd[]
156
- /** Determine if a given line ends the game.
157
- * @arg {Point} locA - one end of the line
158
- * @arg {Point} locB - the other end of the line
159
- * @returns {boolean} - true if this line wins the game
160
- */
214
+ /**
215
+ Determine if a given line ends the game.
216
+ @param {Point} locA - one end of the line
217
+ @param {Point} locB - the other end of the line
218
+ @returns {boolean} true if this line wins the game
219
+ */
161
220
  lineWin(locA: Point, locB: Point): boolean
162
- /** Determine if the game has ended.
163
- * @arg {Tile[]} tiles - a list of the tiles placed during the last move.
164
- */
221
+ /**
222
+ Determine if the game has ended.
223
+ @param {Tile[]} tiles - a list of the tiles placed during the last move
224
+ */
165
225
  checkWin(tiles: Tile[]): void
166
- /** Play a move. Can be called either as:
167
- * - play(moveNumber, notation) to ensure move safety, or
168
- * - play(notation) for quicker access.
169
- * @arg moveNumber {(number|string)} the move number or the notation
170
- * @arg {string} [notation] - the notation, if a move number was provided
171
- * @returns {{dropped: Tile[], notation: string, valid: boolean}}
172
- */
226
+ /**
227
+ Play a move. Can be called either as:
228
+ - play(moveNumber, notation) to ensure move safety, or
229
+ - play(notation) for quicker access.
230
+ @param {number|string} moveNumber - the move number or the notation
231
+ @param {string} [notation] - the notation, if a move number was provided
232
+ @returns {{dropped: Tile[], notation: string, valid: boolean}} the result of the move
233
+ */
173
234
  play(
174
235
  moveNumber: number | string,
175
236
  notation?: string,
@@ -178,86 +239,118 @@ export class Trax {
178
239
  notation: string
179
240
  valid: boolean
180
241
  }
181
- /** Play one or more moves.
182
- * @arg {string|string[]} moves - the list of moves, provided either as a
183
- * space-separated string of notations, or as a list of notations. Move
184
- * numbers are optional, but if provided will be checked for accuracy.
185
- */
242
+ /**
243
+ Play one or more moves.
244
+ @param {string|string[]} moves - the list of moves, provided either as a
245
+ space-separated string of notations, or as a list of notations. Move
246
+ numbers are optional, but if provided will be checked for accuracy.
247
+ */
186
248
  playMoves(moves: string | string[]): void
187
- /** Add the current move notation to the notation string
188
- * @arg {string} notation - the notation of the current move
189
- */
190
- updateNotation(notation: string): void
191
- /** An array of the moves made in the game. */
192
- get moves(): string[]
193
- /** Drop a tile onto the board. This is a lower level call. Use play() if possible instead.
194
- * @arg {string|ValidTiles} type - a special move, a tile type, or a notation
195
- * @arg {Point} [loc] - a location if type is a tile type
196
- * @arg {string|boolean} [tentative] - if truthy, the move will not be saved
197
- * @returns {TileDrop} an object representing the results of the drop
198
- */
249
+ /** The formatted notation string for the current game, wrapped at 80 columns. */
250
+ get notation(): string
251
+ /**
252
+ Drop a tile onto the board. This is a lower level call. Use play() if possible instead.
253
+ @param {string|ValidTiles} type - a special move, a tile type, or a notation
254
+ @param {Point} [loc] - a location if type is a tile type
255
+ @param {string|boolean} [tentative] - if truthy, the move will not be saved
256
+ @returns {TileDrop} an object representing the results of the drop
257
+ */
199
258
  dropTile(
200
259
  type: string | ValidTiles,
201
260
  loc?: Point,
202
261
  tentative?: string | boolean,
203
262
  ): TileDrop
204
- /** Symmetry helper. Rotates a move around the board in case we are trying to
205
- * play a symmetrical rather than an exact move.
206
- * @arg {string} move - the notation of the move to be rotated
207
- * @returns {string[]} the four rotations of this move
208
- */
263
+ /**
264
+ Symmetry helper. Rotates a move around the board in case we are trying to
265
+ play a symmetrical rather than an exact move.
266
+ @param {string} move - the notation of the move to be rotated
267
+ @returns {string[]} the four rotations of this move
268
+ */
209
269
  moveRotations(move: string): string[]
210
- /** Play a provisional move if it is valid.
211
- * @arg {string} from - the normalized encoding of the starting position
212
- * @arg {string} to - the normalized encoding of the ending position
213
- * @arg {string} via - the move to be used to transition
214
- * @returns {false|string} if the provisional move is invalid: false; if the
215
- * provisional move will never be valid for any future moves:
216
- * 'delete-provisional'; if the provisional move is valid, the correct
217
- * notation, which may be symmetrically adjusted as needed
218
- */
270
+ /**
271
+ Play a provisional move if it is valid.
272
+ @param {string} from - the canonical encoding of the starting position (or,
273
+ during the `normalize()` deprecation period, a normalized encoding)
274
+ @param {string} to - the canonical (or normalized) encoding of the ending
275
+ position, in the same encoding as `from`
276
+ @param {string} via - the move to be used to transition
277
+ @returns {false|string} if the provisional move is invalid: false; if the
278
+ provisional move will never be valid for any future moves:
279
+ 'delete-provisional'; if the provisional move is valid, the correct
280
+ notation, which may be symmetrically adjusted as needed
281
+ */
219
282
  provisionalMove(from: string, to: string, via: string): false | string
220
- /** Get an encoded representation of the current position, useful for drawing
221
- * the board without having to do much analysis.
222
- * @returns {string} the current position code
223
- */
283
+ /**
284
+ Get an encoded representation of the current position, useful for drawing
285
+ the board without having to do much analysis.
286
+ @returns {string} the current position code
287
+ */
224
288
  get icon(): string
225
- /** Get an encoded representation of the current position, with a set of
226
- * tiles highlighted differently, useful for showing the effects of a move.
227
- * @arg {TileDrop} drops - the drops of the most recent play
228
- * @returns {string} the current position code, with drops highlighted
229
- */
289
+ /**
290
+ Get an encoded representation of the current position, with a set of
291
+ tiles highlighted differently, useful for showing the effects of a move.
292
+ @param {TileDrop} drops - the drops of the most recent play
293
+ @returns {string} the current position code, with drops highlighted
294
+ */
230
295
  dropsIcon(drops: TileDrop): string
231
- /** Symmetry helper, draw the board from different angles.
232
- * @arg {boolean} [rightToLeft] - reverse order horizontally
233
- * @arg {boolean} [bottomToTop] - reverse order vertically
234
- * @arg {boolean} [rotate] - rotate the tiles by 90 degrees
235
- * @arg {TileDrop} [drops] - the drops of the most recent play, if you want
236
- * them highlighted
237
- * @returns {string} an encoding of the position
238
- */
296
+ /**
297
+ Symmetry helper, draw the board from different angles.
298
+ @param {boolean} [rightToLeft] - reverse order horizontally
299
+ @param {boolean} [bottomToTop] - reverse order vertically
300
+ @param {boolean} [rotate] - rotate the tiles by 90 degrees
301
+ @param {TileDrop} [drops] - the drops of the most recent play, if you want
302
+ them highlighted
303
+ @returns {string} an encoding of the position
304
+ */
239
305
  positionCode(
240
306
  rightToLeft?: boolean,
241
307
  bottomToTop?: boolean,
242
308
  rotate?: boolean,
243
309
  drops?: TileDrop,
244
310
  ): string
245
- /** Trax has the potential for symmetry, so this gives us the ability to
246
- * examine horizontal, vertical, and rotational symmetry for a color.
247
- * @returns {string} a position code that matches all symmetrical positions
248
- */
311
+ /**
312
+ Trax has the potential for symmetry, so this gives us the ability to
313
+ examine horizontal, vertical, and rotational symmetry for a color.
314
+ @deprecated Prefer `canonical`, which also collapses color-swapped
315
+ duplicates - the same puzzle played by the other side. `normalize()` is
316
+ kept for callers (such as `provisionalMove()`) that need a code sensitive
317
+ to which color is to move, and is likely to be removed in a future major
318
+ version.
319
+ @returns {string} a position code that matches all symmetrical positions
320
+ */
249
321
  normalize(): string
250
- /** Get the normalized code for this position. All symmetrical positions will
251
- * result in the same normalized code.
252
- */
322
+ /**
323
+ Get the normalized code for this position. All symmetrical positions will
324
+ result in the same normalized code.
325
+ @deprecated Prefer `canonical`; see `normalize()`.
326
+ @returns {string} the normalized position code
327
+ */
253
328
  get normalized(): string
329
+ /**
330
+ Get the canonical code for this position: colors are swapped, if needed,
331
+ so the code always reads as though white were about to move (or, once the
332
+ game is over, as though white won), then minimized across all 8
333
+ rotations/mirrors. Two positions that are identical up to a color swap and
334
+ board symmetry - the same puzzle, played by the other side - produce the
335
+ same canonical code. A tied game has no winner to canonicalize around, so
336
+ its colors are left as-is.
337
+ @returns {string} the canonical position code
338
+ */
339
+ get canonical(): string
340
+ #private
254
341
  }
255
342
  export type Color = 'w' | 'b'
256
343
  /**
257
344
  * One end of a line and the tiles taken to get there.
258
345
  */
259
346
  export type LineEnd = {
347
+ /**
348
+ * - the ending location
349
+ */
260
350
  loc: Point
351
+ /**
352
+ * - tile ids from start to end
353
+ */
261
354
  path: TileId[]
262
355
  }
263
356
  export type Notation = string
@@ -265,7 +358,13 @@ export type Notation = string
265
358
  * A tile type and a location determine a raw move.
266
359
  */
267
360
  export type RawMove = {
361
+ /**
362
+ * - the tile type
363
+ */
268
364
  type: TileType
365
+ /**
366
+ * - the location
367
+ */
269
368
  loc: Point
270
369
  }
271
370
  /**
@@ -273,17 +372,57 @@ export type RawMove = {
273
372
  * produced by save() and fed into restore().
274
373
  */
275
374
  export type SaveState = {
375
+ /**
376
+ * - game id
377
+ */
276
378
  id: string
379
+ /**
380
+ * - move number
381
+ */
277
382
  move: number
383
+ /**
384
+ * - current player (1 or 2)
385
+ */
278
386
  turn: number
387
+ /**
388
+ * - whether the game is over
389
+ */
279
390
  over: boolean
391
+ /**
392
+ * - leftmost tile column
393
+ */
280
394
  left: number
395
+ /**
396
+ * - rightmost tile column
397
+ */
281
398
  right: number
399
+ /**
400
+ * - topmost tile row
401
+ */
282
402
  top: number
403
+ /**
404
+ * - bottommost tile row
405
+ */
283
406
  bottom: number
284
- notation: Notation
407
+ /**
408
+ * - move notations
409
+ */
410
+ moves: string[]
411
+ /**
412
+ * - frontier locations
413
+ */
414
+ frontier: [TileId, Point][]
415
+ /**
416
+ * - serialized tiles
417
+ */
285
418
  tiles: string
419
+ /**
420
+ * - serialized winning path
421
+ */
286
422
  path: string
423
+ /**
424
+ * - whether an invalid tile was placed
425
+ */
287
426
  invalid: boolean
288
427
  }
289
428
  export type Slash = '/' | '\\' | '+'
@@ -291,10 +430,25 @@ export type Slash = '/' | '\\' | '+'
291
430
  * A single tile on the board.
292
431
  */
293
432
  export type Tile = {
433
+ /**
434
+ * - unique tile identifier
435
+ */
294
436
  id: TileId
437
+ /**
438
+ * - board location
439
+ */
295
440
  loc: Point
441
+ /**
442
+ * - tile type letter
443
+ */
296
444
  type: TileType
445
+ /**
446
+ * - move number when placed
447
+ */
297
448
  move: number
449
+ /**
450
+ * - sequence number among all tiles
451
+ */
298
452
  seq: number
299
453
  }
300
454
  export type TileId = string
@@ -302,12 +456,42 @@ export type TileId = string
302
456
  * When a tile is dropped, this object represents the results.
303
457
  */
304
458
  export type TileDrop = {
459
+ /**
460
+ * - all tiles placed, including forced moves
461
+ */
305
462
  dropped: Tile[]
463
+ /**
464
+ * - the notation of the played move
465
+ */
306
466
  notation: Notation
467
+ /**
468
+ * - whether the move was legal
469
+ */
307
470
  valid: boolean
308
471
  }
309
472
  export type TileType = ValidTiles | 'x'
310
473
  export type TraxVariant = 'trax' | 'traxloop' | 'trax8'
311
474
  export type ValidTiles = 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
312
- import type { PointLike } from '@slugbugblue/point'
475
+ /**
476
+ * Symmetry options for viewing a position from different angles.
477
+ */
478
+ export type SymmetryOptions = {
479
+ /**
480
+ * - mirror the tile
481
+ */
482
+ rightToLeft?: boolean | undefined
483
+ /**
484
+ * - flip the tile
485
+ */
486
+ bottomToTop?: boolean | undefined
487
+ /**
488
+ * - rotate the tile counterclockwise
489
+ */
490
+ rotate?: boolean | undefined
491
+ /**
492
+ * - swap the tile's colors
493
+ */
494
+ colorSwap?: boolean | undefined
495
+ }
313
496
  import { Point } from '@slugbugblue/point'
497
+ import type { PointLike } from '@slugbugblue/point'