1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! φ-D scaffold — a **global/spatial** feature source (INERT, not wired).
//!
//! φ-A/φ-B adapt a head over a **local** patch: the net's penultimate over a 9×9
//! window around the move. Anything the search needs to learn about *global* board
//! structure (overall shape, long-range interactions) is invisible to a local φ.
//! Generalizing the online adaptation over local features is therefore a lever, not a
//! ceiling-breaker on its own. The design mitigation is to make φ **pluggable** — the
//! [`super::net::FeatureSource`] trait, now in place — so a global encoder can feed the
//! **same** adapt rule `θ += α_θ(φ_chosen − Σ p_m φ_m)`. That is φ-D.
//!
//! This module is the **compilable proof that the trait is sufficient for φ-D**, and
//! the drop-in point. It is deliberately **inert**: the bodies are `unimplemented!()`
//! and nothing constructs or installs it. Building it for real is deferred until a
//! measurement justifies the investment (the project's *don't-assume-test* rule). When
//! that day comes:
//!
//! 1. Train a small whole-board encoder (a conv / occupancy crop over the
//! D4-canonical board, reusing the encoder ideas already in
//! [`super::position`]); its penultimate is `φ_global(s)` (per *state*) or
//! `φ_global(s, m)` (per *move*, by encoding the post-move board).
//! 2. Fill the methods below: `key_and_input` keys by a **board hash** (the
//! `PatchKey` slot is just an opaque 256-bit key, not necessarily a *patch*) and
//! returns the board encoding; `compute_features` runs the encoder.
//! 3. Install it where the search reads its φ source — today the armed `NeuralPrior`
//! in [`super::feat`]; φ-D generalises that slot to any `FeatureSource` (a small
//! follow-up: hold `Arc<dyn FeatureSource>` there).
//!
//! This would also **unify with the value line**: a whole-board encoder is exactly the
//! representation [`super::position`] / the value net use, so φ-D could share it.
// scaffold: defined to pin the φ-D seam, not yet constructed
use PatchKey;
use FeatureSource;
use crate;
/// A global/spatial φ source (φ-D). Holds a trained whole-board encoder (TBD) and
/// the feature dimension. Inert until built — see the module note.