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
//! A chess helpmate solver and unwinnability detector.
//!
//! Given a position and an intended winner, determines whether a helpmate is
//! achievable (a sequence of legal moves ending in checkmate by the intended
//! winner) or proves that none exists.
//!
//! Note that in a helpmate both players cooperate toward that goal: the
//! intended winner delivers checkmate, but not necessarily by force.
//!
//! See the [README](https://github.com/miguel-ambrona/chasolver#readme) for
//! the background motivating this crate, and for usage examples.
// Not part of the public API; keeps the README's usage example under test
// without rendering the whole README as a docs.rs page.
;
use ;
use ;
/// Result of a [`winnability`] analysis for the intended winner.
/// Full helpmate search for `intended_winner`.
///
/// Returns `Some` result if the analysis is successful:
/// - [`Winnability::Winnable`] if the position is winnable for the intended
/// winner, together with a supporting helpmate sequence.
///
/// - [`Winnability::Unwinnable`] if no helpmate exists.
///
/// Returns `None` if winnability could not be decided on this position.
/// Fast but incomplete check for unwinnability; cheaper than [`winnability`]
/// when a mating line isn't needed.
///
/// Returns `true` if the position is provably unwinnable for `intended_winner`,
/// `false` if the analysis is inconclusive (the position may still be
/// unwinnable).