shakmaty-python-binding 0.1.2__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/Cargo.lock +1 -1
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/Cargo.toml +1 -1
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/PKG-INFO +1 -1
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/shakmaty_python_binding.pyi +4 -1
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/src/lib.rs +241 -51
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.github/FUNDING.yml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.github/dependabot.yml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.github/workflows/publish.yml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.github/workflows/test.yml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.gitignore +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/.gitignore +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/misc.xml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/modules.xml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/shakmaty_python_binding.iml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/vcs.xml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/CHANGELOG.md +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/COPYING +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/Cargo_save.toml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/README.md +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/benches/benches.rs +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/dist/shakmaty_python_binding-0.1.0-cp311-cp311-linux_x86_64.whl +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/dist/shakmaty_python_binding-0.1.0.tar.gz +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/dist/shakmaty_python_binding-0.1.1-cp311-cp311-linux_x86_64.whl +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/dist/shakmaty_python_binding-0.1.1.tar.gz +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/main.py +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/pyproject.toml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/rustfmt.toml +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/3check.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/antichess.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/atomic.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/chess960.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/crazyhouse.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/horde.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/horde_insufficient_material.csv +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/horde_insufficient_material.rs +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/perft.rs +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/racingkings.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/random.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/tricky.perft +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/zobrist.csv +0 -0
- {shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/zobrist.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: shakmaty_python_binding
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -88,7 +88,7 @@ class MyChess(object):
|
|
|
88
88
|
def has_queenside_castling_rights(self, color:bool)-> bool:
|
|
89
89
|
...
|
|
90
90
|
|
|
91
|
-
def
|
|
91
|
+
def fullmove_number(self) -> int:
|
|
92
92
|
...
|
|
93
93
|
|
|
94
94
|
def halfmove_clock(self) -> int:
|
|
@@ -100,6 +100,9 @@ class MyChess(object):
|
|
|
100
100
|
def play(self, move:MyMove)-> None:
|
|
101
101
|
...
|
|
102
102
|
|
|
103
|
+
def play_and_return_o(self, my_move_: MyMove) -> tuple[int,int,int,int,int,int,int,int,int,int,int,int]:
|
|
104
|
+
...
|
|
105
|
+
|
|
103
106
|
def number_of_pieces_on_the_board(self)-> int:
|
|
104
107
|
...
|
|
105
108
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
use std::collections::HashSet;
|
|
2
1
|
use std::collections::HashMap;
|
|
3
2
|
use std::vec::Vec;
|
|
4
3
|
|
|
@@ -37,13 +36,13 @@ fn setup_fen<T: Position + FromSetup>(fen: &str) -> T {
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
|
|
40
|
-
|
|
41
39
|
///////////// MOVE
|
|
42
40
|
|
|
43
41
|
#[derive(Eq, Hash)]
|
|
44
42
|
#[pyclass]
|
|
45
43
|
pub struct MyMove {
|
|
46
|
-
chess_move:Move
|
|
44
|
+
chess_move:Move,
|
|
45
|
+
uci:String
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
impl PartialEq for MyMove {
|
|
@@ -57,8 +56,10 @@ impl MyMove {
|
|
|
57
56
|
|
|
58
57
|
#[new]
|
|
59
58
|
pub fn new(uci:&str, my_chess:&MyChess) -> MyMove {
|
|
59
|
+
let chess_move = UciMove::from_ascii(uci.as_bytes()).expect("REASON").to_move(&my_chess.chess).expect("REASON");
|
|
60
60
|
MyMove{
|
|
61
|
-
chess_move:
|
|
61
|
+
chess_move:chess_move,
|
|
62
|
+
uci:uci.to_string()
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -68,7 +69,7 @@ impl MyMove {
|
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
fn uci(&self) -> PyResult<String> {
|
|
71
|
-
Ok(self.
|
|
72
|
+
Ok(self.uci.clone())
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -78,11 +79,158 @@ impl MyMove {
|
|
|
78
79
|
pub fn new_rust(move_:Move) -> MyMove {
|
|
79
80
|
|
|
80
81
|
MyMove {
|
|
81
|
-
chess_move: move_
|
|
82
|
+
chess_move: move_.clone(),
|
|
83
|
+
uci:move_.to_uci(CastlingMode::Standard).to_string()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/////////////// Board state
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
pub struct MyBoardStateRust {
|
|
95
|
+
|
|
96
|
+
pub __str__:String ,
|
|
97
|
+
pub ply:u32,
|
|
98
|
+
pub turn:u8,
|
|
99
|
+
pub is_game_over:bool,
|
|
100
|
+
pub legal_moves:Vec<MyMove>,
|
|
101
|
+
pub number_of_pieces_on_the_board: u32,
|
|
102
|
+
pub has_queenside_castling_rights:bool,
|
|
103
|
+
pub has_kingside_castling_rights:bool,
|
|
104
|
+
pub piece_map:HashMap<u64, (u32,bool)>,
|
|
105
|
+
pub is_attacked_white:bool,
|
|
106
|
+
pub is_attacked_black:bool,
|
|
107
|
+
pub occupied:u64,
|
|
108
|
+
pub pawns:u64,
|
|
109
|
+
pub knights:u64,
|
|
110
|
+
pub bishops:u64,
|
|
111
|
+
pub rooks:u64,
|
|
112
|
+
pub queens:u64,
|
|
113
|
+
pub kings:u64,
|
|
114
|
+
pub promoted:u64,
|
|
115
|
+
pub ep_square:i32,
|
|
116
|
+
pub halfmove_clock:u32,
|
|
117
|
+
pub fullmove_number:u32,
|
|
118
|
+
pub castling_rights:u64,
|
|
119
|
+
pub white:u64,
|
|
120
|
+
pub black:u64,
|
|
121
|
+
pub result:String,
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
impl MyBoardStateRust {
|
|
128
|
+
|
|
129
|
+
pub fn new(
|
|
130
|
+
__str__:&str ,
|
|
131
|
+
ply:u32,
|
|
132
|
+
turn:u8,
|
|
133
|
+
is_game_over:bool,
|
|
134
|
+
legal_moves:Vec<MyMove>,
|
|
135
|
+
number_of_pieces_on_the_board: u32,
|
|
136
|
+
has_queenside_castling_rights:bool,
|
|
137
|
+
has_kingside_castling_rights:bool,
|
|
138
|
+
piece_map:HashMap<u64, (u32,bool)>,
|
|
139
|
+
is_attacked_white:bool,
|
|
140
|
+
is_attacked_black:bool,
|
|
141
|
+
occupied:u64,
|
|
142
|
+
pawns:u64,
|
|
143
|
+
knights:u64,
|
|
144
|
+
bishops:u64,
|
|
145
|
+
rooks:u64,
|
|
146
|
+
queens:u64,
|
|
147
|
+
kings:u64,
|
|
148
|
+
promoted:u64,
|
|
149
|
+
ep_square:i32,
|
|
150
|
+
halfmove_clock:u32,
|
|
151
|
+
fullmove_number:u32,
|
|
152
|
+
castling_rights:u64,
|
|
153
|
+
white:u64,
|
|
154
|
+
black:u64,
|
|
155
|
+
result:&str,
|
|
156
|
+
) -> MyBoardStateRust {
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
MyBoardStateRust {
|
|
160
|
+
__str__:(*__str__).to_string(),
|
|
161
|
+
ply:ply,
|
|
162
|
+
turn:turn,
|
|
163
|
+
is_game_over:is_game_over,
|
|
164
|
+
legal_moves:legal_moves,
|
|
165
|
+
number_of_pieces_on_the_board:number_of_pieces_on_the_board,
|
|
166
|
+
has_queenside_castling_rights:has_queenside_castling_rights,
|
|
167
|
+
has_kingside_castling_rights:has_kingside_castling_rights,
|
|
168
|
+
piece_map:piece_map,
|
|
169
|
+
is_attacked_white:is_attacked_white,
|
|
170
|
+
is_attacked_black:is_attacked_black,
|
|
171
|
+
occupied:occupied,
|
|
172
|
+
pawns:pawns,
|
|
173
|
+
knights:knights,
|
|
174
|
+
bishops:bishops,
|
|
175
|
+
rooks:rooks,
|
|
176
|
+
queens:queens,
|
|
177
|
+
kings:kings,
|
|
178
|
+
promoted:promoted,
|
|
179
|
+
ep_square:ep_square,
|
|
180
|
+
halfmove_clock:halfmove_clock,
|
|
181
|
+
fullmove_number:fullmove_number,
|
|
182
|
+
castling_rights:castling_rights,
|
|
183
|
+
white:white,
|
|
184
|
+
black:black,
|
|
185
|
+
result:(*result).to_string(),
|
|
82
186
|
}
|
|
83
187
|
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#[pyclass]
|
|
192
|
+
|
|
193
|
+
pub struct MyBoardState2 {
|
|
194
|
+
|
|
195
|
+
pub __str__:PyResult<String> ,
|
|
196
|
+
pub ply:PyResult<u32>,
|
|
197
|
+
pub turn:PyResult<u8>,
|
|
198
|
+
pub is_game_over:PyResult<bool>,
|
|
199
|
+
pub legal_moves:PyResult<Vec<MyMove>>,
|
|
200
|
+
pub number_of_pieces_on_the_board: PyResult<u32>,
|
|
201
|
+
pub has_queenside_castling_rights:PyResult<bool>,
|
|
202
|
+
pub has_kingside_castling_rights:PyResult<bool>,
|
|
203
|
+
pub piece_map:PyResult<HashMap<u64, (u32,bool)>>,
|
|
204
|
+
pub is_attacked_white:PyResult<bool>,
|
|
205
|
+
pub is_attacked_black:PyResult<bool>,
|
|
206
|
+
pub occupied:PyResult<u64>,
|
|
207
|
+
pub pawns:PyResult<u64>,
|
|
208
|
+
pub knights:PyResult<u64>,
|
|
209
|
+
pub bishops:PyResult<u64>,
|
|
210
|
+
pub rooks:PyResult<u64>,
|
|
211
|
+
pub queens:PyResult<u64>,
|
|
212
|
+
pub kings:PyResult<u64>,
|
|
213
|
+
pub promoted:PyResult<u64>,
|
|
214
|
+
pub ep_square:PyResult<i32>,
|
|
215
|
+
pub halfmove_clock:PyResult<u32>,
|
|
216
|
+
pub fullmove_number:PyResult<u32>,
|
|
217
|
+
pub castling_rights:PyResult<u64>,
|
|
218
|
+
pub white:PyResult<u64>,
|
|
219
|
+
pub black:PyResult<u64>,
|
|
220
|
+
pub result:PyResult<String>,
|
|
84
221
|
|
|
85
222
|
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
#[pyclass]
|
|
229
|
+
pub struct MyBoardState {
|
|
230
|
+
board_state_rust : MyBoardStateRust
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
86
234
|
/////////////// TABLE BASE
|
|
87
235
|
|
|
88
236
|
|
|
@@ -142,14 +290,84 @@ impl MyChess {
|
|
|
142
290
|
}
|
|
143
291
|
}
|
|
144
292
|
|
|
145
|
-
|
|
146
|
-
Ok(format!("board fen: {}", self.chess.board()))
|
|
147
|
-
}
|
|
293
|
+
|
|
148
294
|
|
|
149
295
|
fn play(&mut self, my_move_: &MyMove) -> PyResult<()> {
|
|
150
296
|
self.chess.play_unchecked(&my_move_.chess_move);
|
|
151
297
|
Ok(())
|
|
152
298
|
}
|
|
299
|
+
|
|
300
|
+
fn play_and_return(&mut self, my_move_: &MyMove) -> PyResult<(String,u32,u8,bool)> {
|
|
301
|
+
self.chess.play_unchecked(&my_move_.chess_move);
|
|
302
|
+
|
|
303
|
+
let a = u32::from(self.chess.fullmoves()) -1;
|
|
304
|
+
let b = self.chess.turn() as u32;
|
|
305
|
+
let c = 2*a+1-b;
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
Ok(
|
|
310
|
+
(
|
|
311
|
+
format!("board fen: {}", self.chess.board()),
|
|
312
|
+
c,
|
|
313
|
+
self.chess.turn() as u8,
|
|
314
|
+
self.chess.is_game_over()
|
|
315
|
+
)
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
fn play_and_return_o(&mut self, my_move_: &MyMove) -> PyResult<(u64,u64,u64,u64,u64,u64,u64,u64,u64,u8,i32,u64)> {
|
|
320
|
+
self.chess.play_unchecked(&my_move_.chess_move);
|
|
321
|
+
|
|
322
|
+
let cas = u64::from(self.chess.castles().castling_rights());
|
|
323
|
+
// let is_game_over = self.chess.is_game_over();
|
|
324
|
+
|
|
325
|
+
let pawns = u64::from(self.chess.board().by_role(Role::Pawn));
|
|
326
|
+
let knights =u64::from(self.chess.board().by_role(Role::Knight));
|
|
327
|
+
let bishops = u64::from(self.chess.board().by_role(Role::Bishop));
|
|
328
|
+
let rooks = u64::from(self.chess.board().by_role(Role::Rook));
|
|
329
|
+
let queens = u64::from(self.chess.board().by_role(Role::Queen));
|
|
330
|
+
let kings = u64::from(self.chess.board().by_role(Role::King));
|
|
331
|
+
let white = u64::from(self.chess.board().by_color(Color::White));
|
|
332
|
+
let black =u64::from(self.chess.board().by_color(Color::Black));
|
|
333
|
+
let turn = self.chess.turn() as u8;
|
|
334
|
+
|
|
335
|
+
let a= self.chess.maybe_ep_square();
|
|
336
|
+
let ep_square;
|
|
337
|
+
|
|
338
|
+
match a {
|
|
339
|
+
Some(x) => {ep_square= i32::from(x) }
|
|
340
|
+
None => {ep_square = i32::from(-1) }
|
|
341
|
+
}
|
|
342
|
+
let promoted = u64::from(self.chess.promoted());
|
|
343
|
+
|
|
344
|
+
Ok(
|
|
345
|
+
(
|
|
346
|
+
cas,
|
|
347
|
+
pawns , knights , bishops,rooks ,queens,kings,white , black,
|
|
348
|
+
turn, ep_square ,promoted )
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
fn copy(&mut self) -> PyResult<MyChess> {
|
|
353
|
+
Ok(MyChess {
|
|
354
|
+
chess: self.chess.clone()
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
fn piece_at(&mut self, square_int:u32)-> PyResult<Option<(bool,u32)>> {
|
|
359
|
+
let square = Square::new(square_int);
|
|
360
|
+
let a: Option<Piece> = self.chess.board().piece_at(square);
|
|
361
|
+
if a.is_none() {
|
|
362
|
+
Ok(None)
|
|
363
|
+
} else{
|
|
364
|
+
Ok(Some((a.unwrap().color as u32 != 0,a.unwrap().role as u32)))
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
fn __str__(&self) -> PyResult<String> {
|
|
369
|
+
Ok(format!("board fen: {}", self.chess.board()))
|
|
370
|
+
}
|
|
153
371
|
|
|
154
372
|
fn ply(&mut self) -> PyResult<u32> {
|
|
155
373
|
let a = u32::from(self.chess.fullmoves()) -1;
|
|
@@ -165,28 +383,26 @@ impl MyChess {
|
|
|
165
383
|
fn is_game_over(&mut self) -> PyResult<bool> {
|
|
166
384
|
Ok(self.chess.is_game_over())
|
|
167
385
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
386
|
+
|
|
387
|
+
// fn legal_moves_dic(&mut self) -> PyResult<HashMap<String,MyMove,>> {
|
|
388
|
+
/// let move_list :MoveList = self.chess.legal_moves();
|
|
389
|
+
// let mut legal_moves_my = HashMap::new();
|
|
390
|
+
// for a_move in move_list {
|
|
391
|
+
// legal_moves_my.push((MyMove::new_rust(a_move.clone()),a_move.clone().to_uci(CastlingMode::Standard).to_string() ));
|
|
392
|
+
// }
|
|
393
|
+
// Ok(legal_moves_my)
|
|
394
|
+
// }
|
|
174
395
|
|
|
175
396
|
fn legal_moves(&mut self) -> PyResult<Vec<MyMove>> {
|
|
176
397
|
let move_list :MoveList = self.chess.legal_moves();
|
|
177
398
|
let mut legal_moves_my = Vec::new();
|
|
178
399
|
for a_move in move_list {
|
|
179
|
-
legal_moves_my.push(MyMove::new_rust(a_move));
|
|
400
|
+
legal_moves_my.push(MyMove::new_rust(a_move.clone()));
|
|
180
401
|
}
|
|
181
402
|
Ok(legal_moves_my)
|
|
182
403
|
}
|
|
183
404
|
|
|
184
405
|
|
|
185
|
-
//fn legal_moves_2(&mut self) -> PyResult<MoveList> {
|
|
186
|
-
// let move_list :MoveList = self.chess.legal_moves();
|
|
187
|
-
// Ok(move_list)
|
|
188
|
-
//}
|
|
189
|
-
|
|
190
406
|
fn number_of_pieces_on_the_board(&mut self)-> PyResult<u32> {
|
|
191
407
|
Ok(self.chess.board().occupied().0.count_ones())
|
|
192
408
|
}
|
|
@@ -202,15 +418,7 @@ impl MyChess {
|
|
|
202
418
|
}
|
|
203
419
|
|
|
204
420
|
|
|
205
|
-
|
|
206
|
-
let square = Square::new(square_int);
|
|
207
|
-
let a: Option<Piece> = self.chess.board().piece_at(square);
|
|
208
|
-
if a.is_none() {
|
|
209
|
-
Ok(None)
|
|
210
|
-
} else{
|
|
211
|
-
Ok(Some((a.unwrap().color as u32 != 0,a.unwrap().role as u32)))
|
|
212
|
-
}
|
|
213
|
-
}
|
|
421
|
+
|
|
214
422
|
|
|
215
423
|
|
|
216
424
|
|
|
@@ -316,7 +524,7 @@ impl MyChess {
|
|
|
316
524
|
|
|
317
525
|
}
|
|
318
526
|
|
|
319
|
-
pub fn
|
|
527
|
+
pub fn fullmove_number(&self) -> PyResult<u32> {
|
|
320
528
|
Ok(u32::from(self.chess.fullmoves()))
|
|
321
529
|
|
|
322
530
|
}
|
|
@@ -332,6 +540,7 @@ impl MyChess {
|
|
|
332
540
|
Ok(u64::from(self.chess.board().by_color(Color::White)))
|
|
333
541
|
}
|
|
334
542
|
|
|
543
|
+
|
|
335
544
|
#[inline]
|
|
336
545
|
pub fn black(&self) -> PyResult<u64> {
|
|
337
546
|
Ok(u64::from(self.chess.board().by_color(Color::Black)))
|
|
@@ -347,26 +556,7 @@ impl MyChess {
|
|
|
347
556
|
}
|
|
348
557
|
}
|
|
349
558
|
|
|
350
|
-
|
|
351
|
-
fn play_modifications(&mut self, to: String) -> PyResult<()> {
|
|
352
|
-
//let uci = to.parse::<UciMove>().expect("valid uci");
|
|
353
|
-
//let m = uci.to_move(&self.chess).expect("legal uci");
|
|
354
|
-
//let a = self.chess.ep_square(EnPassantMode::Legal);
|
|
355
|
-
//let mut epsq :Option<EnPassant>;
|
|
356
|
-
//if a.is_none(){
|
|
357
|
-
// epsq = None;
|
|
358
|
-
|
|
359
|
-
// }else{
|
|
360
|
-
// epsq = Some(EnPassant(a.expect("REASON")));
|
|
361
|
-
|
|
362
|
-
// }
|
|
363
559
|
|
|
364
|
-
let uci = to.parse::<UciMove>().expect("valid uci");
|
|
365
|
-
let _m = uci.to_move(&self.chess).expect("legal uci");
|
|
366
|
-
//self.chess.play_unchecked_modifications(&m);
|
|
367
|
-
Ok(())
|
|
368
|
-
|
|
369
|
-
}
|
|
370
560
|
|
|
371
561
|
}
|
|
372
562
|
|
|
@@ -379,6 +569,6 @@ fn shakmaty_python_binding(_py: Python, m: &PyModule) -> PyResult<()> {
|
|
|
379
569
|
add_classes!(m, MyMove);
|
|
380
570
|
add_classes!(m, MyChess);
|
|
381
571
|
add_classes!(m, MyTableBase);
|
|
382
|
-
|
|
572
|
+
//add_classes!(m, MyBoardState);
|
|
383
573
|
Ok(())
|
|
384
574
|
}
|
|
File without changes
|
|
File without changes
|
{shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.github/workflows/publish.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/.idea/shakmaty_python_binding.iml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shakmaty_python_binding-0.1.2 → shakmaty_python_binding-0.1.4}/tests/horde_insufficient_material.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|