Check Extensions

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

theturk1234
Posts: 52
Joined: Tue Jul 12, 2016 5:28 am

Check Extensions

Post by theturk1234 »

Hi all,
I'm having trouble with check extensions. I know it should be ridiculously simple to implement but it's causing a crash.
At each node, if we're in check I increment the depth by one. That's it.
But the engine crashes after a short time thinking.
Has anyone experienced this problem? If so, how did you fix it?
I'm sure I'm doing something really simple the wrong way......

David Cimbalista
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Check Extensions

Post by abulmo2 »

theturk1234 wrote:Hi all,
I'm having trouble with check extensions. I know it should be ridiculously simple to implement but it's causing a crash.
At each node, if we're in check I increment the depth by one. That's it.
But the engine crashes after a short time thinking.
Has anyone experienced this problem? If so, how did you fix it?
I'm sure I'm doing something really simple the wrong way......
When a program crash I use a debugger to understand what happens. It is possible your last addition reveal an older bug that was silent.
Richard Delorme
theturk1234
Posts: 52
Joined: Tue Jul 12, 2016 5:28 am

Re: Check Extensions

Post by theturk1234 »

Hm.....I can try that.
But I'm certainly not an expert at using gdb...

David
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: Check Extensions

Post by Desperado »

theturk1234 wrote:Hi all,
I'm having trouble with check extensions. I know it should be ridiculously simple to implement but it's causing a crash.
At each node, if we're in check I increment the depth by one. That's it.
But the engine crashes after a short time thinking.
Has anyone experienced this problem? If so, how did you fix it?
I'm sure I'm doing something really simple the wrong way......

David Cimbalista
Hi,

well, there are simple things you can check immediately without a debugger.

First, your search code should include a check for maximum depth like

Code: Select all


int search(int depth,...)
{
  if(depth == MAXDEPTH)
  {
    return evalScore()
  }

  // do usual stuff...
}

The next thing you might check is your code for repetition detection.
There are existing "long" checks like: Qa1+,Ke2,Qa2+,Ke1,Qa1+,Ke2

The first suggestion will help to avoid a crash. The second suggestion will avoid that the engine will hang-up because of a very deep tree but running into the mentioned pseudo code.

If these points are ok, you might check if the check extension is triggered as expected and if really produces the right value and the maths works well.

Good luck.
theturk1234
Posts: 52
Joined: Tue Jul 12, 2016 5:28 am

Re: Check Extensions

Post by theturk1234 »

Thanks!
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Check Extensions

Post by brtzsnr »

Try AddressSanitizer to find your bug: https://gcc.gnu.org/onlinedocs/gcc/Inst ... tions.html
theturk1234
Posts: 52
Joined: Tue Jul 12, 2016 5:28 am

Re: Check Extensions

Post by theturk1234 »

Thanks!
I think this might enable me to find the bug!

David Cimbalista