Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Napoleon - zobrist.cpp

zobrist.cpp

Caricato da: Crybot
Scarica il programma completo

  1. #include "zobrist.h"
  2.  
  3. namespace Napoleon
  4. {
  5.     ZobristKey Zobrist::Piece[2][6][64];
  6.     ZobristKey Zobrist::Castling[16];
  7.     ZobristKey Zobrist::Enpassant[8];
  8.     ZobristKey Zobrist::Color;
  9.  
  10.     ZobristKey Zobrist::random()
  11.     {
  12.         return rand() ^ ((ZobristKey)rand() << 15) ^ ((ZobristKey)rand() << 30) ^ ((ZobristKey)rand() << 45) ^ ((ZobristKey)rand() << 60);
  13.     }
  14.  
  15.     void Zobrist::Init()
  16.     {
  17.         for (int i=0; i< 2; i++)
  18.         {
  19.             for (int j=0; j<6; j++)
  20.             {
  21.                 for (int k=0; k<64; k++)
  22.                 {
  23.                     Piece[i][j][k] = random();
  24.                 }
  25.             }
  26.         }
  27.  
  28.         Color = random();
  29.  
  30.         for (int i=0; i<16; i++)
  31.         {
  32.             Castling[i] = random();
  33.         }
  34.  
  35.         for (int i=0; i<8; i++)
  36.         {
  37.             Enpassant[i] = random();
  38.         }
  39.     }
  40. }