Skip to main content

figrid_board/
lib.rs

1//! A library for the Five-in-a-Row (Gomoku) game.
2//!
3//! Starting from 0.4.0 the primary engine is NNUE-based (powered by the
4//! [`noru`](https://crates.io/crates/noru) core). The pre-0.4 symbolic
5//! evaluator, rule/rec/tree stack, and generic `Eval<SZ>` trait live under
6//! the [`legacy`] module — it is preserved alongside the new NNUE engine
7//! so the original `pbrain-figrid-legacy` executable and any 0.3.x
8//! downstream users still work. This preservation is a maintainer choice,
9//! not a promise of ABI stability.
10
11pub mod board;
12pub mod book;
13pub(crate) mod candidate_local_ensemble;
14pub(crate) mod candidate_ranker;
15#[cfg(feature = "codebook-eval")]
16pub mod codebook_eval;
17pub(crate) mod codebook_sidecar;
18pub mod coord;
19pub mod d4_hash;
20pub mod eval;
21#[cfg(feature = "codebook-eval")]
22pub mod factored_codebook;
23pub mod features;
24pub mod heuristic;
25pub mod pattern_dense;
26pub mod pattern_table;
27pub(crate) mod relation_fusion_gate;
28pub(crate) mod relation_lite;
29#[doc(hidden)]
30pub mod rq423_root_accept;
31pub mod search;
32pub mod threat_field;
33pub mod transposition;
34pub mod tss;
35pub mod vct;
36#[cfg(feature = "codebook-eval")]
37pub(crate) mod white_root_order;
38
39pub mod legacy;
40
41pub use board::{
42    BOARD_SIZE, BitBoard, Board, GameResult, Move, NUM_CELLS, RuleSet, Stone, to_idx, to_rc,
43};
44pub use coord::{Coord, Coord15, Coord20, CoordState, Rotation};
45pub use eval::{IncrementalEval, evaluate};
46pub use features::GOMOKU_NNUE_CONFIG;
47pub use heuristic::{DIR, LineInfo, scan_line};
48pub use search::{
49    MovePickerStats, SearchProfileSnapshot, SearchResult, SearchShapeStats, Searcher,
50};
51pub use threat_field::IncrementalThreatField;
52pub use tss::{
53    DependencyCandidateArms, DependencyQuietCandidate, Q1CandidateAttempt, Q1DefenseAttempt,
54    Q1DefenseOutcome, Q1TssConfig, Q1TssResult, Q1TssStopReason, QuietThreatCandidate,
55    QuietThreatConfig, ResponseRelevanceAudit, audit_quiet_response_relevance,
56    classify_move_with_directions, directional_aggregation_mismatches,
57    generate_dependency_quiet_candidates, generate_quiet_threat_candidates, search_q1_tss_root,
58};
59pub use vct::{
60    VctConfig, VctSearchResult, VctSearchStats, search_vct, search_vct_audit_json,
61    search_vct_with_stats,
62};
63#[cfg(feature = "cb-p1-audit")]
64pub use vct::dfpn::{
65    BoundedDfpnConfig, BoundedDfpnSession, DfpnCertificateReplay, DfpnCheckpoint, DfpnError,
66    DfpnStatus, DfpnWidthBin,
67};
68
69/// Possible errors returned from this crate.
70#[derive(Clone, Debug, PartialEq)]
71#[repr(u8)]
72pub enum Error {
73    ParseError,
74    InvalidCoord,
75    CoordNotEmpty,
76    RecIsEmpty,
77    RecIsFull,
78    RecIsFinished,
79    ItemNotExist,
80    TransformFailed,
81    CursorAtEnd,
82}