@slugbugblue/trax 1.1.0 → 1.1.1
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/RELEASE.v1.1.1.md +5 -0
- package/gl-sast-report.json +1 -0
- package/package.json +13 -18
- package/src/engine.d.ts +313 -0
- package/src/engine.js +113 -22
- package/src/version.js +1 -1
- package/CHANGELOG.md +0 -237
- package/CONTRIBUTING.md +0 -113
- package/docs/engine.md +0 -432
- package/src/types.d.ts +0 -84
package/CHANGELOG.md
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
# @slugbugblue/trax
|
|
2
|
-
|
|
3
|
-
## 1.1.0 - 2026-02-22
|
|
4
|
-
|
|
5
|
-
- Export the version number string directly from the Trax class
|
|
6
|
-
|
|
7
|
-
## 1.0.1 - 2026-02-20
|
|
8
|
-
|
|
9
|
-
- Add references for ambient typescript definitions
|
|
10
|
-
|
|
11
|
-
## 1.0.0 - 2025-11-04
|
|
12
|
-
|
|
13
|
-
v1 release:
|
|
14
|
-
|
|
15
|
-
- Update dev dependencies to latest versions
|
|
16
|
-
- Fix xo complaints
|
|
17
|
-
- No other code changes
|
|
18
|
-
|
|
19
|
-
## 0.23.0 - 2023-03-28
|
|
20
|
-
|
|
21
|
-
Release candidate
|
|
22
|
-
|
|
23
|
-
Finalize work with jsdoc/typescript
|
|
24
|
-
|
|
25
|
-
## 0.22.0 - 2023-03-25
|
|
26
|
-
|
|
27
|
-
- Pull point.js into its own package: `@slugbugblue/point`
|
|
28
|
-
- Pull lru.js into its own package: `@slugbugblue/lru`
|
|
29
|
-
- Pull puzzles.js into its own package: `@slugbugblue/trax-puzzles`
|
|
30
|
-
- Pull tty.js into its own package: `@slugbugblue/trax-tty`
|
|
31
|
-
- Pull analyst.js into its own package: `@slugbugblue/trax-analyst`
|
|
32
|
-
- Pull cli.js into its own package: `@slugbugblue/trax-cli`
|
|
33
|
-
|
|
34
|
-
## 0.21.0 - 2023-03-12
|
|
35
|
-
|
|
36
|
-
- Update the analysis engine to be more lazy
|
|
37
|
-
- The LRU cache is more likely to have a hit because it no longer separates
|
|
38
|
-
validated from unvalidated analyses
|
|
39
|
-
- Suggestions are much faster because it now skips validations for low-scoring
|
|
40
|
-
moves
|
|
41
|
-
- You will now need to call `validateThreats()` to remove faulty threats
|
|
42
|
-
manually
|
|
43
|
-
|
|
44
|
-
## 0.20.0 - 2023-02-11
|
|
45
|
-
|
|
46
|
-
- Provide timing feedback on the puzzlebot's actions
|
|
47
|
-
- Add license information for puzzle sources
|
|
48
|
-
- Add gitlab CI configuration
|
|
49
|
-
- Drop support for node 14; node v16.15 is our minimum supported version
|
|
50
|
-
- More puzzles from Martin M. S. Pedersen -- bringing the total to 100+
|
|
51
|
-
- Enhance the docker configuration and document it in the README
|
|
52
|
-
- Refine faulty threat detection and add test for one case it was failing
|
|
53
|
-
|
|
54
|
-
## 0.19.0 - 2023-02-06
|
|
55
|
-
|
|
56
|
-
- Added a simple LRU cache to increase the efficiency of the analysis engine
|
|
57
|
-
|
|
58
|
-
## 0.18.0 - 2023-02-05
|
|
59
|
-
|
|
60
|
-
- Analysis improvements:
|
|
61
|
-
- Add `count.b(level)` and `count.w(level)` methods to an analysis to quickly
|
|
62
|
-
count the number of threats at a given level
|
|
63
|
-
- Remove faulty threats from an analysis
|
|
64
|
-
- Add additional threats for more puzzle solving mojo
|
|
65
|
-
|
|
66
|
-
- Development environment enhancements:
|
|
67
|
-
- Added an initial benchmarking framework with puzzle benchmarks so far
|
|
68
|
-
- Added husky pre-commit hook to ensure npm test is run before a commit
|
|
69
|
-
|
|
70
|
-
- CLI improvements:
|
|
71
|
-
- Puzzle information is now stored as notes, to make it searchable
|
|
72
|
-
|
|
73
|
-
- More puzzles:
|
|
74
|
-
- Martin M. S. Pedersen contributed eleven new puzzles
|
|
75
|
-
|
|
76
|
-
## 0.17.0 - 2022-12-29
|
|
77
|
-
|
|
78
|
-
- The `import` CLI command now loads comments from a .trx file
|
|
79
|
-
|
|
80
|
-
## 0.16.0 - 2022-12-27
|
|
81
|
-
|
|
82
|
-
- Added a `notes` command to the CLI to add comments to a game
|
|
83
|
-
- all comments are included in the output generated by the `export` command
|
|
84
|
-
- the latest comment can be used as a text filter by the `list` command
|
|
85
|
-
- the latest comment is displayed by the `view` and `list` commands
|
|
86
|
-
|
|
87
|
-
- Minor analysis improvements
|
|
88
|
-
|
|
89
|
-
## 0.15.0 - 2022-12-14
|
|
90
|
-
|
|
91
|
-
- Added shared `puzzles` commands to the CLI:
|
|
92
|
-
- `trax ls puzzles`: see all the puzzles
|
|
93
|
-
- `trax new puzzle`: start a new puzzle
|
|
94
|
-
|
|
95
|
-
- Puzzle improvements:
|
|
96
|
-
- Adjust puzzle category levels for harder puzzles
|
|
97
|
-
- Add multiple hints when the puzzle can be solved multiple ways
|
|
98
|
-
|
|
99
|
-
- Analysis improvements:
|
|
100
|
-
- Analysis suggestions now "solve" all tough puzzles
|
|
101
|
-
- Reworked threats to be more precise
|
|
102
|
-
- Reworked scoring to add more nuance
|
|
103
|
-
|
|
104
|
-
## 0.14.0 - 2022-12-05
|
|
105
|
-
|
|
106
|
-
- Added `puzzles` to the CLI:
|
|
107
|
-
- `trax puzzles ls`: see all the puzzles
|
|
108
|
-
- `trax puzzle new`: start a new puzzle
|
|
109
|
-
|
|
110
|
-
- Analysis tests now include correctly suggesting the first move for solving all
|
|
111
|
-
tutorial and easy puzzles. As the threats database improves, we will add more
|
|
112
|
-
puzzles to the tests.
|
|
113
|
-
|
|
114
|
-
## 0.13.0 - 2022-11-25
|
|
115
|
-
|
|
116
|
-
- Add move suggestions to `analyst.js` for CLI and bot use
|
|
117
|
-
- use `suggest(trax)` to get a suggestion for the current position
|
|
118
|
-
- added the `suggest` CLI command for quick access to a random suggestion
|
|
119
|
-
|
|
120
|
-
- Use font glyphs for text bubbles in `tty.js` only if one of the following
|
|
121
|
-
environment variables are defined and non-empty:
|
|
122
|
-
- `NERDFONT`, `POWERLINE`, `P9K_TTY`, `P9K_SSH`
|
|
123
|
-
|
|
124
|
-
- Begin work on documenting the javascript files using jsdoc, with the initial
|
|
125
|
-
focus on types so typescript-powered autocomplete can be more useful
|
|
126
|
-
|
|
127
|
-
## 0.12.0 - 2022-10-28
|
|
128
|
-
|
|
129
|
-
- `point.in()` now accepts any two opposing corners to define the bounding box
|
|
130
|
-
- Fleshing out testing and debugging of `analyst.js`
|
|
131
|
-
|
|
132
|
-
## 0.11.0 - 2022-09-22
|
|
133
|
-
|
|
134
|
-
- Breaking change: Refactor `play()` and `playMove()` into a single function
|
|
135
|
-
`play()`. `playMove()` is no longer available.
|
|
136
|
-
- Add a new function `playMoves()` to submit multiple moves at once
|
|
137
|
-
- Initial work on `analyst.js`, with documentation and a start on tests
|
|
138
|
-
- use `analyze(trax)` to perform an analysis
|
|
139
|
-
- added the `analyze` CLI command to see an analysis
|
|
140
|
-
|
|
141
|
-
## 0.10.1 - 0.10.2 - 2022-06-12
|
|
142
|
-
|
|
143
|
-
- Added an entry point for the `Point` class at `@slugbugblue/trax/point`
|
|
144
|
-
|
|
145
|
-
## 0.10.0 - 2022-06-12
|
|
146
|
-
|
|
147
|
-
- Added `point.in(topLeft, bottomRight)` to see if a point is inside a
|
|
148
|
-
rectangular bounded area
|
|
149
|
-
- Minor coding style changes due to updated `xo` rules
|
|
150
|
-
|
|
151
|
-
## 0.9.0 - 2022-04-24
|
|
152
|
-
|
|
153
|
-
- Added tab-completion and completion preview code to the interactive CLI
|
|
154
|
-
- Restructured the CLI by moving most commands to their own file
|
|
155
|
-
- Changed the `view` CLI command to optionally examine previous moves
|
|
156
|
-
|
|
157
|
-
## 0.8.0 - 2022-04-08
|
|
158
|
-
|
|
159
|
-
- Breaking change: `playMove()` now takes the _next_ move number instead of the
|
|
160
|
-
_last_ move number. It makes more sense to say "move number 1 is @0/" than to
|
|
161
|
-
say "the move following move number 0 is @0/".
|
|
162
|
-
- Added variant name info to the engine as `Trax.name[rules]` as well as
|
|
163
|
-
`trax.name`
|
|
164
|
-
- Restructured the repo to handle additional files, creating `src` and `hooks`
|
|
165
|
-
folders
|
|
166
|
-
- Added a command-line interface (CLI) `cli.js` which npm will install using the
|
|
167
|
-
alias `trax`
|
|
168
|
-
- The CLI usage is self-documenting; run `trax help` to get started
|
|
169
|
-
- Initial commands available: `delete`, `export`, `help`, `import`, `list`,
|
|
170
|
-
`new`, `play`, `select`, `try`, `undo`, `view`
|
|
171
|
-
|
|
172
|
-
## 0.7.0 - 2022-03-28
|
|
173
|
-
|
|
174
|
-
- Fixed a bug when including extra characters in a starting notation
|
|
175
|
-
- Added regression tests to detect/prevent this bug in the future
|
|
176
|
-
|
|
177
|
-
## 0.6.0 - 2022-02-13
|
|
178
|
-
|
|
179
|
-
- Completed documentation for `engine.js` at [docs/engine.md](docs/engine.md)
|
|
180
|
-
- `x` and `y` locations are now handled in a `Point` class
|
|
181
|
-
- Renamed `tentativeIcon()` to `dropsIcon()`
|
|
182
|
-
|
|
183
|
-
## 0.5.0 - 2022-01-29
|
|
184
|
-
|
|
185
|
-
This code base is now using [`xo`](https://github.com/xojs/xo) for style and
|
|
186
|
-
[`ava`](https://github.com/avajs/ava) for testing. Should be no functional
|
|
187
|
-
changes, but a lot of code was updated, including the names of all functions and
|
|
188
|
-
variables from snake_case to camelCase.
|
|
189
|
-
|
|
190
|
-
## 0.4.0 - 2022-01-17
|
|
191
|
-
|
|
192
|
-
- Testing coverage of `engine.js` is now at 100%
|
|
193
|
-
- Testing revealed a few bugs, which are now fixed
|
|
194
|
-
- The name and signature for provisional move handling, which was broken, has
|
|
195
|
-
been changed. It is now called `provisional_moves()` and takes three
|
|
196
|
-
arguments:
|
|
197
|
-
- `from`: the normalized position code of the board before the move
|
|
198
|
-
- `to`: the normalized position code of the board after the move
|
|
199
|
-
- `via`: the move notation to go from `from` to `to`
|
|
200
|
-
|
|
201
|
-
## 0.3.1 - 2022-01-07
|
|
202
|
-
|
|
203
|
-
- Make a faster implementation of `trax.possible_locations()`
|
|
204
|
-
- Display updates for tentative moves
|
|
205
|
-
|
|
206
|
-
## 0.3.0 - 2021-12-29
|
|
207
|
-
|
|
208
|
-
Display a tentative move on the screen
|
|
209
|
-
|
|
210
|
-
- Add `trax.tentative_icon()` function
|
|
211
|
-
- `tty.display()` now accepts a tentative move
|
|
212
|
-
|
|
213
|
-
## 0.2.0 - 2021-12-28
|
|
214
|
-
|
|
215
|
-
Breaking changes:
|
|
216
|
-
|
|
217
|
-
- Converted from CommonJS to ESM
|
|
218
|
-
- `trax.normalized` now prepends turn information to the string
|
|
219
|
-
|
|
220
|
-
More convenience:
|
|
221
|
-
|
|
222
|
-
- `trax.color`: the color of the player whose turn it is
|
|
223
|
-
- `Trax.color_of[num]`: go from player number to color
|
|
224
|
-
- `Trax.player_num[color]`: or from color to player number
|
|
225
|
-
- `Trax.other[color]`: easily switch from 'w' to 'b' and back
|
|
226
|
-
|
|
227
|
-
## 0.1.0 - 2021-12-26
|
|
228
|
-
|
|
229
|
-
Initial release:
|
|
230
|
-
|
|
231
|
-
- engine.js
|
|
232
|
-
- create a new Trax game with `trax = new Trax()`
|
|
233
|
-
- play one move at a time with `trax.play('@0/')`
|
|
234
|
-
- ... etc
|
|
235
|
-
|
|
236
|
-
- tty.js
|
|
237
|
-
- display a game with `tty.display(trax)`
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# Contributing to slugbugblue/trax
|
|
2
|
-
|
|
3
|
-
Hi, thanks for considering contributing to this project.
|
|
4
|
-
|
|
5
|
-
If this is your first time working on an open source project, it is recommended
|
|
6
|
-
that you start by reading [How to Contribute to Open Source][howto].
|
|
7
|
-
|
|
8
|
-
## Ways to contribute
|
|
9
|
-
|
|
10
|
-
### Improve documentation
|
|
11
|
-
|
|
12
|
-
One of the simplest ways to get started contributing is to find areas of the
|
|
13
|
-
documentation that are unclear, incorrect, or that have typos or other errors,
|
|
14
|
-
and providing feedback and corrections. You don't have to know how to code or
|
|
15
|
-
even how to use git.
|
|
16
|
-
|
|
17
|
-
### Identify bugs
|
|
18
|
-
|
|
19
|
-
If you are aware of something not working as you think it should, feel free to
|
|
20
|
-
open a new issue to let us know. Browsing through the existing open issues and
|
|
21
|
-
adding comments or making clarifications can also be a great way to get started.
|
|
22
|
-
|
|
23
|
-
### Fixing bugs
|
|
24
|
-
|
|
25
|
-
If you feel you have a solution to an existing bug, you are welcome to code up
|
|
26
|
-
your solution and submit a merge request. It may take some time to get fully up
|
|
27
|
-
to speed with our coding styles and with the structure of the code, so don't
|
|
28
|
-
feel bad if your merge request receives comments rather than being immediately
|
|
29
|
-
accepted. Simply make any necessary changes, and update the merge request, or
|
|
30
|
-
let us know in a subsequent comment if you think we are misunderstanding the
|
|
31
|
-
merge request.
|
|
32
|
-
|
|
33
|
-
## Submitting an issue
|
|
34
|
-
|
|
35
|
-
If you choose to submit an issue, please take the time to ensure that you
|
|
36
|
-
provide as much detail as possible about the issue. A poorly worded or poorly
|
|
37
|
-
researched issue report will unnecessarily delay the issue resolution.
|
|
38
|
-
|
|
39
|
-
Even if you don't have the time or expertise to fully diagnose the problem, a
|
|
40
|
-
good issue report can be very helpful to us as we seek to improve the code.
|
|
41
|
-
|
|
42
|
-
## Submitting a merge request
|
|
43
|
-
|
|
44
|
-
Good merge requests are a fantastic way to contribute to this project. Your
|
|
45
|
-
merge request is going to be accepted more quickly if it is easy to understand.
|
|
46
|
-
Ideally it should be focused on a single item and avoid unrelated commits.
|
|
47
|
-
|
|
48
|
-
Please ask first before embarking on a major change, such as adding a new
|
|
49
|
-
feature or refactoring the code, otherwise you risk spending a significant
|
|
50
|
-
amount of time working on something that will not be merged into the project.
|
|
51
|
-
|
|
52
|
-
If you have never submitted a merge request before, no fear. Here is a [quick
|
|
53
|
-
tutorial][howto-mr] on how to create one.
|
|
54
|
-
|
|
55
|
-
### Merge request steps
|
|
56
|
-
|
|
57
|
-
- Fork the project and clone it to your own workspace.
|
|
58
|
-
- Get the latest changes and update the project dependencies:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
$ git checkout develop
|
|
62
|
-
$ git pull upstream develop
|
|
63
|
-
$ rm -rf node_modules
|
|
64
|
-
$ npm install
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
- Create a new branch to contain your changes:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
$ git checkout -b <new-branch-name>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
- Make your changes.
|
|
74
|
-
- Test your changes.
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
$ npm test
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
- Push your changes back to your fork.
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
$ git push -u origin <new-branch-name>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
1. Open a merge request in the [slugbugblue/trax][trax-repo] repo.
|
|
87
|
-
|
|
88
|
-
## Working with the code
|
|
89
|
-
|
|
90
|
-
This repository uses [XO][xo] for linting and [Prettier][prettier] for
|
|
91
|
-
formatting. Running `npm test` will produce an error if your changes do not
|
|
92
|
-
conform. You should consider installing the [XO plugin][xo-plugin] for your
|
|
93
|
-
editor to have the linting errors highlighted for you and automatically fixed on
|
|
94
|
-
save. You can also run `npx xo --fix` from the command line to fix most linting
|
|
95
|
-
errors.
|
|
96
|
-
|
|
97
|
-
This repository uses [AVA][ava] for writing and running tests. While we want as
|
|
98
|
-
much code coverage as possible for all code, we have a minimum requirement of
|
|
99
|
-
95% of code coverage for the [analysis engine][analyst] and 100% for the [main
|
|
100
|
-
trax engine][engine]. You should be able to get a quick grasp on the testing
|
|
101
|
-
process by simply examining a few of the test files in the [test
|
|
102
|
-
directory][test].
|
|
103
|
-
|
|
104
|
-
[analyst]: src/analyst.js
|
|
105
|
-
[ava]: https://github.com/avajs/ava
|
|
106
|
-
[engine]: src/engine.js
|
|
107
|
-
[howto]: https://opensource.guide/how-to-contribute/
|
|
108
|
-
[howto-mr]: https://opensource.guide/how-to-contribute/#opening-a-pull-request
|
|
109
|
-
[prettier]: https://prettier.io
|
|
110
|
-
[test]: test/
|
|
111
|
-
[trax-repo]: https://gitlab.com/slugbugblue/trax
|
|
112
|
-
[xo]: https://github.com/sidresorhus/xo
|
|
113
|
-
[xo-plugin]: https://github.com/sidresorhus/xo#editor-plugins
|