Why works an oscillating TempoValue?

Discussion of chess software programming and technical issues.

Moderator: Ras

lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Why works an oscillating TempoValue?

Post by lech »

Why in do[null]move works an oscillating TempoValue, and not :

Code: Select all

inline Score Position::value() const {
  return st->value + (side_to_move() == WHITE ? TempoValue / 2 : -TempoValue / 2);
}
Value is used by evaluation only and it looks like a waste of time (TT).
BTW:
I think that In the function:

Code: Select all

/// Position::move_attacks_square() tests whether a move from the current
/// position attacks a given square.
bool Position::move_attacks_square(Move m, Square s) const {

  assert(move_is_ok(m));
  assert(square_is_ok(s));

  Bitboard occ, xray;
  Square f = move_from(m), t = move_to(m);

  assert(square_is_occupied(f));

  if (bit_is_set(attacks_from(piece_on(f), t), s))
      return true;

  // Move the piece and scan for X-ray attacks behind it
  occ = occupied_squares();
  do_move_bb(&occ, make_move_bb(f, t));
  xray = ( (rook_attacks_bb(s, occ)   & pieces(ROOK, QUEEN))
          |(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN)))
         & pieces_of_color(color_of_piece_on(f));

  // If we have attacks we need to verify that are caused by our move
  // and are not already existent ones.
  return xray && (xray ^ (xray & attacks_from<QUEEN>(s)));
}
before testing possible x-ray (rare !) attacks it seems to be good to check if the squares “s” and “f” are on the same line. If not: return false.
Maybe, I can't be friendly, but let me be useful.