I: pbuilder: network access will be disabled during build I: Current time: Thu Jul 29 10:20:03 -12 2021 I: pbuilder-time-stamp: 1627597203 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/bullseye-reproducible-base.tgz] I: copying local configuration I: mounting /proc filesystem I: mounting /sys filesystem I: creating /{dev,run}/shm I: mounting /dev/pts filesystem I: redirecting /dev/ptmx to /dev/pts/ptmx I: policy-rc.d already exists I: Copying source file I: copying [uci2wb_4.1+git200714-1.dsc] I: copying [./uci2wb_4.1+git200714.orig.tar.gz] I: copying [./uci2wb_4.1+git200714-1.debian.tar.xz] I: Extracting source gpgv: unknown type of key resource 'trustedkeys.kbx' gpgv: keyblock resource '/tmp/dpkg-verify-sig.DeJVJsp5/trustedkeys.kbx': General error gpgv: Signature made Tue Jul 14 03:32:13 2020 -12 gpgv: using RSA key 74AF05DDD92027F5F0C3CDD50D85F29625A3F9FD gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on ./uci2wb_4.1+git200714-1.dsc dpkg-source: info: extracting uci2wb in uci2wb-4.1+git200714 dpkg-source: info: unpacking uci2wb_4.1+git200714.orig.tar.gz dpkg-source: info: unpacking uci2wb_4.1+git200714-1.debian.tar.xz I: Not using root during the build. I: Installing the build-deps I: user script /srv/workspace/pbuilder/21214/tmp/hooks/D02_print_environment starting I: set BUILDDIR='/build' BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' BUILDUSERNAME='pbuilder1' BUILD_ARCH='armhf' DEBIAN_FRONTEND='noninteractive' DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all,-fixfilepath parallel=3' DISTRIBUTION='' HOME='/root' HOST_ARCH='armhf' IFS=' ' INVOCATION_ID='8f73eb01b5d5425e86ba22cacc845a45' LANG='C' LANGUAGE='en_US:en' LC_ALL='C' MAIL='/var/mail/root' OPTIND='1' PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' PBCURRENTCOMMANDLINEOPERATION='build' PBUILDER_OPERATION='build' PBUILDER_PKGDATADIR='/usr/share/pbuilder' PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' PBUILDER_SYSCONFDIR='/etc' PPID='21214' PS1='# ' PS2='> ' PS4='+ ' PWD='/' SHELL='/bin/bash' SHLVL='2' SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/tmp.kD8UKsW7EV/pbuilderrc_8ZHt --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/bullseye-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/tmp.kD8UKsW7EV/b1 --logfile b1/build.log uci2wb_4.1+git200714-1.dsc' SUDO_GID='113' SUDO_UID='107' SUDO_USER='jenkins' TERM='unknown' TZ='/usr/share/zoneinfo/Etc/GMT+12' USER='root' _='/usr/bin/systemd-run' http_proxy='http://10.0.0.15:8000/' I: uname -a Linux virt64b 5.10.0-8-arm64 #1 SMP Debian 5.10.46-2 (2021-07-20) aarch64 GNU/Linux I: ls -l /bin total 3580 -rwxr-xr-x 1 root root 816764 Jun 21 14:26 bash -rwxr-xr-x 3 root root 26052 Jul 20 2020 bunzip2 -rwxr-xr-x 3 root root 26052 Jul 20 2020 bzcat lrwxrwxrwx 1 root root 6 Jul 20 2020 bzcmp -> bzdiff -rwxr-xr-x 1 root root 2225 Jul 20 2020 bzdiff lrwxrwxrwx 1 root root 6 Jul 20 2020 bzegrep -> bzgrep -rwxr-xr-x 1 root root 4877 Sep 4 2019 bzexe lrwxrwxrwx 1 root root 6 Jul 20 2020 bzfgrep -> bzgrep -rwxr-xr-x 1 root root 3775 Jul 20 2020 bzgrep -rwxr-xr-x 3 root root 26052 Jul 20 2020 bzip2 -rwxr-xr-x 1 root root 9636 Jul 20 2020 bzip2recover lrwxrwxrwx 1 root root 6 Jul 20 2020 bzless -> bzmore -rwxr-xr-x 1 root root 1297 Jul 20 2020 bzmore -rwxr-xr-x 1 root root 26668 Sep 22 2020 cat -rwxr-xr-x 1 root root 43104 Sep 22 2020 chgrp -rwxr-xr-x 1 root root 38984 Sep 22 2020 chmod -rwxr-xr-x 1 root root 43112 Sep 22 2020 chown -rwxr-xr-x 1 root root 92616 Sep 22 2020 cp -rwxr-xr-x 1 root root 75524 Dec 10 2020 dash -rwxr-xr-x 1 root root 75880 Sep 22 2020 date -rwxr-xr-x 1 root root 55436 Sep 22 2020 dd -rwxr-xr-x 1 root root 59912 Sep 22 2020 df -rwxr-xr-x 1 root root 96764 Sep 22 2020 dir -rwxr-xr-x 1 root root 55012 Feb 7 02:38 dmesg lrwxrwxrwx 1 root root 8 Nov 6 2019 dnsdomainname -> hostname lrwxrwxrwx 1 root root 8 Nov 6 2019 domainname -> hostname -rwxr-xr-x 1 root root 22508 Sep 22 2020 echo -rwxr-xr-x 1 root root 28 Nov 9 2020 egrep -rwxr-xr-x 1 root root 22496 Sep 22 2020 false -rwxr-xr-x 1 root root 28 Nov 9 2020 fgrep -rwxr-xr-x 1 root root 47492 Feb 7 02:38 findmnt -rwsr-xr-x 1 root root 26076 Feb 26 04:12 fusermount -rwxr-xr-x 1 root root 124508 Nov 9 2020 grep -rwxr-xr-x 2 root root 2346 Mar 2 11:30 gunzip -rwxr-xr-x 1 root root 6376 Mar 2 11:30 gzexe -rwxr-xr-x 1 root root 64212 Mar 2 11:30 gzip -rwxr-xr-x 1 root root 13784 Nov 6 2019 hostname -rwxr-xr-x 1 root root 43180 Sep 22 2020 ln -rwxr-xr-x 1 root root 35068 Feb 7 2020 login -rwxr-xr-x 1 root root 96764 Sep 22 2020 ls -rwxr-xr-x 1 root root 99940 Feb 7 02:38 lsblk -rwxr-xr-x 1 root root 51408 Sep 22 2020 mkdir -rwxr-xr-x 1 root root 43184 Sep 22 2020 mknod -rwxr-xr-x 1 root root 30780 Sep 22 2020 mktemp -rwxr-xr-x 1 root root 34408 Feb 7 02:38 more -rwsr-xr-x 1 root root 34400 Feb 7 02:38 mount -rwxr-xr-x 1 root root 9824 Feb 7 02:38 mountpoint -rwxr-xr-x 1 root root 88524 Sep 22 2020 mv lrwxrwxrwx 1 root root 8 Nov 6 2019 nisdomainname -> hostname lrwxrwxrwx 1 root root 14 Apr 18 03:38 pidof -> /sbin/killall5 -rwxr-xr-x 1 root root 26652 Sep 22 2020 pwd lrwxrwxrwx 1 root root 4 Jun 21 14:26 rbash -> bash -rwxr-xr-x 1 root root 30740 Sep 22 2020 readlink -rwxr-xr-x 1 root root 43104 Sep 22 2020 rm -rwxr-xr-x 1 root root 30732 Sep 22 2020 rmdir -rwxr-xr-x 1 root root 14144 Sep 27 2020 run-parts -rwxr-xr-x 1 root root 76012 Dec 22 2018 sed lrwxrwxrwx 1 root root 4 Jul 24 21:25 sh -> dash -rwxr-xr-x 1 root root 22532 Sep 22 2020 sleep -rwxr-xr-x 1 root root 55360 Sep 22 2020 stty -rwsr-xr-x 1 root root 46704 Feb 7 02:38 su -rwxr-xr-x 1 root root 22532 Sep 22 2020 sync -rwxr-xr-x 1 root root 340872 Feb 16 21:55 tar -rwxr-xr-x 1 root root 9808 Sep 27 2020 tempfile -rwxr-xr-x 1 root root 67696 Sep 22 2020 touch -rwxr-xr-x 1 root root 22496 Sep 22 2020 true -rwxr-xr-x 1 root root 9636 Feb 26 04:12 ulockmgr_server -rwsr-xr-x 1 root root 22108 Feb 7 02:38 umount -rwxr-xr-x 1 root root 22520 Sep 22 2020 uname -rwxr-xr-x 2 root root 2346 Mar 2 11:30 uncompress -rwxr-xr-x 1 root root 96764 Sep 22 2020 vdir -rwxr-xr-x 1 root root 38512 Feb 7 02:38 wdctl lrwxrwxrwx 1 root root 8 Nov 6 2019 ypdomainname -> hostname -rwxr-xr-x 1 root root 1984 Mar 2 11:30 zcat -rwxr-xr-x 1 root root 1678 Mar 2 11:30 zcmp -rwxr-xr-x 1 root root 5880 Mar 2 11:30 zdiff -rwxr-xr-x 1 root root 29 Mar 2 11:30 zegrep -rwxr-xr-x 1 root root 29 Mar 2 11:30 zfgrep -rwxr-xr-x 1 root root 2081 Mar 2 11:30 zforce -rwxr-xr-x 1 root root 7585 Mar 2 11:30 zgrep -rwxr-xr-x 1 root root 2206 Mar 2 11:30 zless -rwxr-xr-x 1 root root 1842 Mar 2 11:30 zmore -rwxr-xr-x 1 root root 4553 Mar 2 11:30 znew I: user script /srv/workspace/pbuilder/21214/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy Version: 0.invalid.0 Architecture: armhf Maintainer: Debian Pbuilder Team Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder This package was created automatically by pbuilder to satisfy the build-dependencies of the package being currently built. Depends: debhelper-compat (= 12), dh-buildinfo, perl dpkg-deb: building package 'pbuilder-satisfydepends-dummy' in '/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'. Selecting previously unselected package pbuilder-satisfydepends-dummy. (Reading database ... 19398 files and directories currently installed.) Preparing to unpack .../pbuilder-satisfydepends-dummy.deb ... Unpacking pbuilder-satisfydepends-dummy (0.invalid.0) ... dpkg: pbuilder-satisfydepends-dummy: dependency problems, but configuring anyway as you requested: pbuilder-satisfydepends-dummy depends on debhelper-compat (= 12); however: Package debhelper-compat is not installed. pbuilder-satisfydepends-dummy depends on dh-buildinfo; however: Package dh-buildinfo is not installed. Setting up pbuilder-satisfydepends-dummy (0.invalid.0) ... Reading package lists... Building dependency tree... Reading state information... Initializing package states... Writing extended state information... Building tag database... pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) The following NEW packages will be installed: autoconf{a} automake{a} autopoint{a} autotools-dev{a} bsdextrautils{a} debhelper{a} dh-autoreconf{a} dh-buildinfo{a} dh-strip-nondeterminism{a} dwz{a} file{a} gettext{a} gettext-base{a} groff-base{a} intltool-debian{a} libarchive-zip-perl{a} libdebhelper-perl{a} libelf1{a} libfile-stripnondeterminism-perl{a} libicu67{a} libmagic-mgc{a} libmagic1{a} libpipeline1{a} libsigsegv2{a} libsub-override-perl{a} libtool{a} libuchardet0{a} libxml2{a} m4{a} man-db{a} po-debconf{a} sensible-utils{a} The following packages are RECOMMENDED but will NOT be installed: curl libarchive-cpio-perl libltdl-dev libmail-sendmail-perl lynx wget 0 packages upgraded, 32 newly installed, 0 to remove and 0 not upgraded. Need to get 17.7 MB of archives. After unpacking 63.0 MB will be used. Writing extended state information... Get: 1 http://deb.debian.org/debian bullseye/main armhf bsdextrautils armhf 2.36.1-7 [138 kB] Get: 2 http://deb.debian.org/debian bullseye/main armhf libuchardet0 armhf 0.0.7-1 [65.0 kB] Get: 3 http://deb.debian.org/debian bullseye/main armhf groff-base armhf 1.22.4-6 [847 kB] Get: 4 http://deb.debian.org/debian bullseye/main armhf libpipeline1 armhf 1.5.3-1 [30.1 kB] Get: 5 http://deb.debian.org/debian bullseye/main armhf man-db armhf 2.9.4-2 [1319 kB] Get: 6 http://deb.debian.org/debian bullseye/main armhf sensible-utils all 0.0.14 [14.8 kB] Get: 7 http://deb.debian.org/debian bullseye/main armhf libmagic-mgc armhf 1:5.39-3 [273 kB] Get: 8 http://deb.debian.org/debian bullseye/main armhf libmagic1 armhf 1:5.39-3 [117 kB] Get: 9 http://deb.debian.org/debian bullseye/main armhf file armhf 1:5.39-3 [68.1 kB] Get: 10 http://deb.debian.org/debian bullseye/main armhf gettext-base armhf 0.21-4 [171 kB] Get: 11 http://deb.debian.org/debian bullseye/main armhf libsigsegv2 armhf 2.13-1 [34.0 kB] Get: 12 http://deb.debian.org/debian bullseye/main armhf m4 armhf 1.4.18-5 [192 kB] Get: 13 http://deb.debian.org/debian bullseye/main armhf autoconf all 2.69-14 [313 kB] Get: 14 http://deb.debian.org/debian bullseye/main armhf autotools-dev all 20180224.1+nmu1 [77.1 kB] Get: 15 http://deb.debian.org/debian bullseye/main armhf automake all 1:1.16.3-2 [814 kB] Get: 16 http://deb.debian.org/debian bullseye/main armhf autopoint all 0.21-4 [510 kB] Get: 17 http://deb.debian.org/debian bullseye/main armhf libdebhelper-perl all 13.3.4 [189 kB] Get: 18 http://deb.debian.org/debian bullseye/main armhf libtool all 2.4.6-15 [513 kB] Get: 19 http://deb.debian.org/debian bullseye/main armhf dh-autoreconf all 20 [17.1 kB] Get: 20 http://deb.debian.org/debian bullseye/main armhf libarchive-zip-perl all 1.68-1 [104 kB] Get: 21 http://deb.debian.org/debian bullseye/main armhf libsub-override-perl all 0.09-2 [10.2 kB] Get: 22 http://deb.debian.org/debian bullseye/main armhf libfile-stripnondeterminism-perl all 1.12.0-1 [26.3 kB] Get: 23 http://deb.debian.org/debian bullseye/main armhf dh-strip-nondeterminism all 1.12.0-1 [15.4 kB] Get: 24 http://deb.debian.org/debian bullseye/main armhf libelf1 armhf 0.183-1 [161 kB] Get: 25 http://deb.debian.org/debian bullseye/main armhf dwz armhf 0.13+20210201-1 [179 kB] Get: 26 http://deb.debian.org/debian bullseye/main armhf libicu67 armhf 67.1-7 [8319 kB] Get: 27 http://deb.debian.org/debian bullseye/main armhf libxml2 armhf 2.9.10+dfsg-6.7 [602 kB] Get: 28 http://deb.debian.org/debian bullseye/main armhf gettext armhf 0.21-4 [1243 kB] Get: 29 http://deb.debian.org/debian bullseye/main armhf intltool-debian all 0.35.0+20060710.5 [26.8 kB] Get: 30 http://deb.debian.org/debian bullseye/main armhf po-debconf all 1.0.21+nmu1 [248 kB] Get: 31 http://deb.debian.org/debian bullseye/main armhf debhelper all 13.3.4 [1049 kB] Get: 32 http://deb.debian.org/debian bullseye/main armhf dh-buildinfo all 0.11+nmu2 [18.4 kB] Fetched 17.7 MB in 4s (4688 kB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package bsdextrautils. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19398 files and directories currently installed.) Preparing to unpack .../00-bsdextrautils_2.36.1-7_armhf.deb ... Unpacking bsdextrautils (2.36.1-7) ... Selecting previously unselected package libuchardet0:armhf. Preparing to unpack .../01-libuchardet0_0.0.7-1_armhf.deb ... Unpacking libuchardet0:armhf (0.0.7-1) ... Selecting previously unselected package groff-base. Preparing to unpack .../02-groff-base_1.22.4-6_armhf.deb ... Unpacking groff-base (1.22.4-6) ... Selecting previously unselected package libpipeline1:armhf. Preparing to unpack .../03-libpipeline1_1.5.3-1_armhf.deb ... Unpacking libpipeline1:armhf (1.5.3-1) ... Selecting previously unselected package man-db. Preparing to unpack .../04-man-db_2.9.4-2_armhf.deb ... Unpacking man-db (2.9.4-2) ... Selecting previously unselected package sensible-utils. Preparing to unpack .../05-sensible-utils_0.0.14_all.deb ... Unpacking sensible-utils (0.0.14) ... Selecting previously unselected package libmagic-mgc. Preparing to unpack .../06-libmagic-mgc_1%3a5.39-3_armhf.deb ... Unpacking libmagic-mgc (1:5.39-3) ... Selecting previously unselected package libmagic1:armhf. Preparing to unpack .../07-libmagic1_1%3a5.39-3_armhf.deb ... Unpacking libmagic1:armhf (1:5.39-3) ... Selecting previously unselected package file. Preparing to unpack .../08-file_1%3a5.39-3_armhf.deb ... Unpacking file (1:5.39-3) ... Selecting previously unselected package gettext-base. Preparing to unpack .../09-gettext-base_0.21-4_armhf.deb ... Unpacking gettext-base (0.21-4) ... Selecting previously unselected package libsigsegv2:armhf. Preparing to unpack .../10-libsigsegv2_2.13-1_armhf.deb ... Unpacking libsigsegv2:armhf (2.13-1) ... Selecting previously unselected package m4. Preparing to unpack .../11-m4_1.4.18-5_armhf.deb ... Unpacking m4 (1.4.18-5) ... Selecting previously unselected package autoconf. Preparing to unpack .../12-autoconf_2.69-14_all.deb ... Unpacking autoconf (2.69-14) ... Selecting previously unselected package autotools-dev. Preparing to unpack .../13-autotools-dev_20180224.1+nmu1_all.deb ... Unpacking autotools-dev (20180224.1+nmu1) ... Selecting previously unselected package automake. Preparing to unpack .../14-automake_1%3a1.16.3-2_all.deb ... Unpacking automake (1:1.16.3-2) ... Selecting previously unselected package autopoint. Preparing to unpack .../15-autopoint_0.21-4_all.deb ... Unpacking autopoint (0.21-4) ... Selecting previously unselected package libdebhelper-perl. Preparing to unpack .../16-libdebhelper-perl_13.3.4_all.deb ... Unpacking libdebhelper-perl (13.3.4) ... Selecting previously unselected package libtool. Preparing to unpack .../17-libtool_2.4.6-15_all.deb ... Unpacking libtool (2.4.6-15) ... Selecting previously unselected package dh-autoreconf. Preparing to unpack .../18-dh-autoreconf_20_all.deb ... Unpacking dh-autoreconf (20) ... Selecting previously unselected package libarchive-zip-perl. Preparing to unpack .../19-libarchive-zip-perl_1.68-1_all.deb ... Unpacking libarchive-zip-perl (1.68-1) ... Selecting previously unselected package libsub-override-perl. Preparing to unpack .../20-libsub-override-perl_0.09-2_all.deb ... Unpacking libsub-override-perl (0.09-2) ... Selecting previously unselected package libfile-stripnondeterminism-perl. Preparing to unpack .../21-libfile-stripnondeterminism-perl_1.12.0-1_all.deb ... Unpacking libfile-stripnondeterminism-perl (1.12.0-1) ... Selecting previously unselected package dh-strip-nondeterminism. Preparing to unpack .../22-dh-strip-nondeterminism_1.12.0-1_all.deb ... Unpacking dh-strip-nondeterminism (1.12.0-1) ... Selecting previously unselected package libelf1:armhf. Preparing to unpack .../23-libelf1_0.183-1_armhf.deb ... Unpacking libelf1:armhf (0.183-1) ... Selecting previously unselected package dwz. Preparing to unpack .../24-dwz_0.13+20210201-1_armhf.deb ... Unpacking dwz (0.13+20210201-1) ... Selecting previously unselected package libicu67:armhf. Preparing to unpack .../25-libicu67_67.1-7_armhf.deb ... Unpacking libicu67:armhf (67.1-7) ... Selecting previously unselected package libxml2:armhf. Preparing to unpack .../26-libxml2_2.9.10+dfsg-6.7_armhf.deb ... Unpacking libxml2:armhf (2.9.10+dfsg-6.7) ... Selecting previously unselected package gettext. Preparing to unpack .../27-gettext_0.21-4_armhf.deb ... Unpacking gettext (0.21-4) ... Selecting previously unselected package intltool-debian. Preparing to unpack .../28-intltool-debian_0.35.0+20060710.5_all.deb ... Unpacking intltool-debian (0.35.0+20060710.5) ... Selecting previously unselected package po-debconf. Preparing to unpack .../29-po-debconf_1.0.21+nmu1_all.deb ... Unpacking po-debconf (1.0.21+nmu1) ... Selecting previously unselected package debhelper. Preparing to unpack .../30-debhelper_13.3.4_all.deb ... Unpacking debhelper (13.3.4) ... Selecting previously unselected package dh-buildinfo. Preparing to unpack .../31-dh-buildinfo_0.11+nmu2_all.deb ... Unpacking dh-buildinfo (0.11+nmu2) ... Setting up libpipeline1:armhf (1.5.3-1) ... Setting up bsdextrautils (2.36.1-7) ... update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode Setting up libicu67:armhf (67.1-7) ... Setting up libmagic-mgc (1:5.39-3) ... Setting up libarchive-zip-perl (1.68-1) ... Setting up libdebhelper-perl (13.3.4) ... Setting up libmagic1:armhf (1:5.39-3) ... Setting up gettext-base (0.21-4) ... Setting up file (1:5.39-3) ... Setting up autotools-dev (20180224.1+nmu1) ... Setting up libsigsegv2:armhf (2.13-1) ... Setting up autopoint (0.21-4) ... Setting up sensible-utils (0.0.14) ... Setting up libuchardet0:armhf (0.0.7-1) ... Setting up libsub-override-perl (0.09-2) ... Setting up libelf1:armhf (0.183-1) ... Setting up libxml2:armhf (2.9.10+dfsg-6.7) ... Setting up libfile-stripnondeterminism-perl (1.12.0-1) ... Setting up gettext (0.21-4) ... Setting up libtool (2.4.6-15) ... Setting up m4 (1.4.18-5) ... Setting up intltool-debian (0.35.0+20060710.5) ... Setting up autoconf (2.69-14) ... Setting up dh-strip-nondeterminism (1.12.0-1) ... Setting up dwz (0.13+20210201-1) ... Setting up groff-base (1.22.4-6) ... Setting up automake (1:1.16.3-2) ... update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode Setting up po-debconf (1.0.21+nmu1) ... Setting up man-db (2.9.4-2) ... Not building database; man-db/auto-update is not 'true'. Setting up dh-autoreconf (20) ... Setting up debhelper (13.3.4) ... Setting up dh-buildinfo (0.11+nmu2) ... Processing triggers for libc-bin (2.31-13) ... Reading package lists... Building dependency tree... Reading state information... Reading extended state information... Initializing package states... Writing extended state information... Building tag database... -> Finished parsing the build-deps I: Building the package I: Running cd /build/uci2wb-4.1+git200714/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../uci2wb_4.1+git200714-1_source.changes dpkg-buildpackage: info: source package uci2wb dpkg-buildpackage: info: source version 4.1+git200714-1 dpkg-buildpackage: info: source distribution unstable dpkg-buildpackage: info: source changed by Yann Dirson dpkg-source --before-build . dpkg-buildpackage: info: host architecture armhf debian/rules clean dh clean dh_auto_clean make -j3 clean make[1]: Entering directory '/build/uci2wb-4.1+git200714' rm -f uci2wb uci2wb.6.gz make[1]: Leaving directory '/build/uci2wb-4.1+git200714' dh_clean rm -f debian/debhelper-build-stamp rm -rf debian/.debhelper/ rm -f -- debian/uci2wb.substvars debian/files rm -fr -- debian/uci2wb/ debian/tmp/ find . \( \( \ \( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS -o -path .\*/.pc -o -path .\*/_darcs \) -prune -o -type f -a \ \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \ -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \ -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \ -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \ \) -exec rm -f {} + \) -o \ \( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \) debian/rules binary dh binary dh_update_autotools_config dh_autoreconf dh_auto_configure dh_auto_build make -j3 "INSTALL=install --strip-program=true" make[1]: Entering directory '/build/uci2wb-4.1+git200714' cc -g -O2 -fdebug-prefix-map=/build/uci2wb-4.1+git200714=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 UCI2WB.c -o uci2wb -Wl,-z,relro -lpthread pod2man -s 6 uci2wb.pod | gzip -9n > uci2wb.6.gz UCI2WB.c: In function 'DoCommand': UCI2WB.c:635:62: warning: '%s' directive writing up to 1018 bytes into a region of size between 944 and 947 [-Wformat-overflow=] 46 | #define EPRINT(X) { char f[999]; sprintf X; DPRINT("%s", f); fprintf(toE, "%s", f + 2*(*f == '#')); /* strip optional # prefix */ } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 47 | | 48 | #define WHITE 0 | ~~~~~~~~~~~~~~~ 49 | #define BLACK 1 | ~~~~~~~~~~~~~~~ 50 | #define NONE 2 | ~~~~~~~~~~~~~~~ 51 | #define ANALYZE 3 | ~~~~~~~~~~~~~~~~~ 52 | | 53 | char move[2000][10], iniPos[256], hashOpt[20], suspended, ponder, post, hasHash, c, sc=' ', sc2, suffix[81], varOpt, searching, *binary; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug, flob; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 | int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500], frc, byo = -1, namOpt, comp; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20], varList[8000], anaOpt[20], checkOptions[8192] = "Ponder"; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 | char pvs[99][999], board[100]; // XQ board for UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 58 | char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 59 | int unit = 1, drawOffer, scores[99], mpvSP, maxDepth, ponderAlways, newCnt, priority, killDelay; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 | | 61 | FILE *toE, *fromE, *fromF; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 62 | | 63 | char *strcasestr (char *p, char *q) { while(*p) { char *r=p++, *s=q; while(tolower(*r++) == tolower(*s) && *s) s++; if(!*s) return p-1; } return NULL; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 64 | | 65 | #ifdef WIN32 | ~~~~~~~~~~~~ 66 | WinPipe(HANDLE *hRd, HANDLE *hWr) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | { | ~ 68 | SECURITY_ATTRIBUTES saAttr; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | | 70 | /* Set the bInheritHandle flag so pipe handles are inherited. */ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 72 | saAttr.bInheritHandle = TRUE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | saAttr.lpSecurityDescriptor = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | /* Create a pipe */ | ~~~~~~~~~~~~~~~~~~~ 76 | return CreatePipe(hRd, hWr, &saAttr, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | } | ~ 78 | #endif | ~~~~~~ 79 | | 80 | #define INIT 0 | ~~~~~~~~~~~~~~ 81 | #define WAKEUP 1 | ~~~~~~~~~~~~~~~~ 82 | #define PAUSE 2 | ~~~~~~~~~~~~~~~ 83 | | 84 | void | ~~~~ 85 | Sync (int action) | ~~~~~~~~~~~~~~~~~ 86 | { | ~ 87 | #ifdef WIN32 | ~~~~~~~~~~~~ 88 | static HANDLE hWr, hRd; DWORD d; char c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | switch(action) { | ~~~~~~~~~~~~~~~~ 90 | case INIT: WinPipe(&hRd, &hWr); break; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | case WAKEUP: WriteFile(hWr, "\n", 1, &d, NULL); break; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 92 | case PAUSE: ReadFile(hRd, &c, 1, &d, NULL); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 93 | } | ~ 94 | #else | ~~~~~ 95 | static int syncPipe[2], res; char c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 96 | switch(action) { | ~~~~~~~~~~~~~~~~ 97 | case INIT: res = pipe(syncPipe); break; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | case WAKEUP: res = write(syncPipe[1], "\n", 1); break; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 | case PAUSE: res = read(syncPipe[0], &c, 1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 100 | } | ~ 101 | if(res < 0) printf("tellusererror UCI2WB: bad sync pipe\n"), exit(0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | } | ~ 104 | | 105 | void | ~~~~ 106 | FromFEN(char *fen) | ~~~~~~~~~~~~~~~~~~ 107 | { int i=0; | ~~~~~~~~~~ 108 | while(*fen) { | ~~~~~~~~~~~~~ 109 | char c = *fen++; | ~~~~~~~~~~~~~~~~ 110 | if(c >= 'A') board[i++] = c; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | if(c == '/') i++; else | ~~~~~~~~~~~~~~~~~~~~~~ 112 | if(c == ' ') break; else | ~~~~~~~~~~~~~~~~~~~~~~~~ 113 | while(c-- > '0' && i < 99) board[i++] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | if(i >= 99) break; | ~~~~~~~~~~~~~~~~~~ 115 | } | ~ 116 | } | ~ 117 | | 118 | char * | ~~~~~~ 119 | ToFEN(int stm) | ~~~~~~~~~~~~~~ 120 | { | ~ 121 | int i, n=0; static char fen[200]; char *p = fen; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | for(i=0; i<99; i++) { | ~~~~~~~~~~~~~~~~~~~~~ 123 | char c = board[i]; | ~~~~~~~~~~~~~~~~~~ 124 | if(c >= 'A') { if(n) *p++ = '0' + n; n = 0; *p++ = c; } else n ++; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | if(i%10 == 8) { if(n) *p++ = '0' + n; n = -1; *p++ = '/'; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | } | ~ 127 | sprintf(p-1, " %c - - 0 1", stm); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 | return fen; | ~~~~~~~~~~~ 129 | } | ~ 130 | | 131 | int | ~~~ 132 | Sqr(char *m, int j) | ~~~~~~~~~~~~~~~~~~~ 133 | { | ~ 134 | int n = m[j] - 'a' + 10*('9' - m[j+1]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | if(n < 0) n = 0; else if(n > 99) n = 99; return n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | } | ~ 137 | | 138 | int | ~~~ 139 | Play(int nr) | ~~~~~~~~~~~~ 140 | { | ~ 141 | int i, last = -1; | ~~~~~~~~~~~~~~~~~ 142 | FromFEN(iniPos + 13); // FEN part | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | for(i=0; i0)); // byoyomi time | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 158 | if(sc == 'x') black = 1; else drawOffer = 0;// in UCCI 'black' refers to us and 'white' to opponent | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 | if(!x && drawOffer) ponder = " draw", drawOffer = 0; //pass draw offer only when not pondering | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 | EPRINT((f, "# go%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | if(sTime > 0) EPRINT((f, " movetime %d", sTime)) else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 162 | if(mps) EPRINT((f, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 163 | if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", t); // for engines running purely on byoyomi | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if((inc || !mps && !sTime && sc == 'x') && !*suffix) EPRINT((f, " %s %d %s %d", wInc, inc, bInc, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 165 | if(depth > 0) EPRINT((f, " depth %d", depth)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | if(*suffix) EPRINT((f, suffix, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | EPRINT((f, "\n")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 168 | } | ~ 169 | | 170 | void | ~~~~ 171 | StopSearch(int discard) | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | { | ~ 173 | if(!searching) return; | ~~~~~~~~~~~~~~~~~~~~~~ 174 | if(discard) searching = 0; // this causes bestmove to be ignored | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 | } | ~ 177 | | 178 | void | ~~~~ 179 | LoadPos(int moveNr) | ~~~~~~~~~~~~~~~~~~~ 180 | { | ~ 181 | int j, lastCapt = 0; char *pos = iniPos, buf[200], stm; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | if(sc == 'x') { // UCCI: send only reversible moves | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | lastCapt = Play(moveNr); // find last capture (returns -1 if none!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | Play(++lastCapt); // reconstruct board after last capture | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | stm = (!strstr(iniPos+13, " b ") ^ lastCapt & 1 ? 'w' : 'b'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | sprintf(buf, "position fen %s", ToFEN(stm)); pos = buf; // send it as FEN (with "position" in UCCI!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | EPRINT((f, "# %s moves", pos)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | for(j=lastCapt; j= '0' && c <= '9' || c >= 'a' && c <= 'z') *q++ = 'a'+'0'+size - c; else *q++ = c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | } | ~ 218 | *q++ = 0; | ~~~~~~~~~ 219 | return buf; | ~~~~~~~~~~~ 220 | } | ~ 221 | | 222 | void | ~~~~ 223 | Move4GUI(char *m) | ~~~~~~~~~~~~~~~~~ 224 | { | ~ 225 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 226 | // convert USI move to WB format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | if(m[1] == '*') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | m[1] = '@'; | ~~~~~~~~~~~ 231 | } else { | ~~~~~~~~ 232 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | if((stm == WHITE ? (m[1]>'0'+size-size/3 || m[3]>'0'+size-size/3) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | : (m[1] <= '0'+size/3 || m[3] <= '0'+size/3)) && m[4] != '+') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | m[4] = '=', m[5] = 0; | ~~~~~~~~~~~~~~~~~~~~~ 237 | } | ~ 238 | } | ~ 239 | } | ~ 240 | | 241 | int | ~~~ 242 | ReadLine (FILE *f, char *line, int len) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 243 | { | ~ 244 | int x, i = 0; | ~~~~~~~~~~~~~ 245 | while((x = fgetc(f)) != EOF && (line[i] = x) != '\n') i+=(i0 ? 100000 : -100000, statScore = s; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | if(p = strstr(line+4, " score ")) sscanf(p+7, "%d", &s), statScore = s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if(p = strstr(line+4, " nodes ")) sscanf(p+7, "%d", &n), statNodes = n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 310 | if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | if(p = strstr(line+4, " upperbound ")) strcat(p, "?\n"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | if(p = strstr(line+4, " lowerbound ")) strcat(p, "!\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 315 | for(i=0; i= mpvSP) strncpy(pvs[mpvSP], pv+4, 998), scores[mpvSP++] = s, // emit as thinking output if not | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | } else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | if(collect && (pv = strstr(line+4, " currmove "))) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | sscanf(pv+10,"%s", currMove); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 322 | if(p = strstr(line+4, " currmovenumber ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | n = currNr = atoi(p+16); | ~~~~~~~~~~~~~~~~~~~~~~~~ 324 | if(collect == 1 && n != 1) continue; // wait for move 1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | if(collect + (n == 1) > 2) { // done collecting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | collect = 3; continue; | ~~~~~~~~~~~~~~~~~~~~~~ 328 | } | ~ 329 | collect = 2; on[nr=n] = 1; strcpy(moveMap[n], currMove); continue; // store move | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 330 | } | ~ 331 | } | ~ 332 | } | ~ 333 | else if(!strcmp(command, "option")) { // USI option: extract data fields | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 334 | char name[80], type[80], buf[1024], val[256], *q; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | int min=0, max=1e9; *val = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 337 | if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 340 | if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if(!strcasecmp(name, "UCI_Variant")) { if(p = strstr(line+6, " var ")) strcpy(varList, p); varOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 343 | if(!strcasecmp(name, "UCI_Opponent")) { namOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | if(!strcasecmp(name+2, "I_AnalyseMode")) { strcpy(anaOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | if(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 346 | EPRINT((f, "# setoption name %s value true\n", name)) strcpy(val, "true"); // set non-standard suspected FRC options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 347 | } | ~ 348 | if(!strcasecmp(name, "Threads")) { strcpy(threadOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 349 | if(!strcasecmp(name, "Ponder") || !strcasecmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 350 | if(!strcasecmp(name, "Hash") || !strcasecmp(name, "USI_Hash") || !strcasecmp(name, "hashsize")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | memory = oldMem = atoi(val); hasHash = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | strcpy(hashOpt, name); | ~~~~~~~~~~~~~~~~~~~~~~ 353 | continue; | ~~~~~~~~~ 354 | } | ~ 355 | if(!strcasecmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | if(!strcasecmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 357 | sprintf(buf, ",%s,", name); if(p = strcasestr(EGT, buf)) { // collect EGT formats | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | strcpy(buf, p); for(p=buf; *++p >='a';){} if(*p == ' ') strcpy(buf, ",scorpio"); *p = 0; strcat(egts, buf); continue; // clip at first non-lower-case | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | } | ~ 360 | // pass on engine-defined option as WB option feature | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if(!strcmp(type, "filename")) type[4] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | else if(sc == 'c' && !strcmp(type, "string")) { // in UCI try to guess which strings are file or directory names | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | if(strcasestr(name, "file")) strcpy(type, "file"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 364 | if(strcasestr(name, "path") || strcasestr(name, "directory") || strcasestr(name, "folder")) strcpy(type, "path"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | } | ~ 366 | sprintf(buf, "feature option=\"%s -%s", name, type); q = buf + strlen(buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | if( !strcmp(type, "file") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | || !strcmp(type, "string")) sprintf(q, " %s\"\n", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369 | else if(!strcmp(type, "spin")) sprintf(q, " %d %d %d\"\n", atoi(val), min, max); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | else if(!strcmp(type, "check")) sprintf(q, " %d\"\n", strcmp(val, "true") ? 0 : 1), strcat(checkOptions, name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | else if(!strcmp(type, "button")) sprintf(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | else if(!strcmp(type, "combo")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %s", type); // current setting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | min = 0; p = line+6; | ~~~~~~~~~~~~~~~~~~~~ 375 | while(p = strstr(p, " var ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | sscanf(p += 5, "%s", val); // next choice | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 378 | } | ~ 379 | strcat(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~ 380 | | 381 | } | ~ 382 | else buf[0] = 0; // ignore unrecognized option types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 383 | if(buf[0]) printf("%s", buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | else if(!strcmp(command, "id")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | static char name[256], version[256]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 | if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | if(sscanf(line, "id version %[^\n]", version) == 1 && *name) printf("feature myname=\"%s %s (U%cI2WB)\"\n", name, version, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | } | ~ 390 | else if(!strcmp(command, "readyok")) return; // resume processing of GUI commands | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | char *p = varList, *q = p; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | while(*q && *q != '\n') if(!strncmp(q, " var ", 5)) *p++ = ',', q +=5; // replace var keywords by commas | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | else if(!strncmp(q-1, " chess ", 7)) strcpy(p, "normal"), p += 6, q += 5; // 'chess' is called 'normal' in CECP | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | else *p++ = *q++; // copy other variant names unmodified | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | *p = 0; | ~~~~~~~ 397 | if(frc) sprintf(p, ",normal,fischerandom"), printf("feature oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 398 | if(!*varList) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); // without clue guess liberally | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | if(*egts) printf("feature egt=\"%s\"\n", egts+1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | printf("feature smp=1 memory=%d done=1\n", hasHash); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | if(unit == 2) { unit = 1; EPRINT((f, "# setoption usemillisec true\n")) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | fflush(stdout); return; // done with options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | } | ~ 406 | } | ~ 407 | | 408 | void | ~~~~ 409 | Move4Engine(char *m) | ~~~~~~~~~~~~~~~~~~~~ 410 | { | ~ 411 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 412 | // convert input move to USI format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 413 | if(m[1] == '@') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | m[1] = '*'; | ~~~~~~~~~~~ 415 | } else { | ~~~~~~~~ 416 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | } | ~ 419 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | if(m[4] == '=') m[4] = 0; // no '=' in USI format! | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | else if(m[4]) m[4] = '+'; // cater to WB 4.4 bug :-( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | } | ~ 424 | } | ~ 425 | | 426 | void DoCommand (); | ~~~~~~~~~~~~~~~~~~ 427 | char mySide; | ~~~~~~~~~~~~ 428 | volatile char queue[10000], *qStart, *qEnd; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | | 430 | void | ~~~~ 431 | LaunchSearch() | ~~~~~~~~~~~~~~ 432 | { | ~ 433 | int i; | ~~~~~~ 434 | | 435 | if(suspended || searching) return; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 436 | | 437 | if(computer == stm || computer == ANALYZE && sm != 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | DPRINT("# start search\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 439 | LoadPos(moveNr); fflush(stdout); // load position | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | // and set engine thinking (note USI swaps colors!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | startTime = GetTickCount(); mySide = stm; // remember side we last played for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 | if(computer == ANALYZE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | EPRINT((f, "# go infinite")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | if(sm & 1) { // some moves are disabled | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | EPRINT((f, " searchmoves")) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for(i=1; i 0) EPRINT((f, "# setoption name UCI_Chess960 value true\n")) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | } | ~ 613 | else if(!strcmp(command, "undo") && (i=1) || !strcmp(command, "remove") && (i=2)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 614 | moveNr = moveNr > i ? moveNr - i : 0; collect = (computer == ANALYZE); sm = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | } | ~ 616 | else if(!strcmp(command+2, "clude") && collect > 2) { // include or exclude | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | int all = !strcmp(line+8, "all"), in = command[1] == 'n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | inex = 1; line[strlen(line)-1] = sm = 0; // strip LF and clear sm flag | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | for(i=1; i= 'A') board[i++] = c; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | if(c == '/') i++; else | ~~~~~~~~~~~~~~~~~~~~~~ 112 | if(c == ' ') break; else | ~~~~~~~~~~~~~~~~~~~~~~~~ 113 | while(c-- > '0' && i < 99) board[i++] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | if(i >= 99) break; | ~~~~~~~~~~~~~~~~~~ 115 | } | ~ 116 | } | ~ 117 | | 118 | char * | ~~~~~~ 119 | ToFEN(int stm) | ~~~~~~~~~~~~~~ 120 | { | ~ 121 | int i, n=0; static char fen[200]; char *p = fen; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | for(i=0; i<99; i++) { | ~~~~~~~~~~~~~~~~~~~~~ 123 | char c = board[i]; | ~~~~~~~~~~~~~~~~~~ 124 | if(c >= 'A') { if(n) *p++ = '0' + n; n = 0; *p++ = c; } else n ++; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | if(i%10 == 8) { if(n) *p++ = '0' + n; n = -1; *p++ = '/'; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | } | ~ 127 | sprintf(p-1, " %c - - 0 1", stm); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 | return fen; | ~~~~~~~~~~~ 129 | } | ~ 130 | | 131 | int | ~~~ 132 | Sqr(char *m, int j) | ~~~~~~~~~~~~~~~~~~~ 133 | { | ~ 134 | int n = m[j] - 'a' + 10*('9' - m[j+1]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | if(n < 0) n = 0; else if(n > 99) n = 99; return n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | } | ~ 137 | | 138 | int | ~~~ 139 | Play(int nr) | ~~~~~~~~~~~~ 140 | { | ~ 141 | int i, last = -1; | ~~~~~~~~~~~~~~~~~ 142 | FromFEN(iniPos + 13); // FEN part | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | for(i=0; i0)); // byoyomi time | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 158 | if(sc == 'x') black = 1; else drawOffer = 0;// in UCCI 'black' refers to us and 'white' to opponent | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 | if(!x && drawOffer) ponder = " draw", drawOffer = 0; //pass draw offer only when not pondering | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 | EPRINT((f, "# go%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | if(sTime > 0) EPRINT((f, " movetime %d", sTime)) else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 162 | if(mps) EPRINT((f, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 163 | if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", t); // for engines running purely on byoyomi | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if((inc || !mps && !sTime && sc == 'x') && !*suffix) EPRINT((f, " %s %d %s %d", wInc, inc, bInc, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 165 | if(depth > 0) EPRINT((f, " depth %d", depth)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | if(*suffix) EPRINT((f, suffix, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | EPRINT((f, "\n")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 168 | } | ~ 169 | | 170 | void | ~~~~ 171 | StopSearch(int discard) | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | { | ~ 173 | if(!searching) return; | ~~~~~~~~~~~~~~~~~~~~~~ 174 | if(discard) searching = 0; // this causes bestmove to be ignored | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 | } | ~ 177 | | 178 | void | ~~~~ 179 | LoadPos(int moveNr) | ~~~~~~~~~~~~~~~~~~~ 180 | { | ~ 181 | int j, lastCapt = 0; char *pos = iniPos, buf[200], stm; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | if(sc == 'x') { // UCCI: send only reversible moves | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | lastCapt = Play(moveNr); // find last capture (returns -1 if none!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | Play(++lastCapt); // reconstruct board after last capture | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | stm = (!strstr(iniPos+13, " b ") ^ lastCapt & 1 ? 'w' : 'b'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | sprintf(buf, "position fen %s", ToFEN(stm)); pos = buf; // send it as FEN (with "position" in UCCI!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | EPRINT((f, "# %s moves", pos)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | for(j=lastCapt; j= '0' && c <= '9' || c >= 'a' && c <= 'z') *q++ = 'a'+'0'+size - c; else *q++ = c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | } | ~ 218 | *q++ = 0; | ~~~~~~~~~ 219 | return buf; | ~~~~~~~~~~~ 220 | } | ~ 221 | | 222 | void | ~~~~ 223 | Move4GUI(char *m) | ~~~~~~~~~~~~~~~~~ 224 | { | ~ 225 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 226 | // convert USI move to WB format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | if(m[1] == '*') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | m[1] = '@'; | ~~~~~~~~~~~ 231 | } else { | ~~~~~~~~ 232 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | if((stm == WHITE ? (m[1]>'0'+size-size/3 || m[3]>'0'+size-size/3) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | : (m[1] <= '0'+size/3 || m[3] <= '0'+size/3)) && m[4] != '+') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | m[4] = '=', m[5] = 0; | ~~~~~~~~~~~~~~~~~~~~~ 237 | } | ~ 238 | } | ~ 239 | } | ~ 240 | | 241 | int | ~~~ 242 | ReadLine (FILE *f, char *line, int len) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 243 | { | ~ 244 | int x, i = 0; | ~~~~~~~~~~~~~ 245 | while((x = fgetc(f)) != EOF && (line[i] = x) != '\n') i+=(i0 ? 100000 : -100000, statScore = s; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | if(p = strstr(line+4, " score ")) sscanf(p+7, "%d", &s), statScore = s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if(p = strstr(line+4, " nodes ")) sscanf(p+7, "%d", &n), statNodes = n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 310 | if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | if(p = strstr(line+4, " upperbound ")) strcat(p, "?\n"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | if(p = strstr(line+4, " lowerbound ")) strcat(p, "!\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 315 | for(i=0; i= mpvSP) strncpy(pvs[mpvSP], pv+4, 998), scores[mpvSP++] = s, // emit as thinking output if not | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | } else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | if(collect && (pv = strstr(line+4, " currmove "))) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | sscanf(pv+10,"%s", currMove); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 322 | if(p = strstr(line+4, " currmovenumber ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | n = currNr = atoi(p+16); | ~~~~~~~~~~~~~~~~~~~~~~~~ 324 | if(collect == 1 && n != 1) continue; // wait for move 1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | if(collect + (n == 1) > 2) { // done collecting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | collect = 3; continue; | ~~~~~~~~~~~~~~~~~~~~~~ 328 | } | ~ 329 | collect = 2; on[nr=n] = 1; strcpy(moveMap[n], currMove); continue; // store move | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 330 | } | ~ 331 | } | ~ 332 | } | ~ 333 | else if(!strcmp(command, "option")) { // USI option: extract data fields | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 334 | char name[80], type[80], buf[1024], val[256], *q; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | int min=0, max=1e9; *val = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 337 | if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 340 | if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if(!strcasecmp(name, "UCI_Variant")) { if(p = strstr(line+6, " var ")) strcpy(varList, p); varOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 343 | if(!strcasecmp(name, "UCI_Opponent")) { namOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | if(!strcasecmp(name+2, "I_AnalyseMode")) { strcpy(anaOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | if(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 346 | EPRINT((f, "# setoption name %s value true\n", name)) strcpy(val, "true"); // set non-standard suspected FRC options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 347 | } | ~ 348 | if(!strcasecmp(name, "Threads")) { strcpy(threadOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 349 | if(!strcasecmp(name, "Ponder") || !strcasecmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 350 | if(!strcasecmp(name, "Hash") || !strcasecmp(name, "USI_Hash") || !strcasecmp(name, "hashsize")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | memory = oldMem = atoi(val); hasHash = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | strcpy(hashOpt, name); | ~~~~~~~~~~~~~~~~~~~~~~ 353 | continue; | ~~~~~~~~~ 354 | } | ~ 355 | if(!strcasecmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | if(!strcasecmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 357 | sprintf(buf, ",%s,", name); if(p = strcasestr(EGT, buf)) { // collect EGT formats | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | strcpy(buf, p); for(p=buf; *++p >='a';){} if(*p == ' ') strcpy(buf, ",scorpio"); *p = 0; strcat(egts, buf); continue; // clip at first non-lower-case | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | } | ~ 360 | // pass on engine-defined option as WB option feature | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if(!strcmp(type, "filename")) type[4] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | else if(sc == 'c' && !strcmp(type, "string")) { // in UCI try to guess which strings are file or directory names | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | if(strcasestr(name, "file")) strcpy(type, "file"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 364 | if(strcasestr(name, "path") || strcasestr(name, "directory") || strcasestr(name, "folder")) strcpy(type, "path"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | } | ~ 366 | sprintf(buf, "feature option=\"%s -%s", name, type); q = buf + strlen(buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | if( !strcmp(type, "file") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | || !strcmp(type, "string")) sprintf(q, " %s\"\n", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369 | else if(!strcmp(type, "spin")) sprintf(q, " %d %d %d\"\n", atoi(val), min, max); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | else if(!strcmp(type, "check")) sprintf(q, " %d\"\n", strcmp(val, "true") ? 0 : 1), strcat(checkOptions, name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | else if(!strcmp(type, "button")) sprintf(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | else if(!strcmp(type, "combo")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %s", type); // current setting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | min = 0; p = line+6; | ~~~~~~~~~~~~~~~~~~~~ 375 | while(p = strstr(p, " var ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | sscanf(p += 5, "%s", val); // next choice | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 378 | } | ~ 379 | strcat(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~ 380 | | 381 | } | ~ 382 | else buf[0] = 0; // ignore unrecognized option types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 383 | if(buf[0]) printf("%s", buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | else if(!strcmp(command, "id")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | static char name[256], version[256]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 | if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | if(sscanf(line, "id version %[^\n]", version) == 1 && *name) printf("feature myname=\"%s %s (U%cI2WB)\"\n", name, version, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | } | ~ 390 | else if(!strcmp(command, "readyok")) return; // resume processing of GUI commands | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | char *p = varList, *q = p; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | while(*q && *q != '\n') if(!strncmp(q, " var ", 5)) *p++ = ',', q +=5; // replace var keywords by commas | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | else if(!strncmp(q-1, " chess ", 7)) strcpy(p, "normal"), p += 6, q += 5; // 'chess' is called 'normal' in CECP | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | else *p++ = *q++; // copy other variant names unmodified | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | *p = 0; | ~~~~~~~ 397 | if(frc) sprintf(p, ",normal,fischerandom"), printf("feature oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 398 | if(!*varList) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); // without clue guess liberally | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | if(*egts) printf("feature egt=\"%s\"\n", egts+1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | printf("feature smp=1 memory=%d done=1\n", hasHash); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | if(unit == 2) { unit = 1; EPRINT((f, "# setoption usemillisec true\n")) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | fflush(stdout); return; // done with options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | } | ~ 406 | } | ~ 407 | | 408 | void | ~~~~ 409 | Move4Engine(char *m) | ~~~~~~~~~~~~~~~~~~~~ 410 | { | ~ 411 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 412 | // convert input move to USI format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 413 | if(m[1] == '@') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | m[1] = '*'; | ~~~~~~~~~~~ 415 | } else { | ~~~~~~~~ 416 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | } | ~ 419 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | if(m[4] == '=') m[4] = 0; // no '=' in USI format! | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | else if(m[4]) m[4] = '+'; // cater to WB 4.4 bug :-( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | } | ~ 424 | } | ~ 425 | | 426 | void DoCommand (); | ~~~~~~~~~~~~~~~~~~ 427 | char mySide; | ~~~~~~~~~~~~ 428 | volatile char queue[10000], *qStart, *qEnd; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | | 430 | void | ~~~~ 431 | LaunchSearch() | ~~~~~~~~~~~~~~ 432 | { | ~ 433 | int i; | ~~~~~~ 434 | | 435 | if(suspended || searching) return; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 436 | | 437 | if(computer == stm || computer == ANALYZE && sm != 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | DPRINT("# start search\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 439 | LoadPos(moveNr); fflush(stdout); // load position | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | // and set engine thinking (note USI swaps colors!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | startTime = GetTickCount(); mySide = stm; // remember side we last played for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 | if(computer == ANALYZE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | EPRINT((f, "# go infinite")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | if(sm & 1) { // some moves are disabled | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | EPRINT((f, " searchmoves")) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for(i=1; i= 'A') board[i++] = c; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | if(c == '/') i++; else | ~~~~~~~~~~~~~~~~~~~~~~ 112 | if(c == ' ') break; else | ~~~~~~~~~~~~~~~~~~~~~~~~ 113 | while(c-- > '0' && i < 99) board[i++] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | if(i >= 99) break; | ~~~~~~~~~~~~~~~~~~ 115 | } | ~ 116 | } | ~ 117 | | 118 | char * | ~~~~~~ 119 | ToFEN(int stm) | ~~~~~~~~~~~~~~ 120 | { | ~ 121 | int i, n=0; static char fen[200]; char *p = fen; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | for(i=0; i<99; i++) { | ~~~~~~~~~~~~~~~~~~~~~ 123 | char c = board[i]; | ~~~~~~~~~~~~~~~~~~ 124 | if(c >= 'A') { if(n) *p++ = '0' + n; n = 0; *p++ = c; } else n ++; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | if(i%10 == 8) { if(n) *p++ = '0' + n; n = -1; *p++ = '/'; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | } | ~ 127 | sprintf(p-1, " %c - - 0 1", stm); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 | return fen; | ~~~~~~~~~~~ 129 | } | ~ 130 | | 131 | int | ~~~ 132 | Sqr(char *m, int j) | ~~~~~~~~~~~~~~~~~~~ 133 | { | ~ 134 | int n = m[j] - 'a' + 10*('9' - m[j+1]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | if(n < 0) n = 0; else if(n > 99) n = 99; return n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | } | ~ 137 | | 138 | int | ~~~ 139 | Play(int nr) | ~~~~~~~~~~~~ 140 | { | ~ 141 | int i, last = -1; | ~~~~~~~~~~~~~~~~~ 142 | FromFEN(iniPos + 13); // FEN part | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | for(i=0; i0)); // byoyomi time | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 158 | if(sc == 'x') black = 1; else drawOffer = 0;// in UCCI 'black' refers to us and 'white' to opponent | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 | if(!x && drawOffer) ponder = " draw", drawOffer = 0; //pass draw offer only when not pondering | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 | EPRINT((f, "# go%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | if(sTime > 0) EPRINT((f, " movetime %d", sTime)) else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 162 | if(mps) EPRINT((f, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 163 | if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", t); // for engines running purely on byoyomi | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if((inc || !mps && !sTime && sc == 'x') && !*suffix) EPRINT((f, " %s %d %s %d", wInc, inc, bInc, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 165 | if(depth > 0) EPRINT((f, " depth %d", depth)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | if(*suffix) EPRINT((f, suffix, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | EPRINT((f, "\n")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 168 | } | ~ 169 | | 170 | void | ~~~~ 171 | StopSearch(int discard) | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | { | ~ 173 | if(!searching) return; | ~~~~~~~~~~~~~~~~~~~~~~ 174 | if(discard) searching = 0; // this causes bestmove to be ignored | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 | } | ~ 177 | | 178 | void | ~~~~ 179 | LoadPos(int moveNr) | ~~~~~~~~~~~~~~~~~~~ 180 | { | ~ 181 | int j, lastCapt = 0; char *pos = iniPos, buf[200], stm; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | if(sc == 'x') { // UCCI: send only reversible moves | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | lastCapt = Play(moveNr); // find last capture (returns -1 if none!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | Play(++lastCapt); // reconstruct board after last capture | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | stm = (!strstr(iniPos+13, " b ") ^ lastCapt & 1 ? 'w' : 'b'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | sprintf(buf, "position fen %s", ToFEN(stm)); pos = buf; // send it as FEN (with "position" in UCCI!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | EPRINT((f, "# %s moves", pos)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | for(j=lastCapt; j= '0' && c <= '9' || c >= 'a' && c <= 'z') *q++ = 'a'+'0'+size - c; else *q++ = c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | } | ~ 218 | *q++ = 0; | ~~~~~~~~~ 219 | return buf; | ~~~~~~~~~~~ 220 | } | ~ 221 | | 222 | void | ~~~~ 223 | Move4GUI(char *m) | ~~~~~~~~~~~~~~~~~ 224 | { | ~ 225 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 226 | // convert USI move to WB format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | if(m[1] == '*') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | m[1] = '@'; | ~~~~~~~~~~~ 231 | } else { | ~~~~~~~~ 232 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | if((stm == WHITE ? (m[1]>'0'+size-size/3 || m[3]>'0'+size-size/3) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | : (m[1] <= '0'+size/3 || m[3] <= '0'+size/3)) && m[4] != '+') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | m[4] = '=', m[5] = 0; | ~~~~~~~~~~~~~~~~~~~~~ 237 | } | ~ 238 | } | ~ 239 | } | ~ 240 | | 241 | int | ~~~ 242 | ReadLine (FILE *f, char *line, int len) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 243 | { | ~ 244 | int x, i = 0; | ~~~~~~~~~~~~~ 245 | while((x = fgetc(f)) != EOF && (line[i] = x) != '\n') i+=(i0 ? 100000 : -100000, statScore = s; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | if(p = strstr(line+4, " score ")) sscanf(p+7, "%d", &s), statScore = s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if(p = strstr(line+4, " nodes ")) sscanf(p+7, "%d", &n), statNodes = n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 310 | if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | if(p = strstr(line+4, " upperbound ")) strcat(p, "?\n"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | if(p = strstr(line+4, " lowerbound ")) strcat(p, "!\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 315 | for(i=0; i= mpvSP) strncpy(pvs[mpvSP], pv+4, 998), scores[mpvSP++] = s, // emit as thinking output if not | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | } else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | if(collect && (pv = strstr(line+4, " currmove "))) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | sscanf(pv+10,"%s", currMove); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 322 | if(p = strstr(line+4, " currmovenumber ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | n = currNr = atoi(p+16); | ~~~~~~~~~~~~~~~~~~~~~~~~ 324 | if(collect == 1 && n != 1) continue; // wait for move 1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | if(collect + (n == 1) > 2) { // done collecting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | collect = 3; continue; | ~~~~~~~~~~~~~~~~~~~~~~ 328 | } | ~ 329 | collect = 2; on[nr=n] = 1; strcpy(moveMap[n], currMove); continue; // store move | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 330 | } | ~ 331 | } | ~ 332 | } | ~ 333 | else if(!strcmp(command, "option")) { // USI option: extract data fields | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 334 | char name[80], type[80], buf[1024], val[256], *q; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | int min=0, max=1e9; *val = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 337 | if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 340 | if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if(!strcasecmp(name, "UCI_Variant")) { if(p = strstr(line+6, " var ")) strcpy(varList, p); varOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 343 | if(!strcasecmp(name, "UCI_Opponent")) { namOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | if(!strcasecmp(name+2, "I_AnalyseMode")) { strcpy(anaOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | if(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 346 | EPRINT((f, "# setoption name %s value true\n", name)) strcpy(val, "true"); // set non-standard suspected FRC options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 347 | } | ~ 348 | if(!strcasecmp(name, "Threads")) { strcpy(threadOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 349 | if(!strcasecmp(name, "Ponder") || !strcasecmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 350 | if(!strcasecmp(name, "Hash") || !strcasecmp(name, "USI_Hash") || !strcasecmp(name, "hashsize")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | memory = oldMem = atoi(val); hasHash = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | strcpy(hashOpt, name); | ~~~~~~~~~~~~~~~~~~~~~~ 353 | continue; | ~~~~~~~~~ 354 | } | ~ 355 | if(!strcasecmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | if(!strcasecmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 357 | sprintf(buf, ",%s,", name); if(p = strcasestr(EGT, buf)) { // collect EGT formats | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | strcpy(buf, p); for(p=buf; *++p >='a';){} if(*p == ' ') strcpy(buf, ",scorpio"); *p = 0; strcat(egts, buf); continue; // clip at first non-lower-case | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | } | ~ 360 | // pass on engine-defined option as WB option feature | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if(!strcmp(type, "filename")) type[4] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | else if(sc == 'c' && !strcmp(type, "string")) { // in UCI try to guess which strings are file or directory names | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | if(strcasestr(name, "file")) strcpy(type, "file"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 364 | if(strcasestr(name, "path") || strcasestr(name, "directory") || strcasestr(name, "folder")) strcpy(type, "path"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | } | ~ 366 | sprintf(buf, "feature option=\"%s -%s", name, type); q = buf + strlen(buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | if( !strcmp(type, "file") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | || !strcmp(type, "string")) sprintf(q, " %s\"\n", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369 | else if(!strcmp(type, "spin")) sprintf(q, " %d %d %d\"\n", atoi(val), min, max); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | else if(!strcmp(type, "check")) sprintf(q, " %d\"\n", strcmp(val, "true") ? 0 : 1), strcat(checkOptions, name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | else if(!strcmp(type, "button")) sprintf(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | else if(!strcmp(type, "combo")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %s", type); // current setting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | min = 0; p = line+6; | ~~~~~~~~~~~~~~~~~~~~ 375 | while(p = strstr(p, " var ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | sscanf(p += 5, "%s", val); // next choice | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 378 | } | ~ 379 | strcat(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~ 380 | | 381 | } | ~ 382 | else buf[0] = 0; // ignore unrecognized option types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 383 | if(buf[0]) printf("%s", buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | else if(!strcmp(command, "id")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | static char name[256], version[256]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 | if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | if(sscanf(line, "id version %[^\n]", version) == 1 && *name) printf("feature myname=\"%s %s (U%cI2WB)\"\n", name, version, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | } | ~ 390 | else if(!strcmp(command, "readyok")) return; // resume processing of GUI commands | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | char *p = varList, *q = p; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | while(*q && *q != '\n') if(!strncmp(q, " var ", 5)) *p++ = ',', q +=5; // replace var keywords by commas | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | else if(!strncmp(q-1, " chess ", 7)) strcpy(p, "normal"), p += 6, q += 5; // 'chess' is called 'normal' in CECP | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | else *p++ = *q++; // copy other variant names unmodified | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | *p = 0; | ~~~~~~~ 397 | if(frc) sprintf(p, ",normal,fischerandom"), printf("feature oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 398 | if(!*varList) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); // without clue guess liberally | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | if(*egts) printf("feature egt=\"%s\"\n", egts+1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | printf("feature smp=1 memory=%d done=1\n", hasHash); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | if(unit == 2) { unit = 1; EPRINT((f, "# setoption usemillisec true\n")) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | fflush(stdout); return; // done with options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | } | ~ 406 | } | ~ 407 | | 408 | void | ~~~~ 409 | Move4Engine(char *m) | ~~~~~~~~~~~~~~~~~~~~ 410 | { | ~ 411 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 412 | // convert input move to USI format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 413 | if(m[1] == '@') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | m[1] = '*'; | ~~~~~~~~~~~ 415 | } else { | ~~~~~~~~ 416 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | } | ~ 419 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | if(m[4] == '=') m[4] = 0; // no '=' in USI format! | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | else if(m[4]) m[4] = '+'; // cater to WB 4.4 bug :-( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | } | ~ 424 | } | ~ 425 | | 426 | void DoCommand (); | ~~~~~~~~~~~~~~~~~~ 427 | char mySide; | ~~~~~~~~~~~~ 428 | volatile char queue[10000], *qStart, *qEnd; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | | 430 | void | ~~~~ 431 | LaunchSearch() | ~~~~~~~~~~~~~~ 432 | { | ~ 433 | int i; | ~~~~~~ 434 | | 435 | if(suspended || searching) return; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 436 | | 437 | if(computer == stm || computer == ANALYZE && sm != 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | DPRINT("# start search\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 439 | LoadPos(moveNr); fflush(stdout); // load position | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | // and set engine thinking (note USI swaps colors!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | startTime = GetTickCount(); mySide = stm; // remember side we last played for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 | if(computer == ANALYZE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | EPRINT((f, "# go infinite")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | if(sm & 1) { // some moves are disabled | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | EPRINT((f, " searchmoves")) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for(i=1; i= 'A') board[i++] = c; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | if(c == '/') i++; else | ~~~~~~~~~~~~~~~~~~~~~~ 112 | if(c == ' ') break; else | ~~~~~~~~~~~~~~~~~~~~~~~~ 113 | while(c-- > '0' && i < 99) board[i++] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | if(i >= 99) break; | ~~~~~~~~~~~~~~~~~~ 115 | } | ~ 116 | } | ~ 117 | | 118 | char * | ~~~~~~ 119 | ToFEN(int stm) | ~~~~~~~~~~~~~~ 120 | { | ~ 121 | int i, n=0; static char fen[200]; char *p = fen; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 122 | for(i=0; i<99; i++) { | ~~~~~~~~~~~~~~~~~~~~~ 123 | char c = board[i]; | ~~~~~~~~~~~~~~~~~~ 124 | if(c >= 'A') { if(n) *p++ = '0' + n; n = 0; *p++ = c; } else n ++; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125 | if(i%10 == 8) { if(n) *p++ = '0' + n; n = -1; *p++ = '/'; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 126 | } | ~ 127 | sprintf(p-1, " %c - - 0 1", stm); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 | return fen; | ~~~~~~~~~~~ 129 | } | ~ 130 | | 131 | int | ~~~ 132 | Sqr(char *m, int j) | ~~~~~~~~~~~~~~~~~~~ 133 | { | ~ 134 | int n = m[j] - 'a' + 10*('9' - m[j+1]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | if(n < 0) n = 0; else if(n > 99) n = 99; return n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | } | ~ 137 | | 138 | int | ~~~ 139 | Play(int nr) | ~~~~~~~~~~~~ 140 | { | ~ 141 | int i, last = -1; | ~~~~~~~~~~~~~~~~~ 142 | FromFEN(iniPos + 13); // FEN part | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | for(i=0; i0)); // byoyomi time | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 158 | if(sc == 'x') black = 1; else drawOffer = 0;// in UCCI 'black' refers to us and 'white' to opponent | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 | if(!x && drawOffer) ponder = " draw", drawOffer = 0; //pass draw offer only when not pondering | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 | EPRINT((f, "# go%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | if(sTime > 0) EPRINT((f, " movetime %d", sTime)) else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 162 | if(mps) EPRINT((f, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 163 | if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", t); // for engines running purely on byoyomi | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if((inc || !mps && !sTime && sc == 'x') && !*suffix) EPRINT((f, " %s %d %s %d", wInc, inc, bInc, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 165 | if(depth > 0) EPRINT((f, " depth %d", depth)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166 | if(*suffix) EPRINT((f, suffix, inc)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | EPRINT((f, "\n")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 168 | } | ~ 169 | | 170 | void | ~~~~ 171 | StopSearch(int discard) | ~~~~~~~~~~~~~~~~~~~~~~~ 172 | { | ~ 173 | if(!searching) return; | ~~~~~~~~~~~~~~~~~~~~~~ 174 | if(discard) searching = 0; // this causes bestmove to be ignored | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 | } | ~ 177 | | 178 | void | ~~~~ 179 | LoadPos(int moveNr) | ~~~~~~~~~~~~~~~~~~~ 180 | { | ~ 181 | int j, lastCapt = 0; char *pos = iniPos, buf[200], stm; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | if(sc == 'x') { // UCCI: send only reversible moves | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | lastCapt = Play(moveNr); // find last capture (returns -1 if none!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 184 | Play(++lastCapt); // reconstruct board after last capture | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 185 | stm = (!strstr(iniPos+13, " b ") ^ lastCapt & 1 ? 'w' : 'b'); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 | sprintf(buf, "position fen %s", ToFEN(stm)); pos = buf; // send it as FEN (with "position" in UCCI!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | } | ~ 188 | EPRINT((f, "# %s moves", pos)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | for(j=lastCapt; j= '0' && c <= '9' || c >= 'a' && c <= 'z') *q++ = 'a'+'0'+size - c; else *q++ = c; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | } | ~ 218 | *q++ = 0; | ~~~~~~~~~ 219 | return buf; | ~~~~~~~~~~~ 220 | } | ~ 221 | | 222 | void | ~~~~ 223 | Move4GUI(char *m) | ~~~~~~~~~~~~~~~~~ 224 | { | ~ 225 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 226 | // convert USI move to WB format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 229 | if(m[1] == '*') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | m[1] = '@'; | ~~~~~~~~~~~ 231 | } else { | ~~~~~~~~ 232 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | if((stm == WHITE ? (m[1]>'0'+size-size/3 || m[3]>'0'+size-size/3) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | : (m[1] <= '0'+size/3 || m[3] <= '0'+size/3)) && m[4] != '+') | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | m[4] = '=', m[5] = 0; | ~~~~~~~~~~~~~~~~~~~~~ 237 | } | ~ 238 | } | ~ 239 | } | ~ 240 | | 241 | int | ~~~ 242 | ReadLine (FILE *f, char *line, int len) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 243 | { | ~ 244 | int x, i = 0; | ~~~~~~~~~~~~~ 245 | while((x = fgetc(f)) != EOF && (line[i] = x) != '\n') i+=(i0 ? 100000 : -100000, statScore = s; else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | if(p = strstr(line+4, " score ")) sscanf(p+7, "%d", &s), statScore = s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if(p = strstr(line+4, " nodes ")) sscanf(p+7, "%d", &n), statNodes = n; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 310 | if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313 | if(p = strstr(line+4, " upperbound ")) strcat(p, "?\n"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | if(p = strstr(line+4, " lowerbound ")) strcat(p, "!\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 315 | for(i=0; i= mpvSP) strncpy(pvs[mpvSP], pv+4, 998), scores[mpvSP++] = s, // emit as thinking output if not | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | } else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | if(collect && (pv = strstr(line+4, " currmove "))) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | sscanf(pv+10,"%s", currMove); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 322 | if(p = strstr(line+4, " currmovenumber ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | n = currNr = atoi(p+16); | ~~~~~~~~~~~~~~~~~~~~~~~~ 324 | if(collect == 1 && n != 1) continue; // wait for move 1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | if(collect + (n == 1) > 2) { // done collecting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | collect = 3; continue; | ~~~~~~~~~~~~~~~~~~~~~~ 328 | } | ~ 329 | collect = 2; on[nr=n] = 1; strcpy(moveMap[n], currMove); continue; // store move | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 330 | } | ~ 331 | } | ~ 332 | } | ~ 333 | else if(!strcmp(command, "option")) { // USI option: extract data fields | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 334 | char name[80], type[80], buf[1024], val[256], *q; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | int min=0, max=1e9; *val = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 337 | if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n'; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 340 | if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if(!strcasecmp(name, "UCI_Variant")) { if(p = strstr(line+6, " var ")) strcpy(varList, p); varOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 343 | if(!strcasecmp(name, "UCI_Opponent")) { namOpt = 1; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | if(!strcasecmp(name+2, "I_AnalyseMode")) { strcpy(anaOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | if(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 346 | EPRINT((f, "# setoption name %s value true\n", name)) strcpy(val, "true"); // set non-standard suspected FRC options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 347 | } | ~ 348 | if(!strcasecmp(name, "Threads")) { strcpy(threadOpt, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 349 | if(!strcasecmp(name, "Ponder") || !strcasecmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 350 | if(!strcasecmp(name, "Hash") || !strcasecmp(name, "USI_Hash") || !strcasecmp(name, "hashsize")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | memory = oldMem = atoi(val); hasHash = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | strcpy(hashOpt, name); | ~~~~~~~~~~~~~~~~~~~~~~ 353 | continue; | ~~~~~~~~~ 354 | } | ~ 355 | if(!strcasecmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | if(!strcasecmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); continue; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 357 | sprintf(buf, ",%s,", name); if(p = strcasestr(EGT, buf)) { // collect EGT formats | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | strcpy(buf, p); for(p=buf; *++p >='a';){} if(*p == ' ') strcpy(buf, ",scorpio"); *p = 0; strcat(egts, buf); continue; // clip at first non-lower-case | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | } | ~ 360 | // pass on engine-defined option as WB option feature | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if(!strcmp(type, "filename")) type[4] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | else if(sc == 'c' && !strcmp(type, "string")) { // in UCI try to guess which strings are file or directory names | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 363 | if(strcasestr(name, "file")) strcpy(type, "file"); else | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 364 | if(strcasestr(name, "path") || strcasestr(name, "directory") || strcasestr(name, "folder")) strcpy(type, "path"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 365 | } | ~ 366 | sprintf(buf, "feature option=\"%s -%s", name, type); q = buf + strlen(buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | if( !strcmp(type, "file") | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | || !strcmp(type, "string")) sprintf(q, " %s\"\n", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369 | else if(!strcmp(type, "spin")) sprintf(q, " %d %d %d\"\n", atoi(val), min, max); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 370 | else if(!strcmp(type, "check")) sprintf(q, " %d\"\n", strcmp(val, "true") ? 0 : 1), strcat(checkOptions, name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371 | else if(!strcmp(type, "button")) sprintf(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | else if(!strcmp(type, "combo")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | if(p = strstr(line+6, " default ")) sscanf(p+1, "default %s", type); // current setting | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | min = 0; p = line+6; | ~~~~~~~~~~~~~~~~~~~~ 375 | while(p = strstr(p, " var ")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | sscanf(p += 5, "%s", val); // next choice | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 378 | } | ~ 379 | strcat(q, "\"\n"); | ~~~~~~~~~~~~~~~~~~ 380 | | 381 | } | ~ 382 | else buf[0] = 0; // ignore unrecognized option types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 383 | if(buf[0]) printf("%s", buf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | else if(!strcmp(command, "id")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | static char name[256], version[256]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 | if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 388 | if(sscanf(line, "id version %[^\n]", version) == 1 && *name) printf("feature myname=\"%s %s (U%cI2WB)\"\n", name, version, sc-32); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 389 | } | ~ 390 | else if(!strcmp(command, "readyok")) return; // resume processing of GUI commands | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | char *p = varList, *q = p; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | while(*q && *q != '\n') if(!strncmp(q, " var ", 5)) *p++ = ',', q +=5; // replace var keywords by commas | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | else if(!strncmp(q-1, " chess ", 7)) strcpy(p, "normal"), p += 6, q += 5; // 'chess' is called 'normal' in CECP | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | else *p++ = *q++; // copy other variant names unmodified | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 396 | *p = 0; | ~~~~~~~ 397 | if(frc) sprintf(p, ",normal,fischerandom"), printf("feature oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 398 | if(!*varList) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); // without clue guess liberally | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | if(*egts) printf("feature egt=\"%s\"\n", egts+1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 401 | printf("feature smp=1 memory=%d done=1\n", hasHash); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | if(unit == 2) { unit = 1; EPRINT((f, "# setoption usemillisec true\n")) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | fflush(stdout); return; // done with options | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | } | ~ 405 | } | ~ 406 | } | ~ 407 | | 408 | void | ~~~~ 409 | Move4Engine(char *m) | ~~~~~~~~~~~~~~~~~~~~ 410 | { | ~ 411 | if(sc == 's') { | ~~~~~~~~~~~~~~~ 412 | // convert input move to USI format | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 413 | if(m[1] == '@') { // drop | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | m[1] = '*'; | ~~~~~~~~~~~ 415 | } else { | ~~~~~~~~ 416 | m[0] = 'a'+'0'+size - m[0]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | m[1] = 'a'+'0'+size - m[1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | } | ~ 419 | m[2] = 'a'+'0'+size - m[2]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 420 | m[3] = 'a'+'0'+size - m[3]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | if(m[4] == '=') m[4] = 0; // no '=' in USI format! | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 422 | else if(m[4]) m[4] = '+'; // cater to WB 4.4 bug :-( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | } | ~ 424 | } | ~ 425 | | 426 | void DoCommand (); | ~~~~~~~~~~~~~~~~~~ 427 | char mySide; | ~~~~~~~~~~~~ 428 | volatile char queue[10000], *qStart, *qEnd; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 429 | | 430 | void | ~~~~ 431 | LaunchSearch() | ~~~~~~~~~~~~~~ 432 | { | ~ 433 | int i; | ~~~~~~ 434 | | 435 | if(suspended || searching) return; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 436 | | 437 | if(computer == stm || computer == ANALYZE && sm != 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 438 | DPRINT("# start search\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 439 | LoadPos(moveNr); fflush(stdout); // load position | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | // and set engine thinking (note USI swaps colors!) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | startTime = GetTickCount(); mySide = stm; // remember side we last played for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 | if(computer == ANALYZE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | EPRINT((f, "# go infinite")); maxDepth = mpvSP = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 | if(sm & 1) { // some moves are disabled | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | EPRINT((f, " searchmoves")) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for(i=1; idebian/buildinfo.gz install -p -m0644 debian/buildinfo.gz debian/uci2wb/usr/share/doc/uci2wb/buildinfo_armhf.gz rm debian/buildinfo.gz make[1]: Leaving directory '/build/uci2wb-4.1+git200714' dh_installchangelogs install -p -m0644 debian/changelog debian/uci2wb/usr/share/doc/uci2wb/changelog.Debian dh_installman man-recode --to-code UTF-8 --suffix .dh-new debian/uci2wb/usr/share/man/man6/uci2wb.6.gz rm -f debian/uci2wb/usr/share/man/man6/uci2wb.6.gz mv debian/uci2wb/usr/share/man/man6/uci2wb.6.dh-new debian/uci2wb/usr/share/man/man6/uci2wb.6 chmod 0644 -- debian/uci2wb/usr/share/man/man6/uci2wb.6 dh_perl dh_link dh_strip_nondeterminism Using 1594724639 as canonical time Normalizing debian/uci2wb/usr/share/doc/uci2wb/buildinfo_armhf.gz using File::StripNondeterminism::handlers::gzip dh_compress cd debian/uci2wb chmod a-x usr/share/doc/uci2wb/README.txt usr/share/doc/uci2wb/changelog.Debian usr/share/man/man6/uci2wb.6 gzip -9nf usr/share/doc/uci2wb/README.txt usr/share/doc/uci2wb/changelog.Debian usr/share/man/man6/uci2wb.6 cd '/build/uci2wb-4.1+git200714' dh_fixperms find debian/uci2wb ! -type l -a -true -a -true -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s find debian/uci2wb/usr/share/doc -type f -a -true -a ! -regex 'debian/uci2wb/usr/share/doc/[^/]*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 0644 find debian/uci2wb/usr/share/doc -type d -a -true -a -true -print0 2>/dev/null | xargs -0r chmod 0755 find debian/uci2wb/usr/share/man -type f -a -true -a -true -print0 2>/dev/null | xargs -0r chmod 0644 find debian/uci2wb -type f \( -name '*.so.*' -o -name '*.so' -o -name '*.la' -o -name '*.a' -o -name '*.js' -o -name '*.css' -o -name '*.scss' -o -name '*.sass' -o -name '*.jpeg' -o -name '*.jpg' -o -name '*.png' -o -name '*.gif' -o -name '*.cmxs' -o -name '*.node' \) -a -true -a -true -print0 2>/dev/null | xargs -0r chmod 0644 find debian/uci2wb/usr/games -type f -a -true -a -true -print0 2>/dev/null | xargs -0r chmod a+x rm -f debian/uci2wb.debhelper.log debian/rules override_dh_missing make[1]: Entering directory '/build/uci2wb-4.1+git200714' dh_missing --fail-missing make[1]: Leaving directory '/build/uci2wb-4.1+git200714' dh_dwz dwz -- debian/uci2wb/usr/games/uci2wb rm -f debian/uci2wb.debhelper.log debian/rules override_dh_strip make[1]: Entering directory '/build/uci2wb-4.1+git200714' dh_strip --dbgsym-migration='uci2wb-dbg (<< 2.0+git160404-1)' install -d debian/.debhelper/uci2wb/dbgsym-root/usr/lib/debug/.build-id/36 objcopy --only-keep-debug --compress-debug-sections debian/uci2wb/usr/games/uci2wb debian/.debhelper/uci2wb/dbgsym-root/usr/lib/debug/.build-id/36/59d88d5c9e9021a5295bfe68ffd92e4f1ea002.debug chmod 0644 -- debian/.debhelper/uci2wb/dbgsym-root/usr/lib/debug/.build-id/36/59d88d5c9e9021a5295bfe68ffd92e4f1ea002.debug strip --remove-section=.comment --remove-section=.note debian/uci2wb/usr/games/uci2wb objcopy --add-gnu-debuglink debian/.debhelper/uci2wb/dbgsym-root/usr/lib/debug/.build-id/36/59d88d5c9e9021a5295bfe68ffd92e4f1ea002.debug debian/uci2wb/usr/games/uci2wb install -d debian/.debhelper/uci2wb/dbgsym-root/usr/share/doc ln -s uci2wb debian/.debhelper/uci2wb/dbgsym-root/usr/share/doc/uci2wb-dbgsym make[1]: Leaving directory '/build/uci2wb-4.1+git200714' dh_makeshlibs rm -f debian/uci2wb/DEBIAN/shlibs dh_shlibdeps install -d debian/uci2wb/DEBIAN dpkg-shlibdeps -Tdebian/uci2wb.substvars debian/uci2wb/usr/games/uci2wb dh_installdeb dh_gencontrol echo misc:Depends= >> debian/uci2wb.substvars echo misc:Pre-Depends= >> debian/uci2wb.substvars install -d debian/.debhelper/uci2wb/dbgsym-root/DEBIAN dpkg-gencontrol -puci2wb -ldebian/changelog -Tdebian/uci2wb.substvars -Pdebian/.debhelper/uci2wb/dbgsym-root -UPre-Depends -URecommends -USuggests -UEnhances -UProvides -UEssential -UConflicts -DPriority=optional -UHomepage -UImportant -UBuilt-Using -DAuto-Built-Package=debug-symbols -UProtected -DPackage=uci2wb-dbgsym "-DDepends=uci2wb (= \${binary:Version})" "-DDescription=debug symbols for uci2wb" -DBuild-Ids=3659d88d5c9e9021a5295bfe68ffd92e4f1ea002 -DSection=debug -UMulti-Arch "-DReplaces=uci2wb-dbg (<< 2.0+git160404-1)" "-DBreaks=uci2wb-dbg (<< 2.0+git160404-1)" chmod 0644 -- debian/.debhelper/uci2wb/dbgsym-root/DEBIAN/control dpkg-gencontrol -puci2wb -ldebian/changelog -Tdebian/uci2wb.substvars -Pdebian/uci2wb chmod 0644 -- debian/uci2wb/DEBIAN/control dh_md5sums cd debian/uci2wb >/dev/null && xargs -r0 md5sum | perl -pe 'if (s@^\\@@) { s/\\\\/\\/g; }' > DEBIAN/md5sums chmod 0644 -- debian/uci2wb/DEBIAN/md5sums cd debian/.debhelper/uci2wb/dbgsym-root >/dev/null && xargs -r0 md5sum | perl -pe 'if (s@^\\@@) { s/\\\\/\\/g; }' > DEBIAN/md5sums chmod 0644 -- debian/.debhelper/uci2wb/dbgsym-root/DEBIAN/md5sums dh_builddeb dpkg-deb --root-owner-group --build debian/uci2wb .. dpkg-deb --root-owner-group --build debian/.debhelper/uci2wb/dbgsym-root .. dpkg-deb: building package 'uci2wb-dbgsym' in '../uci2wb-dbgsym_4.1+git200714-1_armhf.deb'. dpkg-deb: building package 'uci2wb' in '../uci2wb_4.1+git200714-1_armhf.deb'. dpkg-genbuildinfo --build=binary dpkg-genchanges --build=binary >../uci2wb_4.1+git200714-1_armhf.changes dpkg-genchanges: info: binary-only upload (no source code included) dpkg-source --after-build . dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: including full source code in upload I: copying local configuration I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env I: removing directory /srv/workspace/pbuilder/21214 and its subdirectories I: Current time: Thu Jul 29 10:20:59 -12 2021 I: pbuilder-time-stamp: 1627597259