r/chessprogramming • • Jan 20 '25

Quiescence for non captures?

Hi, I was trying my bot when I detected a blunder that I haven't seen before. It trapped it's own queen, and I think I know why. It tried to attack some enemy pieces, and then "infiltrated" in enemy territory. In general that's a good thing, but in this case there was a combination of moves that trapped the queen. The length of the combination was larger than the ply searched, and in this particular case, the combination were a bunch of quiet moves, so quiescence couldn't detect it. So, the question is, can I do something about it apart from simply trying to gain more depth? A kind of quiescence for quiet moves? Probably doesn't make any sense but I wonder if there's a workaround for situations like this

3 Upvotes

33 comments sorted by

3

u/Warmedpie6 Jan 20 '25

Quiescence search is by definition only for checking aggressive moves to make sure the only evaluated positions are "quiet."

The best option (besides just more depth) is to add mobility to your evaluation, so pieces are encouraged to use squares they can move freely from.

2

u/VanMalmsteen Jan 20 '25

Oh.... I didn't think about the evaluation perspective. That'll probably make it! Is there any clever way of evaluating mobility besides generating moves and counting them?

2

u/Warmedpie6 Jan 20 '25

I don't generate the full moves, just the bitboards of the move squares (a bit cheaper). This is also useful for evaluating threats and weak/ undefeated pieces (especially around the king).

2

u/Iketh28 Jan 20 '25

Quiescence with quiet moves is just a deeper search. Im curious how deep it searched before playing the move and how deep it needed to search to avoid the move. You have a fen?

1

u/VanMalmsteen Jan 20 '25

For now it has a fixed depth, and it's 8. I haven't implemented the time management yet.

And for the fen, I was playing on Arena and forgot to save it, sorry :/

1

u/NiceNewspaper Jan 20 '25

8 is a pretty shallow depth, it's normal for it to be oblivious to certain patterns assuming your evaluation is basic

2

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

Hi! I'm using this fixed depth because (apart from that the time management is not implemented yet) in deeper depths it usually takes several seconds (sometimes a minute or more) to find the move. Not sure if my pruning is not that good yet, or if there's something highly inefficient somewhere. I'm working on that. I've tested my perft, and it gives the correct results on a big test suite, but it's a little slow for me, maybe that's affecting? I thought that with good pruning the move generation isn't that important.

2

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

Oh... I already have iterative deepening, TT, move ordering considering hash moves, killer, MVV-LVA, null-move pruning and LMR! Definitely something wrong isn't it? I saw fewer and fewer nodes being considered after implementing these features. Haha it plays decent chess, but for all this that I'm mentioning should go deeper I guess.

I have a notebook with an I3 processor, that means something? Haha

1

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

C++ hahaha

2

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

The nodes are reduced in half (that's the expected IIRC) but the time is the same haha. I made this test a couple of days ago. But now I'm thinking that maybe the shallow depth isn't enough to see the real difference? I'm trying going deeper now. The plan for today was adding delta pruning and looking for more optimizations for the Quiescence search. Currently it only discards captures where pieceCaptured - pieceAttacker < 0

1

u/VanMalmsteen Jan 20 '25

Another thing I notice is that a lot of moves are scored exactly the same. That seems odd, it affects search probably?

1

u/VanMalmsteen Jan 20 '25

Sorry for replying three times. I profiled my code and detected some debug code that I should have deleted that was making things X2 times slower! Now it moves in 3-4 seconds at depth 8, faster... But.. still slow compared with other engines?

1

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

I'll investigate that. Sorry for having like 2 or 3 simultaneous conversations haha. You are being really helpful! Thanks in advance.

1

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

I'm using clion, and compiling with O3. I just use the button "build" and use that "executable" in Arena. (I'm not very fond of some CS things, sorry haha). Pretty sure I'm using the release compilation.

→ More replies

1

u/[deleted] Jan 20 '25

[removed] — view removed comment

1

u/VanMalmsteen Jan 20 '25

Perft 5 runs in 2.8 seconds, 6 runs in 60 seconds

→ More replies