## 0.7.0
- enable the lint `#![deny(clippy::cast_precision_loss)]` for jja library and fix
offending code.
- edit learned to use buffered I/O, rather than direct I/O during PGN conversion to
improve efficiency, especially with huge opening books.
- edit learned to display a progress bar during PGN conversion.
- CTG interface has seen many **breaking change**s to make the interface leaner,
with regards to the recent mmap changes. As a result, the function
`jja::ctg::find_piece` returns an `Option<i32>` rather than a `Result<i32,
std::io::Error>`, the functions `jja::ctgbook::CtgBook::extract_all{,2}` return a
`CtgTree` rather than a `Result<CtgTree, std::io::Error>`, and the function
`jja::ctgbook::CtgBook::lookup_moves` returns an `Option<Vec<CtgEntry>>` rather
than a `Result<Option<Vec<CtgEntry>>, std:io::Error>`.
- edit now uses a much more efficient PGN converter implementation which does not
load the whole tree of variations in memory. This makes it possible to convert
huge opening book files into PGN without running out of system memory. Moreover,
the PGN converter now respects the `-f, --fen`, and `-p, --pgn` arguments of `jja
edit` so it is possible to convert a subtree of the opening book into PGN. See the
respective issues [#14](
https://todo.sr.ht/~alip/jja/14), and
[#16](
https://todo.sr.ht/~alip/jja/16) for more details. This change deprecates
the function `jja::chess::pgn_from_tree`, it is recommended to use the new
`write_pgn` function of the respective opening book file.
- `jja::polyglotbook::PolyGlotBook` implementation has seen many improvements to be
a leaner interface. `PolyGlotBook::get{,_key}` functions no longer panic on
invalid indexes, rather return an `Option<BookEntry>` rather than a `BookEntry`.
This implementation avoids an ugly hack to map a dummy anonymous memory region for
PolyGlot books with zero-size to allow creating PolyGlot books from scratch (e.g:
`touch new-file.bin && jja edit -i new-file.bin`). As these functions are public,
this is a **breaking change**.
- merge now supports merging BrainLearn experience files together. The option
`--weight-cutoff` has been renamed to `--cutoff` and now supports filtering out by
min depth in BrainLearn experience files.
- edit now supports editing BrainLearn experience files. In-place editing of such
files is also supported.
- reduce minimum supported Rust version (MSRV) from `1.70` to `1.64` for portability.
- bring back the dependency on `is_terminal` crate rather than depending on >=rust-1.70.
- downgrade `pgn-reader` crate from `0.25` to `0.24`.
- downgrade `shakmaty` crate from `0.26` to `0.25`.
- upgrade `regex` crate from `1.8` to `1.9`.
- upgrade `smallvec` crate from `1.10` to `1.11`.
- The `progress_bar` member of `jja::obkbook::ObkBook` has been removed, in return
the public functions `jja::obkbook::ObkBook::{tree,traverse_tree}` require an
optional reference to a progress bar now. This avoids a needless clone of the
progress bar and it is a **breaking change**. Moreover, the function
`jja::obkbook::ObkBook::read_moves` has been renamed to `load` which is again a
**breaking change**.
- find now memory maps the OBK opening book files rather than reading the whole file
into memory at once for efficiency. This caused a change in public function
signatures of `jja::obkbook::ObkBook::{read_moves,traverse_tree,tree}` which is a
**breaking change**.
- dump learned `binary` format to dump PGNs in PostgreSQL binary output format. This
brings in a dependency on crate `pgcopy`.
- find now memory maps the PolyGlot opening book files rather than maintaining a
`BufReader<File>` handle to them. This removes the `book` public member of
`jja::polyglotbook::PolyGlotBook`, and changes signatures of public functions
`jja::polyglotbook::PolyGlotBook::{lookup_moves,tree}` which is a **breaking
change**. This also changes names of the public functions
`jja::polyglotbook::PolyGlotBook::{find_book_key,read_book_entry,read_book_key}`
to `jja::polyglotbook::PolyGlotBook::{find,get,get_key}` respectively which is
again a **breaking change**. Moreover `jja::polyglotbook::PolyGlotBook`'s default
iterator implementation has been changed to iterate over single book entries. New
function introduced `jja::polyglotbook::PolyGlotBook::into_iter_grouped()` may be
used to iterate over entries grouped by key.
- check for whether standard error is a TTY, rather than standard output when
displaying progress bars. This allows commands such as dump to display progress
bars during execution.
- optimize the stockfish hash function implementation, making it almost double as
fast.
- hash learned `-B`, `--benchmark`, and `-I`, `--benchmark-iterations` to benchmark
Stockfish and Zobrist hash functions. This brings in a dependency on
`benchmarking` crate.
- Avoid translating CSV headers of ABK entries in `jja find` output. Note, this
change is for CSV output only which is printed when the output is not a TTY or the
option `--porcelain=csv` is given.
- The `progress_bar` member of `jja::ctgbook::CtgBook` has been removed, in return
the public functions `jja::ctgbook::CtgBook::extract_all{,2}` require an optional
reference to a progress bar now. This avoids a needless clone of the progress bar
and it is a **breaking change**.
- avoid needless conversion to and from EPD in `jja::ctgbook::CtgBook` functions
improving efficiency. The function `jja::ctgbook::CtgBook::lookup_moves` now
accepts a `&dyn shakmaty::Position` rather than an EPD string which is a
**breaking change**.
- drop unused public functions `jja::ctg::find_piece`, `jja::ctg::decode_fen_board`,
`jja::ctg::invert_board`, `jja::ctg::needs_flipping`, `jja::ctg::flip_board`
which is a **breaking change**.
- quote now also accepts a search term as a case-insensitive regular expression as
well as a quote index.
- The `progress_bar` member of `jja::abkbook::AbkBook` has been removed, in return
many public functions of `jja::abkbook::AbkBook` require an optional reference to
a progress bar now. This avoids a needless clone of the progress bar and it is a
**breaking change**.
- find now memory maps the ABK opening book files rather than reading the whole file
into memory at once for efficiency. `jja::abkbook::AbkBook` no longer implements
`Clone` which is a **breaking change**.
- edit now uses buffered writing when converting books to the ABK opening book
format which improves efficiency. The function `jja::AbkBook::write_file` has been
changed to take an argument a `BufWriter<W: Seek + Write>` rather than a `File`
which is a **breaking change**.
- the positions table, `p`, in jja-0 databases now have an index on id, `p_idx` so
as to be able to query for Zobrist hash collisions more efficiently.
- info prints file type in uppercase rather than lowercase now.
- edit learned to print Polyglot book information after a successful CTG conversion,
like we already do for CTG to ABK conversions.
- CTG gained support for the full range of NAGs, `$0 - $255`, thus edit no longer
panics when stumbling upon a previously unsupported NAG. Note, only the move
assessments, `$1 - $9`, are used in Polyglot weight and ABK priority calculation
during edit. Other NAGs are merely used for display for the find subcommand. Note,
this changes the `jja::ctg::Nag` public type, and hence is a **breaking change**.
- dump learned `-f=<FORMAT>`, `--format=<FORMAT>` argument to choose the dump format
of PGN dumps. This option has no effect on non-PGN dumps. The function
`jja::pgn::pgn2csv` has been renamed to `jja::pgn::pgn_dump` which is a
**breaking change**.
- prioritize CTG coloured move recommendations over Numeric Annotation Glpyhs (NAGs)
in ABK priority calculation. edit learned three command-line parameters which are
`--color-priority-green`, `--color-priority-blue`, and `--color-priority-red`.
Their default values are `9`, `5`, and `1` respectively.
- make learned `--min-wins` which can be used to filter moves by their win count.
The default value is `0` which has no effect.
- prioritize CTG coloured recommendations over Numeric Annotation Glpyhs (NAGs) in
Polyglot weight calculation. edit learned three command-line parameters which are
`--color-weight-green`, `--color-weight-blue`, and `--color-weight-red`. Their
default values are `10000`, `1000`, and `1` respectively.
- CTG numerical annotation glyph `7` which is a forced move is now supported.
Previously, we mistakenly used `8` which was an only move, not a forced move.
Although the distinction is not really clear, we've implemented `ctg::Nag::Only`
in addition to `ctg::Nag::Forced`, and the corresponding command-line flags for
jja edit are `--nag-weight-only=<WEIGHT>`, and `--nag-priority-only=<PRIO>`. Both
defaults are identical to the default values of `--nag-weight-forced`, and
`--nag-priority-forced`.
- **important fix** `jja::CtgBook::search_position` function from mistakenly missing
some positions causing some huge CTG books, larger than ~2,5-3G, to be seen as
having 0 positions during edit, or causing position lookups to fail during find. A
multiplication overflow in `jja::CtgBook::read_page` function is also fixed.
- make informs user about the `--{win,draw,loss}-factor` values during filtering as
they're also important in determining weight, and preserval of entries.
- fix a bug in make where negative values in `--draw-factor`, and `--loss-factor`
was not counted as deficits.
- dump and restore learned an experimental PGN to an array of chess position Zobrist
keys and setups in streaming JSON. restore can save these dump into a sqlite3
database with `.jja-0` extension. The format of this file is **experimental**, and
is subject to change. Once this format is stable, the extension `.jja-1` is going
to be used. We're using this format currently only to detect Zobrist hash
collisions.
- use the [`XorShift`](
https://www.jstatsoft.org/v08/i14/paper) random number
generator to randomly pick moves during random playouts using the play command. This
algorithm is cryptographically insecure but is very fast. See the benchmark
[here](
https://git.sr.ht/~alip/jja/commit/b265 ... 80b528919b)
- **breaking change**: `jja::quote::print_quote` now requires a second argument which
is a boolean which specifies whether the output should be formatted with ANSI
colour codes or not. By default, when the standard output is not a TTY,
`print_quote` will now print quote, and author information without styling.
- fix PGN dumps to produce proper JSON arrays, previously the array markers `[]`
were erroneously not printed out.