@@ -82,7 +82,7 @@ const DIRECTION: [[i32; 5]; 4] = [ [1, 2, 3, 4, 5],
82
82
83
83
/// A table to encode each location to a value in bit 31-0 in the bitboard for 4 direction
84
84
#[ rustfmt:: skip]
85
- const MAPMOVEVALUE : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
85
+ const MAPMOVEVALUE : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
86
86
1 <<31 , 1 <<30 , 1 <<29 , 1 <<28 , 1 <<27 , 1 <<26 , 1 <<25 , 1 <<24 , 1 <<23 , 1 <<22 , 1 <<21 , 1 <<20 , 1 <<19 , 1 <<18 , 1 <<17 , 0 ,
87
87
1 <<31 , 1 <<30 , 1 <<29 , 1 <<28 , 1 <<27 , 1 <<26 , 1 <<25 , 1 <<24 , 1 <<23 , 1 <<22 , 1 <<21 , 1 <<20 , 1 <<19 , 1 <<18 , 1 <<17 , 0 ,
88
88
1 <<31 , 1 <<30 , 1 <<29 , 1 <<28 , 1 <<27 , 1 <<26 , 1 <<25 , 1 <<24 , 1 <<23 , 1 <<22 , 1 <<21 , 1 <<20 , 1 <<19 , 1 <<18 , 1 <<17 , 0 ,
@@ -114,7 +114,7 @@ const MAPMOVEVALUE: [[i32; 239]; 4] = [ [// Direction 0
114
114
1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 1 <<19 , 0 ,
115
115
1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 1 <<18 , 0 ,
116
116
1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 , 1 <<17 ] ,
117
- [ // Direction 2
117
+ [ // Direction 2
118
118
1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 1 <<15 , 0 , 0 , 0 , 0 , 0 ,
119
119
1 <<15 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 1 <<14 , 0 , 0 , 0 , 0 ,
120
120
1 <<15 , 1 <<14 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 1 <<13 , 0 , 0 , 0 ,
@@ -148,9 +148,9 @@ const MAPMOVEVALUE: [[i32; 239]; 4] = [ [// Direction 0
148
148
1 <<1 , 1 <<2 , 1 <<3 , 1 <<4 , 1 <<5 , 1 <<6 , 1 <<1 , 1 <<1 , 1 <<1 , 1 <<1 , 1 <<1 , 0 , 0 , 0 , 0 ]
149
149
] ;
150
150
151
- /// A table to encode each location to an index in the bitboard for 4 direction
151
+ /// A table to encode each location to an index in the bitboard for 4 direction
152
152
#[ rustfmt:: skip]
153
- const MAPMOVEIDX : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
153
+ const MAPMOVEIDX : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
154
154
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
155
155
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ,
156
156
2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 0 ,
@@ -166,7 +166,7 @@ const MAPMOVEIDX: [[i32; 239]; 4] = [ [// Direction 0
166
166
12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 0 ,
167
167
13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 0 ,
168
168
14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 ] ,
169
- [ // Direction 1
169
+ [ // Direction 1
170
170
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
171
171
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
172
172
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
@@ -373,18 +373,9 @@ impl List {
373
373
374
374
pub fn shuffle ( & mut self ) {
375
375
let mut rng = thread_rng ( ) ;
376
- let num = self . p_size ;
377
- let mut new_move: Vec < Move > = vec ! [ ] ;
376
+ let num = self . p_size as usize ;
378
377
379
- for x in 0 ..( num as usize ) {
380
- new_move. push ( self . p_move [ x] ) ;
381
- }
382
-
383
- new_move. shuffle ( & mut rng) ;
384
-
385
- for x in 0 ..( self . p_size as usize ) {
386
- self . p_move [ x] = new_move[ x] ;
387
- }
378
+ self . p_move [ ..num] . shuffle ( & mut rng) ;
388
379
}
389
380
}
390
381
@@ -424,12 +415,7 @@ fn pos_is_draw(pos: &Pos) -> bool {
424
415
}
425
416
}
426
417
427
- let mut out = false ;
428
- if found && !pos_is_winner ( pos) {
429
- out = true ;
430
- }
431
-
432
- out
418
+ found && !pos_is_winner ( pos)
433
419
}
434
420
435
421
#[ target_feature( enable = "avx512f,avx512bw" ) ]
0 commit comments