@@ -82,7 +82,7 @@ const DIRECTION: [[i32; 5]; 4] = [ [1, 2, 3, 4, 5],
8282
8383/// A table to encode each location to a value in bit 31-0 in the bitboard for 4 direction
8484#[ rustfmt:: skip]
85- const MAPMOVEVALUE : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
85+ const MAPMOVEVALUE : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
8686 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 ,
8787 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 ,
8888 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
114114 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 ,
115115 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 ,
116116 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
118118 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 ,
119119 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 ,
120120 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
148148 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 ]
149149 ] ;
150150
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
152152#[ rustfmt:: skip]
153- const MAPMOVEIDX : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
153+ const MAPMOVEIDX : [ [ i32 ; 239 ] ; 4 ] = [ [ // Direction 0
154154 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
155155 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ,
156156 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
166166 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 , 0 ,
167167 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 0 ,
168168 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 ] ,
169- [ // Direction 1
169+ [ // Direction 1
170170 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
171171 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
172172 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 0 ,
@@ -373,18 +373,9 @@ impl List {
373373
374374 pub fn shuffle ( & mut self ) {
375375 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 ;
378377
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) ;
388379 }
389380}
390381
@@ -424,12 +415,7 @@ fn pos_is_draw(pos: &Pos) -> bool {
424415 }
425416 }
426417
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)
433419}
434420
435421#[ target_feature( enable = "avx512f,avx512bw" ) ]
0 commit comments