Skip to content

Conversation

@protonspring
Copy link

@protonspring protonspring commented Jan 10, 2020

This is a non-functional simplification. If we pass the color the entry instead of the template, one of the classify methods goes away.

Furthermore, I've resolved the colors in some of the statements (we're already assuming direction using NORTH), and used stm (side to move) instead of "us," since this is much more clear to me.

This is not tested because it is non-functional, only applies building the bitbase and there are no changes to the binary (on my machine).

EDIT: See changes below.

@joergoster
Copy link
Contributor

joergoster commented Jan 12, 2020

Doesn't even compile here!
gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1~18.04.1), standard builds

bitbase.cpp: In member function ‘{anonymous}::Result {anonymous}::KPKPosition::classify(Color, const std::vector<{anonymous}::KPKPosition>&)’:
bitbase.cpp:164:56: error: ‘stm’ is not a constant expression
constexpr Result Good = (stm == WHITE ? WIN : DRAW);
^
bitbase.cpp:165:55: error: ‘stm’ is not a constant expression
constexpr Result Bad = (stm == WHITE ? DRAW : WIN);

And seems to take a tiny fraction more time (after removing constexpr from Result):
master
KPK bitbase initialization took 0.020326 seconds.
KPK bitbase initialization took 0.0202334 seconds.

patch
KPK bitbase initialization took 0.0206636 seconds.
KPK bitbase initialization took 0.0205861 seconds.

@snicolet
Copy link
Member

Ah, not compiling should definitely be fixed, but taking 0.0003 seconds more for initialization time is not really an issue, it can even be considered a feature if we use these 0.3 milliseconds to relax and do zen meditation.

@protonspring
Copy link
Author

@joergoster You seem to not have all of the changes. The commit clearly changes the constexpr to "const."

@joergoster
Copy link
Contributor

@protonspring You're right! I apologize, I simply missed them ...

@protonspring
Copy link
Author

Good news. I thought I was going crazy.

@protonspring
Copy link
Author

The color parm is removed by just using the KPK instance color variable stm.

My binary is now a tiny bit different (12 bytes). Does this need tested now?

@snicolet
Copy link
Member

My current plan is to merge simplifications after the SF11 release, please delay any new test a little bit to help https://tests.stockfishchess.org/tests/view/5e1bbedfd12216a2857e63a4 :-)

@snicolet snicolet closed this in 75dfdea Jan 23, 2020
@snicolet
Copy link
Member

Merged via 75dfdea, thanks!

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.

3 participants