Draw by repetition scoring ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

Draw by repetition scoring ?

Post by MahmoudUthman »

three questions:
1-My engine evaluates the following as draw " even though it isn't":

Code: Select all

position fen rnbqkbnr/pppppppp/8/8/8/PPPPPPPP/RNBQKBNR/8 w kq - 0 1 moves d3d4 g8f6 e3e4 d7d6 b2d3 e7e6 h2h1 f8e7 e4e5 f6d7 h1e1 b7b6 e2f1 d6e5 d4e5 c8b7 d2e2 c7c5 f3f4 d8c7 f4f5 g7g5 e2h5 c5c4 f5e6 c4d3 e6f7 e8d8 c2d3 d7e5 d3f5 b7f3 a2d2 b8d7 h5h6 c7c3 d2d7 e5d7 h6e6 c3c6 e6e7 d8c7 g2e3 a8d8 e3c4 c6f6 g3g4 h7h5 f2g3 c7b7 c4d6 b7a8 e7f6 d7f6 g3e5 h8h6 h3h4 h5g4 h4g5 h6h1 f1f2 h1e1 f2e1 f6h5 e1f2 d8f8 g5g6 f3d1 d6e8 a7a6 e5d6 f8h8 d6e5
or

Code: Select all

position startpos moves e2e4 c7c5 g1f3 d7d6 d2d4 c5d4 f3d4 g8f6 b1c3 a7a6 f1e2 e7e5 d4b3 f8e7 e1g1 e8g8 c1e3 c8e6 d1d3 b8d7 c3d5 e6d5 e4d5 d7c5 b3c5 d6c5 e2f3 d8c7 c2c4 g7g6 a1e1 h7h5 e3g5 f6e8 g5e7 c7e7 d3e3 e8d6 b2b3 f8c8 e3e5 e7e5 e1e5 c8e8 e5e8 a8e8 f1c1 a6a5 g1f1 g8g7 h2h4 b7b6 g2g3 g7f6 f3e2 e8e7 c1c3 e7e8 f1e1 e8a8 e2d1 a8e8 e1f1 f6e5 d1c2 e5f6 f2f3 e8e7 f1f2 e7e8 c3e3 e8e3 f2e3 f6g7 e3f4 f7f6 g3g4 a5a4 c2d3 a4b3 a2b3 g7h6 g4g5 h6g7 g5f6 g7f6 f4e3 g6g5 h4g5 f6g5 f3f4 g5h6 e3f3 h6g7 f3g3 g7h6 g3h4 d6e8 f4f5 e8d6 f5f6 d6f7 d3e2 f7d6 e2h5 b6b5 c4b5 d6b5 h5e2 b5d4 e2h5
This is supposed to be caused by scoring the first repetition as draw, can this affect the search, for example could the engine choose -"anywhere in the search tree"- a bad move thinking that it's score equals 0 due to repetition instead of a negative move closer to zero?

2-In case this doesn't affect the search in a bad way, can it be solved without losing Elo?

3-Stock-fish does the following :

Code: Select all

// Check if we have an upcoming move which draws by repetition, or
    // if the opponent had an alternative move earlier to this position.
    if (   pos.rule50_count() >= 3
        && alpha < VALUE_DRAW
        && !rootNode
        && pos.has_game_cycle(ss->ply))
    {
        alpha = VALUE_DRAW;
        if (alpha >= beta)
            return alpha;
    }
Why does it return VALUE_DRAW only when it's >=beta and continues the search otherwise ?
MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

Re: Draw by repetition scoring ?

Post by MahmoudUthman »

Please ignore the third one, I was awake for 48 hours, and didn't see that the old repetition code is still there.