flok99

Untitled

Oct 27th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. int eval_surrounders(const libataxx::Position & pos_in)
  2. {
  3.         int score = 0;
  4.  
  5.         for(const auto & sq : pos_in.us()) {
  6.                 const auto destinations_s = libataxx::Bitboard{sq}.singles() & pos_in.us();
  7.                 score += destinations_s.count() == 8;
  8.  
  9.                 const auto destinations_d = libataxx::Bitboard{sq}.doubles() & pos_in.us();
  10.                 score += (destinations_d.count() == 16) * 2;
  11.         }
  12.  
  13.         for(const auto & sq : pos_in.them()) {
  14.                 const auto destinations_s = libataxx::Bitboard{sq}.singles() & pos_in.them();
  15.                 score -= destinations_s.count() == 8;
  16.  
  17.                 const auto destinations_d = libataxx::Bitboard{sq}.doubles() & pos_in.them();
  18.                 score -= (destinations_d.count() == 16) * 2;
  19.         }
  20.  
  21.         return score;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment