1.g4 opening is losing?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: 1.g4 opening is losing?

Post by Ovyron »

Zenmastur wrote: Tue Feb 11, 2020 10:47 pm Beating me playing a 1.g4 game will prove nothing about you or your hardware.
It'd prove I don't need better hardware to beat your 1.g4 :D
Zenmastur wrote: Tue Feb 11, 2020 10:47 pmIf you want a test play an open sicilian or something like that.
Now, the deal was that if I can get your position within 5 mating moves from its real mating moves you play 1.g4, so I'm still on it! :mrgreen:
Zenmastur
Posts: 919
Joined: Sat May 31, 2014 8:28 am

Re: 1.g4 opening is losing?

Post by Zenmastur »

Ovyron wrote: Tue Feb 11, 2020 10:56 pm
Zenmastur wrote: Tue Feb 11, 2020 10:47 pm Beating me playing a 1.g4 game will prove nothing about you or your hardware.
It'd prove I don't need better hardware to beat your 1.g4 :D
Zenmastur wrote: Tue Feb 11, 2020 10:47 pmIf you want a test play an open sicilian or something like that.
Now, the deal was that if I can get your position within 5 mating moves from its real mating moves you play 1.g4, so I'm still on it! :mrgreen:
OK! When your done post it and we'll have a look at what you've got.
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.
jp
Posts: 1470
Joined: Mon Apr 23, 2018 7:54 am

Re: 1.g4 opening is losing?

Post by jp »

Ovyron wrote: Tue Feb 11, 2020 8:11 pm Must be here:

Code: Select all

        if (nullValue >= beta)
        {
            // Do not return unproven mate scores
            if (nullValue >= VALUE_MATE_IN_MAX_PLY)
                nullValue = beta;

            if (thisThread->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 13))
                return nullValue;

            assert(!thisThread->nmpMinPly); // Recursive verification is not allowed

            // Do verification search at high depths, with null move pruning disabled
            // for us, until ply exceeds nmpMinPly.
            thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4;
            thisThread->nmpColor = us;

            Value v = search<NonPV>(pos, ss, beta-1, beta, depth-R, false);

            thisThread->nmpMinPly = 0;

            if (v >= beta)
                return nullValue;
        }
    }
The engine will only show a mate score if it has been "proven".
Thanks for this.

The comment "// Do not return unproven mate scores" certainly seems to make the coder's intention clear, even if the code is less clear.

I also wonder what the comment "// Recursive verification is not allowed" means.

Zenmastur wrote: Tue Feb 11, 2020 9:52 pm This used to piss me off to no end. I dealt with it day in and day out. And it really sucked when you would lose hours and hours of work. On very hard problems this would happen over and over again. Then I added RAM to my system and the problem became MUCH less sever. But, I had maxed my system out and the problem came back on yet harder problems. I eventually upgraded my machine and MAXED the ram in it. I rarely saw this happen after that. I've upgrade again recently and have put even more RAM in my system. I've done some very long mates and haven't seen it happen yet. I'm sure it will, its just a matter of time.
Can't you just hack the code (like the code above) with print statements, so it at least prints to file the mate announcement and PV and you don't lose hours and hours of work, no matter what happens with RAM, TTs, etc. afterwards?
Last edited by jp on Wed Feb 12, 2020 10:37 pm, edited 1 time in total.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: 1.g4 opening is losing?

Post by Ovyron »

jp wrote: Wed Feb 12, 2020 10:30 pm I also wonder what the comment "// Recursive verification is not allowed" means.
There's this place when you can ask such questions.
jp
Posts: 1470
Joined: Mon Apr 23, 2018 7:54 am

Re: 1.g4 opening is losing?

Post by jp »

True, but this isn't all that technical. On second thoughts, maybe I will.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: 1.g4 opening is losing?

Post by Ovyron »

It is, the explanation of what this does:

Code: Select all

thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4;
            thisThread->nmpColor = us;

            Value v = search<NonPV>(pos, ss, beta-1, beta, depth-R, false);
Is very technical.
jp
Posts: 1470
Joined: Mon Apr 23, 2018 7:54 am

Re: 1.g4 opening is losing?

Post by jp »

Does it not seem a bit strange to you that, even if "engine forgetting" is really happening, it has problems with fail highs after finding (and allegedly forgetting) mate scores?
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: 1.g4 opening is losing?

Post by Ovyron »

No. The engine finds a mate, say, from the white side. It stores it in the TT. As long as the mate line remains on the TT, it'll continue to display it or display a shorter one when it finds it. As soon as new information overwrites this mate, then it's as if this mate was never found.

When you're analyzing from the losing side, in this example black, you get a big fail high from the mate score to the best white moves you have still on the TT, which can be longer mates, or in this case, just a score of 10.00. This behavior is inevitable because the TT has finite space, and it's overwritten at random (TT is stored on the computer's RAM, which stands for "Random Access Memory"), so if it happens that all known mates have been overwritten, you get this and it'll need to find them again, but back when they were reported, they were correct.

If this wasn't the case, Zenmastur could go to the tail of the variation of any won position's mainline, find a mate, and then move to previous positions until he was back on the root, and the engine would show a mate score in there. But along the way, this will be overwritten, so when he's back to the root the engine has forgotten how to mate from this position.
jp
Posts: 1470
Joined: Mon Apr 23, 2018 7:54 am

Re: 1.g4 opening is losing?

Post by jp »

Ovyron wrote: Wed Feb 12, 2020 10:55 pm If this wasn't the case, Zenmastur could go to the tail of the variation of any won position's mainline, find a mate, and then move to previous positions until he was back on the root, and the engine would show a mate score in there. But along the way, this will be overwritten, so when he's back to the root the engine has forgotten how to mate from this position.
Backtracking like this is a slightly different topic. Even with all the RAM he wants ("engine forgetting" solved), he won't necessarily be able to backtrack to mate at the root, because backtracking will discover different defensive moves (which may or may not still give up mate, but the engine won't necessarily know).
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: 1.g4 opening is losing?

Post by Ovyron »

jp wrote: Wed Feb 12, 2020 11:02 pm Backtracking like this is a slightly different topic. Even with all the RAM he wants ("engine forgetting" solved), he won't necessarily be able to backtrack to mate at the root, because backtracking will discover different defensive moves (which may or may not still give up mate, but the engine won't necessarily know).
That's why I said "mainline". Mainline means the absolute best moves from black to defend, as you go back in the positions the engine won't change her mind about them because the alternatives lose faster, so it'll still show the mating line up to the root (if the mate in the TT survives.)

This is in fact what I'm doing with his position, to exhaust all black defenses, with the help from a learning engine (that saves important stuff to hard disk, so I can do it with just 128MB RAM for the TT) and it works (I can show a mate score in the root that guarantees black can't delay mate more than it shows, but it's possible white has a faster mate, because you never know if a position that Stockfish says it's just 6.00 actually explodes and mates faster...)