Check Extensions

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
theturk1234
Posts: 52
Joined: Tue Jul 12, 2016 3:28 am

Check Extensions

Post by theturk1234 » Thu Mar 02, 2017 4:27 pm

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: 131
Joined: Fri Dec 16, 2016 10:04 am
Contact:

Re: Check Extensions

Post by abulmo2 » Thu Mar 02, 2017 4:31 pm

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 3:28 am

Re: Check Extensions

Post by theturk1234 » Thu Mar 02, 2017 4:35 pm

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

David

User avatar
Desperado
Posts: 635
Joined: Mon Dec 15, 2008 10:45 am

Re: Check Extensions

Post by Desperado » Thu Mar 02, 2017 5:08 pm

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 3:28 am

Re: Check Extensions

Post by theturk1234 » Fri Mar 03, 2017 5:58 am

Thanks!

brtzsnr
Posts: 426
Joined: Fri Jan 16, 2015 3:02 pm
Contact:

Re: Check Extensions

Post by brtzsnr » Fri Mar 03, 2017 3:15 pm

Try AddressSanitizer to find your bug: https://gcc.gnu.org/onlinedocs/gcc/Inst ... tions.html

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

Re: Check Extensions

Post by theturk1234 » Fri Mar 03, 2017 3:33 pm

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

David Cimbalista

Post Reply