@slugbugblue/trax 0.4.0 → 0.5.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.
File without changes
package/CHANGELOG.md CHANGED
@@ -1,13 +1,30 @@
1
1
  # @slugbugblue/trax
2
2
 
3
- ## 0.3.0
3
+ ## 0.4.0 - 2022-01-17
4
+
5
+ * Testing coverage of `engine.js` is now at 100%
6
+ * Testing revealed a few bugs, which are now fixed
7
+ * The name and signature for provisional move handling,
8
+ which was broken, has been changed. It is now called
9
+ `provisional_moves()` and takes three arguments:
10
+
11
+ * `from`: the normalized position code of the board before the move
12
+ * `to`: the normalized position code of the board after the move
13
+ * `via`: the move notation to go from `from` to `to`
14
+
15
+ ### 0.3.1 - 2022-01-07
16
+
17
+ * Make a faster implementation of `trax.possible_locations()`
18
+ * Display updates for tentative moves
19
+
20
+ ## 0.3.0 - 2021-12-29
4
21
 
5
22
  Display a tentative move on the screen
6
23
 
7
24
  * Add `trax.tentative_icon()` function
8
25
  * `tty.display()` now accepts a tentative move
9
26
 
10
- ## 0.2.0
27
+ ## 0.2.0 - 2021-12-28
11
28
 
12
29
  Breaking changes:
13
30
 
@@ -21,7 +38,7 @@ More convenience:
21
38
  * `Trax.player_num[color]`: or from color to player number
22
39
  * `Trax.other[color]`: easily switch from 'w' to 'b' and back
23
40
 
24
- ## 0.1.0
41
+ ## 0.1.0 - 2021-12-26
25
42
 
26
43
  Initial release:
27
44
 
package/README.md CHANGED
@@ -14,6 +14,10 @@ is to allow Trax to be played programmatically.
14
14
  It can be used as an engine in a web browser
15
15
  or in nodejs.
16
16
 
17
+ The Trax engine now enjoys automated testing
18
+ with 100% code coverage. Any future changes
19
+ to the engine should meet the same standard.
20
+
17
21
  ## Installation
18
22
 
19
23
  ```bash
@@ -49,7 +53,6 @@ until I get around to documenting the functionality.
49
53
  ## Roadmap
50
54
 
51
55
  * Documentation
52
- * Test suite
53
56
  * Command line interface
54
57
  * Bot for solo games (?)
55
58
  * Puzzles
@@ -94,7 +97,7 @@ can never be repaid.
94
97
 
95
98
  ## License
96
99
 
97
- Copyright 2021 Chad Transtrum
100
+ Copyright 2019-2022 Chad Transtrum
98
101
 
99
102
  Licensed under the Apache License, Version 2.0 (the "License");
100
103
  you may not use the files in this project
package/docs/engine.md ADDED
@@ -0,0 +1,64 @@
1
+ # engine.js API documentation
2
+
3
+ This module provides the logic to handle interacting with a Trax game, including
4
+ starting a game, making moves in the game, and determining if the game has been
5
+ won.
6
+
7
+ A few other functions/properties are also provided to assist with determining
8
+ the game state and what actions can be taken on the game.
9
+
10
+ ## Example usage
11
+
12
+ ```javascript
13
+ import Trax from '@slugbugblue/trax'
14
+
15
+ let trax = new Trax()
16
+ console.log(trax.possible_moves()) // "[ '@0/', '@0+' ]" -- initial moves
17
+
18
+ trax.play('@0/')
19
+ console.log(trax.turn) // "2" -- it is player 2's turn
20
+
21
+ trax.play('@1\\')
22
+ console.log(trax.color) // "w" -- it is white's turn
23
+
24
+ trax.play('A0/')
25
+ console.log(trax.over) // "true" -- the game is over
26
+ console.log(trax.winner) // "1" -- player 1 wins
27
+ ```
28
+
29
+ ## API
30
+
31
+ ### Trax object
32
+
33
+ The Trax object can be called as a constructor, but it also has the following
34
+ class properties and methods:
35
+
36
+ - `Trax.variants`: an array of the different rule sets the engine supports.
37
+
38
+ - `Trax.column(col)`: a function to turn a numeric column number into the column
39
+ letter used in Trax notation.
40
+
41
+ ### Trax class
42
+
43
+ #### constructor
44
+
45
+ ```javascript
46
+ trax = new Trax(rules, moves, id)
47
+ ```
48
+
49
+ - `rules
50
+
51
+ ## License
52
+
53
+ Copyright 2019-2022 Chad Transtrum
54
+
55
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
56
+ the files in this project except in compliance with the License. You may obtain
57
+ a copy of the License at
58
+
59
+ http://www.apache.org/licenses/LICENSE-2.0
60
+
61
+ Unless required by applicable law or agreed to in writing, software distributed
62
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
63
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
64
+ specific language governing permissions and limitations under the License.