Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MobilityArea #383

Closed
wants to merge 1 commit into from
Closed

Conversation

Rocky640
Copy link

Include squares occupied by mobile pawns in the MobilityArea

Bench # 7600729

Passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8157 W: 1644 L: 1516 D: 4997

And LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 26086 W: 4274 L: 4051 D: 17761

Retry of an aborted test.
A small speedup (suggested by Joergoster) might help the test pass more
easily
http://tests.stockfishchess.org/tests/view/5599e1960ebc590abbe1b8ca

Bench # 7600729
Master # 7372460
@joergoster
Copy link
Contributor

Well done!

@Rocky640
Copy link
Author

Thank you guys.
It is great to be challenged by your observations and ideas in the forum and your stimulating comments.

@mcostalba
Copy link

Congratulations! A real SPRT[0,6] patch after a vert loooong time.

I would prefer this version to the other one becuase it is easier to simplify.

For instance, once is committed I would remove the attacks, becuase are already take care in other parts of evaluation and I would just write:

Bitboard freePawns[] = { (shift_bb<DELTA_S>(pos.pieces()) & pos.pieces(WHITE, PAWN)) ^ pos.pieces(WHITE, PAWN),
                         (shift_bb<DELTA_N>(pos.pieces()) & pos.pieces(BLACK, PAWN)) ^ pos.pieces(BLACK, PAWN) };

// Do not include in mobility squares protected by enemy pawns or occupied by our blocked pawns or king
Bitboard mobilityArea[] = { ~(ei.attackedBy[BLACK][PAWN] | freePawns[WHITE] | pos.pieces(WHITE, KING)) ,
                            ~(ei.attackedBy[WHITE][PAWN] | freePawns[BLACK] | pos.pieces(BLACK, KING)) };

@mcostalba
Copy link

Ooops, I have misread the code, the correct one is this:

Bitboard blockedPawns[] = { (shift_bb<DELTA_S>(pos.pieces()) & pos.pieces(WHITE, PAWN)),
                            (shift_bb<DELTA_N>(pos.pieces()) & pos.pieces(BLACK, PAWN)) };

// Do not include in mobility squares protected by enemy pawns or occupied by our blocked pawns or king
Bitboard mobilityArea[] = { ~(ei.attackedBy[BLACK][PAWN] | blockedPawns[WHITE] | pos.pieces(WHITE, KING)) ,
                            ~(ei.attackedBy[WHITE][PAWN] | blockedPawns[BLACK] | pos.pieces(BLACK, KING)) };

@tomtor
Copy link

tomtor commented Jul 26, 2015

Congratulations !!!

@lucasart
Copy link

I prefer Marco's version, although it's not functionally equivalent. I think it should be tested before to commit this patch, because it's cleaner and easier to simplify.

@mstembera
Copy link
Contributor

@lucasart
Why test Marco's version before this patch? Should it not be tested as a simplification against the fast version of this patch?

@Rocky640
Copy link
Author

This 383 patch is "one simple idea", but is made of 3 elements
a) pawn push
b) ....and only from rank 4 and beyond
c) pawn captures

Marco's version is really nice indeed and covers a) perfectly (but not b or c)

Whatever plan we choose, it is clear that we will need to run more tests, either simplification tests, or numgame tests.

We can either
PLAN 1) Forget about this 383 and 384 patch, and test (a) alone (Marco's) against current master, then test if (a+b) is better than (a), then test if adding (c) is improvement (3 tests)
OR
PLAN 2) pull this already tested 383, try to remove (c), then try to remove (b) (2 tests)
(the pull request 384 can wait)
OR
PLAN 3) run a 25M numgames match directly @ltc between Marco's version and (unpulled) request 384, than pull the winner, than try to add/remove just (b), than try to add/remove just (c) (3 tests)
OR
some other plan (let me know)

PLAN 2 seems natural, and will take only 2 more tests (well up to 4 since we have to run STC and LTC)
PLAN 1 make sense if we believe in simplicity first, but might need 1 more test,

Either way is fine with me.

@lucasart
Copy link

@Rocky640: I don't think c) is useful. It's the job of the qsearch to resolve captures, and you should write evel assuming that the position is quiet. If a pawn can capture (legally), there's a good reason why it can't. That being said, we have evaluate_threats() which violates this principle, because the horizon effect is still pervasive when you're in qsearch or close to it. But for orthogonality's sake, I'd rather have this only in one place.

@mstembera: you're probably right. it's easier to just commit and test simplification after.

Rocky640 referenced this pull request in Rocky640/Stockfish Jul 27, 2015
Version without the capture
and without the restriction on 3rd rank

Bench # 7804432
@Rocky640
Copy link
Author

Summary of the day:

  1. A simplification test was run by Lucas, Marco's version against "unofficial master 383", and this failed STC
    So a) b) c) is better than a) alone

  2. A simplification test was run by me to remove c), and passed STC and LTC
    Your intuition about remove captures was right !

So no more c) and less noise from now on !
And our new "unofficial master" is a) + b) 
  1. A parameter tweak [0,4] test is now ready to start for
    "a) and only from rank 3 and beyond" against "a) + b)"
 If it pass, (I seriously doubt) 
 the new "unoffical master" would be  "a) and only from rank 3 and beyond"
 (Lucas discussed he might try some tweaking on the pawn PSQT rank_2)

 If not, another parameter tweak might be tried (again, no great expectations here...)
"a) and only from rank 5 and beyond"  against      "a) + b)"
  1. in any case, I will open a new pull request with the winner, using Marco's style.

@lucasart
Copy link

@Rocky640: agree. a+b written using "Marco's style" seems like the right patch to commit.

Whether or not the rank2/3 condition can be removed and compensated by PSQT is another test/patch to be tried after IMO. For now, it appears that the rank2/3 condition is useful.

@Rocky640
Copy link
Author

Agree. We did enough verifications.

Thank you Lucas, and Marco for suggestions and comments which helped improve and simplify the patch.
I think we covered the main points and can proceed with #385 for the conclusion.

Also, a special thanks to all people who contribute workers.

@Rocky640 Rocky640 closed this Jul 28, 2015
glinscott pushed a commit that referenced this pull request Jul 29, 2015
Based off of Pull request #383:

Include squares occupied by some pawns in the MobilityArea
a) not blocked
b) on rank 4 and above
c) or captures

Passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8157 W: 1644 L: 1516 D: 4997

And LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 26086 W: 4274 L: 4051 D: 17761

-----------

Then, a simplification test failed, trying to remove b and c)
LLR: -2.95 (-2.94,2.94) [-3.00,1.00]
Total: 6048 W: 1117 L: 1288 D: 3643

Another simplification test, was run to remove just (c)
Passed STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 28073 W: 5364 L: 5255 D: 17454

And LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 34652 W: 5448 L: 5348 D: 23856

A parameter tweak test showed that changing b) for "on rank 3 and above"
does not work
LLR: -2.95 (-2.94,2.94) [0.00,4.00]
Total: 5233 W: 937 L: 1077 D: 3219

Finally, a small rewrite, and we have this version

Include squares occupied by some pawns in the MobilityArea which are
a) not blocked
b) on rank 4 and above

Bench: 8977899

Resolves #385
@Rocky640 Rocky640 deleted the MobilityArea3 branch August 20, 2015 00:57
niklasf pushed a commit to niklasf/Stockfish that referenced this pull request Jul 13, 2017
Tweak piece-square tables for horde chess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.