]> git.sesse.net Git - stockfish/commitdiff
Better self-document init_zobrist()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 12 Jun 2011 10:46:24 +0000 (11:46 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 12 Jun 2011 10:50:19 +0000 (11:50 +0100)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitboard.cpp
src/position.cpp

index 44e00da0a4cb25f4257a643e716da49c51783064..2fd0cadaaadf86c1cdd463c4dd8cb33f3275e97d 100644 (file)
@@ -212,8 +212,8 @@ void init_bitboards() {
                      {}, {}, {}, { 9, 7, -7, -9, 8, 1, -1, -8 } };
 
   for (Color c = WHITE; c <= BLACK; c++)
                      {}, {}, {}, { 9, 7, -7, -9, 8, 1, -1, -8 } };
 
   for (Color c = WHITE; c <= BLACK; c++)
-      for (Square s = SQ_A1; s <= SQ_H8; s++)
-          for (PieceType pt = PAWN; pt <= KING; pt++)
+      for (PieceType pt = PAWN; pt <= KING; pt++)
+          for (Square s = SQ_A1; s <= SQ_H8; s++)
               for (int k = 0; steps[pt][k]; k++)
               {
                   Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
               for (int k = 0; steps[pt][k]; k++)
               {
                   Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
index 91fe7ab4506d9b11c85f626412dbf2be38ae77a0..32321b89c6fd51da27fa6ef3820c7ed02e026315 100644 (file)
@@ -1793,16 +1793,17 @@ bool Position::is_mate() const {
 
 void Position::init_zobrist() {
 
 
 void Position::init_zobrist() {
 
-  int i,j, k;
   RKISS rk;
 
   RKISS rk;
 
-  for (i = 0; i < 2; i++) for (j = 0; j < 8; j++) for (k = 0; k < 64; k++)
-      zobrist[i][j][k] = rk.rand<Key>();
+  for (Color c = WHITE; c <= BLACK; c++)
+      for (PieceType pt = PAWN; pt <= KING; pt++)
+          for (Square s = SQ_A1; s <= SQ_H8; s++)
+              zobrist[c][pt][s] = rk.rand<Key>();
 
 
-  for (i = 0; i < 64; i++)
-      zobEp[i] = rk.rand<Key>();
+  for (Square s = SQ_A1; s <= SQ_H8; s++)
+      zobEp[s] = rk.rand<Key>();
 
 
-  for (i = 0; i < 16; i++)
+  for (int i = 0; i < 16; i++)
       zobCastle[i] = rk.rand<Key>();
 
   zobSideToMove = rk.rand<Key>();
       zobCastle[i] = rk.rand<Key>();
 
   zobSideToMove = rk.rand<Key>();