open-index/open-npm huggingface dataset:
npm package: @slugbugblue/trax-analyst
Description: Trax analyst engine
Author: Chad Transtrum
Latest version: 0.14.0

# Trax Analyst

This project aims to provide tools for analyzing Trax games in Javascript.

## Description

Trax is a two-player boardless board game invented by David Smith. For more
information about Trax, including its [rules][traxrules] and
[history][traxhistory], see the official website at [traxgame.com][traxgame].

The goal of this javascript project is to allow Trax to be analyzed
programmatically. Eventually this will include the ability for a strong computer
opponent, however, this is still a work in progress.

The main driver for this effort is the [slugbugblue.com][sbb] website, with the
initial goal of getting a decent computer player for the [Trax
puzzles][trax-puzzles] available there.

### Analysis

The analysis engine is provided in `analyst.js`, and it can be used as follows:

```javascript
import { Trax } from '@slugbugblue/trax'
import { analyze } from '@slugbugblue/trax-analyst'

let trax = new Trax('trax', '@0/ @1\\')

let analysis = analyze(trax)

console.log('Edge analysis:', analysis.edge)
console.log('Threat analysis:', analysis.threats)
console.log('Score analysis:', analysis.scores)
```

For additional information, refer to the [analyst.js
documentation][docs-analyst].

### Threats database

The threats database is currently hand-coded in `threats.js`, so refer to that
file if you want to try to update the analysis engine's understanding of
threats.

## Roadmap

- Improve the threats database / analysis engine.
  - Bot should choose the strongest defense for each puzzle.
  - Bot should be able to win all puzzles.
  - Analysis should recognize line threats.

## Support

This project is built by [Chad Transtrum][ctrans] for [slugbugblue.com][sbb].
Issues can be opened on the [gitlab project page][repo].

## Contributing

[Contributions are welcome][contributing]. Ideally in the form of pull requests,
but feel free to open an issue with a bug report or a suggestion as well.

## License

Copyright 2019-2026 Chad Transtrum

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
the files in this project except in compliance with the License. You may obtain
a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

[contributing]: CONTRIBUTING.md
[ctrans]: mailto:chad@transtrum.net
[docs-analyst]: docs/analyst.md
[repo]: https://gitlab.com/slugbugblue/trax-analyst
[sbb]: https://slugbugblue.com/
[trax-puzzles]: https://gitlab.com/slugbugblue/trax-puzzles
[traxgame]: http://traxgame.com/
[traxhistory]: http://www.traxgame.com/about_history.php
[traxrules]: http://www.traxgame.com/about_rules.php
npm package: @slugbugblue/trax-puzzles
Description: Trax puzzles
Author: Chad Transtrum
Latest version: 0.7.1

# Trax Puzzles database

The puzzles database contains puzzles that I've been using to test the [Trax
analysis engine][trax-analyst], publicly available puzzles from [the
traxgame.com puzzles page][traxpuzzles], and [puzzles][book1] [curated][book2]
by [Martin M. S. Pedersen][traxplayer].

## Usage as an npm module

Installation:

```bash
npm install @slugbugblue/trax-puzzles
```

Usage:

```javascript
import { Trax } from '@slugbugblue/trax'
import { levels, puzzles, sources } from '@slugbugblue/trax-puzzles'

console.log('Levels:', levels.join(', '))
console.log('Puzzles:', puzzles.map(p => p.id).join(', ')
console.log('Sources:', Object.values(sources).map(s => s.name).join(', ')

const puzzle = puzzles[0]
console.log(`${puzzle.id}: ${puzzle.notation}`)
const trax = new Trax(puzzle.game, puzzle.notation)
trax.play('A0/')
console.log(trax.notation)
```

## Software License

Software Copyright 2022-2026 Chad Transtrum

The software in this project is licensed under the Apache License, Version 2.0
(the "License"); you may not use the files in this project except in compliance
with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.

## Puzzle License

The majority of the puzzles are also licensed under the Apache License, Version
2.0. However, some individual puzzles or collections of puzzles may be licensed
under additional terms. If so, the information for that license is noted in the
puzzle collection. Copyright infromation for each puzzle is also included in the
puzzle collection.

[book1]: https://gnutrax.com/book
[book2]: https://gitlab.com/traxplayer/trax-puzzles
[trax-analyst]: https://gitlab.com/slugbugblue/trax-analyst
[traxplayer]: mailto:traxplayer@gmail.com
[traxpuzzles]: http://www.traxgame.com/games_puzzles.php
npm package: @slugbugblue/trax-tty
Description: Simple tty graphics for displaying trax games
Author: Chad Transtrum
Latest version: 1.3.1

# trax-tty

This javascript module provides a simple to use interface for displaying a Trax
game on a tty console (ie, from nodejs).

Usage:

```javascript
import { Trax } from '@slugbugblue/trax'
import * as tty from '@slugbugblue/trax-tty'

const game = new Trax('trax', '@0/ A0+')
const players = ['first player', 'player 2']
tty.display(game, players)
```

## Environment variables

The tty display can use fancy characters to separate the player names and moves,
and tries to determine characters automatically from the environment.

It prefers a rounded bubble look, using characters available from the
[nerdfonts][nerdfonts] collection, and will default to that if it detects either
`NERDFONT` or `NERDFONTS` set in the environment.

If that is not found, it will next choose an angled look using characters from
[powerline][powerline], and will default to that if it detects any of
`POWERLINE`, `P9K_TTY`, or `P9K_SSH` set in the environment.

Lacking either of those, it will then choose a block look using characters
available in all terminals.

However, if you want to override any of these defaults, you can choose to set
`TRAX_TTY_LEFT` and `TRAX_TTY_RIGHT` to set the left and right characters. To
completely disable the fancy printouts, set `TRAX_TTY_PLAIN=true`.

See the [source](tty.js) for more details.