@@ -46,6 +46,21 @@ to a position, which return a list of objects (typically, positions).
46
46
47
47
- ` move ` (or ` m ` for short): performs as forward move.
48
48
49
+ - ` legal ` : analyzes the legality of the position and its history.
50
+ This may label the position as:
51
+ - * illegal* (FIDE illegal), when the position is unreachable from
52
+ the starting position via a sequence of legal moves (that is,
53
+ not considering FIDE Article 5.2.2 about "dead positions").
54
+ - * zombie* , when it is FIDE legal, but all possible legal retractions
55
+ are from dead positions.
56
+ - No label on if FIDE legal and non-zombie.
57
+
58
+ This command also analyzes whether a position is alive/dead when the
59
+ position is the result of a retraction or it is part of a longer sequence
60
+ of moves, possibly labeling the position as "dead".
61
+
62
+ - ` DP ` : labels the position as "DP" (dead position) or "alive".
63
+
49
64
- ` flip ` : flips the turn. This also resets the halfmove clock,
50
65
and the en-passant flags to ` ? ` (but preserves castling rights).
51
66
The position(s) after a flip become the "game array", i.e., they
@@ -57,17 +72,17 @@ to a position, which return a list of objects (typically, positions).
57
72
58
73
- ` ep ` : returns the en-passant privileges of the given position.
59
74
60
- - ` DP ` : labels the position as "DP" (dead position) or "alive".
61
-
62
- - A solve command (which stops the potential ` >>= ` chain). The following solve
63
- commands are supported:
75
+ - A solve command. The following solve commands are supported:
64
76
- ` #[0-9]+[.5]? ` : * forced mate* in the given number of moves.
65
77
- ` h#[0-9]+[.5]? ` : * help mate* in the given number of moves.
66
78
- ` h=[0-9]+[.5]? ` : * help stalemate* in the given number of moves.
67
79
- ` hdp[0-9]+[.5]? ` : * help dead position* in the given number of moves.
68
80
- ` h~=[0-9]+[.5]? ` : * help draw* (stalemate or dead) in the given number of
69
81
moves.
70
82
83
+ This transforms the position into the final position of every solution.
84
+ (The monadic chain ` >>= ` may continue from those.)
85
+
71
86
A solve command can be succeded (after a blank space) with a piece type in
72
87
round brackets (to choose from ` p ` , ` n ` , ` b ` , ` r ` , ` q ` , ` k ` ).
73
88
This will constrain the last move to have been performed by a piece of the
@@ -81,11 +96,11 @@ For example:
81
96
```
82
97
// Julio Sunyer, 1923 (The Chess Amateur)
83
98
>>> 4k3/8/8/7K/8/8/8/8 b - - >>= r >>= r >>= h#1
84
- g6xRh5 h8xQh5 then e8g8 h5h7#
99
+ ↶ g6xRh5 ↶ h8xQh5 e8g8 h5h7# 5rk1/8/6K1/7Q/8/8/8/8 w - - 1 2
85
100
nsols 1
86
101
87
102
// Andrew Buchanan, 2001 (1 Retros mailing list 24th Jan)
88
- >>> k7/8/2K5/8/8/8/8/8 ? >>= turn
103
+ >>> k7/8/2K5/8/8/8/8/8 ? >>= legal >>= turn
89
104
b
90
105
nsols 1
91
106
```
@@ -96,80 +111,81 @@ nsols 1
96
111
well-formed positions (exactly one king per side, no pawns on 1st or 8th rank,
97
112
etc) even if they are illegal.
98
113
Furthermore, in virtue of FIDE Article 5.2.2, all positions preceeding a
99
- ** dead** position should be ** alive** .
100
- Our retractor still displays those that are dead, but it labels them.
114
+ * dead* position should be * alive* .
115
+ Our retractor still displays those that are dead, but it labels them if
116
+ the command ` legal ` is used.
101
117
102
118
- We perform minimal legality checks on a position, by checking whether it
103
- admits at least an alive retraction.
104
- Positions that are identified to be illegal with this simple check are labeled
105
- as so and displayed.
119
+ admits at least a retraction.
120
+ This means at the moment our legality analysis is a semi-decision procedure.
121
+ If a position is labeled as "illegal", it is definitely illegal.
122
+ However, non-labeled positions could be legal and escape our current logic.
123
+ * We are working on making this legality check more complete* .
106
124
107
125
- Even though we display illegal and dead (retracted from dead) positions,
108
126
they do not carry on to the next command. For example, 6 possible well-formed
109
127
retractions are shown after the following command:
110
128
```
111
- >>> 8/8/8/8/2Q5/k7/1pP5/K7 w - - >>= r
112
- 8/8/8/8/2Q5/kp6/2P5/K7 b - - ? 0 b3b2
113
- 8/8/8/8/2Q5/k1p5/1PP5/K7 b - - ? 0 (illegal) c3xPb2
114
- 8/8/8/8/2Q5/k1p5/1QP5/K7 b - - ? 0 (dead) c3xQb2
115
- 8/8/8/8/2Q5/k1p5/1RP5/K7 b - - ? 0 (dead) c3xRb2
116
- 8/8/8/8/2Q5/k1p5/1BP5/K7 b - - ? 0 (dead) c3xBb2
117
- 8/8/8/8/2Q5/k1p5/1NP5/K7 b - - ? 0 (dead) c3xNb2
129
+ >>> 8/8/8/8/2Q5/k7/1pP5/K7 w - - >>= r >>= legal
130
+ ↶b3b2 8/8/8/8/2Q5/kp6/2P5/K7 b - - ? 0
131
+ ↶c3xPb2 illegal dead 8/8/8/8/2Q5/k1p5/1PP5/K7 b - - ? 0
132
+ ↶c3xQb2 dead 8/8/8/8/2Q5/k1p5/1QP5/K7 b - - ? 0
133
+ ↶c3xRb2 dead 8/8/8/8/2Q5/k1p5/1RP5/K7 b - - ? 0
134
+ ↶c3xBb2 dead 8/8/8/8/2Q5/k1p5/1BP5/K7 b - - ? 0
135
+ ↶c3xNb2 dead 8/8/8/8/2Q5/k1p5/1NP5/K7 b - - ? 0
118
136
nsols 1
119
137
```
120
138
However, 5 of them were labeled as either illegal or dead.
121
139
If we then apply another command, e.g. ` >>= h=1.5 ` , these 5 will not be
122
140
considered in the analysis, only the very first one
123
- ` 8/8/8/8/2Q5/kp6/2P5/K7 b - - ? 0 b3b2 ` .
141
+ ` 8/8/8/8/2Q5/kp6/2P5/K7 b - - ? 0 ` .
124
142
125
143
- In case our dead position subroutine fails to determine whether a position
126
144
is * dead* , the following error message will be raised:
127
145
```
128
- >>> B2b4/8/4k3/8/1p1p1p1p/1PpP1P1P/K1P4b/RB6 b - - 0 1 >>= hdp0
146
+ >>> B2b4/8/4k3/8/1p1p1p1p/1PpP1P1P/K1P4b/RB6 b - - 0 1 >>= DP
129
147
RuntimeError: CHA failed on B2b4/8/4k3/8/1p1p1p1p/1PpP1P1P/K1P4b/RB6 b - - 0 1
130
148
```
131
149
In a successful execution, every computation regarding dead positions is
132
- * sound* and * correct * in the sense that the tool either finds a helpmate
133
- (proving the position is alive) or definitely proves that the position is dead.
150
+ * sound* in the sense that the tool either finds a helpmate (proving the
151
+ position is alive) or definitely proves that the position is dead.
134
152
135
153
- FEN tokens can be unspecified with ` ? ` , in which case, the tool will consider
136
154
all plausible values of that token. For example, the following considers that
137
155
the en-passant flag takes values ` - ` or ` g6 ` .
138
156
```
139
- >>> 6br/4Bp1k/5P2/5PpK/4B1P1/8/8/8 w - ? ? 100 >>= r
140
- 6br/4Bppk/5P2/5P1K/4B1P1/8/8/8 b - - ? 99 g7g5
141
- nsols 1
157
+ >>> 6br/4Bp1k/5P2/5PpK/4B1P1/8/8/8 w - ? ? 100
158
+ 6br/4Bp1k/5P2/5PpK/4B1P1/8/8/8 w - - ? 100
159
+ 6br/4Bp1k/5P2/5PpK/4B1P1/8/8/8 w - g6 ? 100
160
+ nsols 2
142
161
```
143
162
144
163
- Not all 6 FEN tokens are necessary. If fewer tokens are specified, the
145
- remaining will be filled with ` ? ` . For example:
146
- ```
147
- >>> 8/7Q/8/4BB2/2PP1P2/3NkN2/PP2P1P1/4K2R w >>= r
148
- 8/7Q/8/4BB2/2PPkP2/3N1N2/PP2P1P1/4K2R b K - ? 0 e4e3
149
- 8/7Q/8/4BB2/2PPkP2/3NPN2/PP2P1P1/4K2R b K - ? 0 e4xPe3
150
- 8/7Q/8/4BB2/2PPkP2/3NQN2/PP2P1P1/4K2R b K - ? 0 (illegal) e4xQe3
151
- 8/7Q/8/4BB2/2PPkP2/3NRN2/PP2P1P1/4K2R b K - ? 0 (illegal) e4xRe3
152
- 8/7Q/8/4BB2/2PPkP2/3NBN2/PP2P1P1/4K2R b K - ? 0 e4xBe3
153
- 8/7Q/8/4BB2/2PPkP2/3NNN2/PP2P1P1/4K2R b K - ? 0 e4xNe3
154
- nsols 4
155
- ```
164
+ remaining will be filled with ` ? ` .
156
165
157
166
- When the halfmove clock is specified, it will be considered in the computation
158
167
of retractions. That is, if it is specified to be ` 0 ` , the last move must have
159
168
been a capture or a pawn move. Analogously, when it is strictly positive, all
160
169
retractions will be officer non-captures.
161
170
For example:
162
171
```
163
- >>> k7/8/2K5/8/8/8/8/8 b - - 0 50 >>= r
164
- k7/3K4/2p5/8/8/8/8/8 w - - ? 50 d7xPc6
165
- k7/3K4/2q5/8/8/8/8/8 w - - ? 50 d7xQc6
166
- k7/3K4/2r5/8/8/8/8/8 w - - ? 50 d7xRc6
172
+ >>> k7/8/2K5/8/8/8/8/8 b - - 0 50 >>= r >>= legal
173
+ ↶d7xPc6 k7/3K4/2p5/8/8/8/8/8 w - - ? 50
174
+ ↶d7xQc6 k7/3K4/2q5/8/8/8/8/8 w - - ? 50
175
+ ↶d7xRc6 k7/3K4/2r5/8/8/8/8/8 w - - ? 50
167
176
...
168
177
nsols 21
169
178
```
170
179
but
171
180
```
172
- >>> k7/8/2K5/8/8/8/8/8 b - - 1 50 >>= r
181
+ >>> k7/8/2K5/8/8/8/8/8 b - - 1 50 >>= r >>= legal
182
+ ↶d7c6 dead k7/3K4/8/8/8/8/8/8 w - - 0 50
183
+ ↶d5c6 dead k7/8/8/3K4/8/8/8/8 w - - 0 50
184
+ ↶b5c6 dead k7/8/8/1K6/8/8/8/8 w - - 0 50
185
+ ↶c7c6 zombie k7/2K5/8/8/8/8/8/8 w - - 0 50
186
+ ↶c5c6 dead k7/8/8/2K5/8/8/8/8 w - - 0 50
187
+ ↶d6c6 dead k7/8/3K4/8/8/8/8/8 w - - 0 50
188
+ ↶b6c6 zombie k7/8/1K6/8/8/8/8/8 w - - 0 50
173
189
nsols 0
174
190
```
175
191
@@ -181,14 +197,14 @@ nsols 1
181
197
term ` half-duplex ` next to the specification. For example:
182
198
```
183
199
>>> 8/8/2B5/5Q2/8/4p2P/4k2K/8 w - - >>= h#3 half-duplex
184
- f5b1 e2f2 c6h1 e3e2 b1f1 e2f1n#
200
+ f5b1 e2f2 c6h1 e3e2 b1f1 e2f1n# 8/8/8/8/8/7P/4pk1K/5Q1B b - - 1 3
185
201
nsols 1
186
202
```
187
203
Furthermore, if the term ` duplex ` is specified, both WTM and BTM positions
188
204
will be considered.
189
205
190
206
- For the impatient folk, you can run Deadpos with flag ` --fast ` to
191
- significtly speed-up the analysis of dead positions. This means the analysis
207
+ significantly speed-up the analysis of dead positions. This means the analysis
192
208
may miss some complicated dead positions and there is no way to know about it.
193
209
Use this flag if you want to find cooks (if they exist, they will probably
194
210
be found with this method) or you are designing a problem. However, in order
@@ -197,7 +213,6 @@ nsols 1
197
213
198
214
- You can disable the progress bar with ` --no-progress-bar ` .
199
215
200
- - You can use flag ` --verbose ` to get a more detailed output.
201
216
202
217
## Feedback
203
218
0 commit comments