[Dots] Fix calculation of scoring (infer it from ownership)#38
[Dots] Fix calculation of scoring (infer it from ownership)#38
Conversation
Modern processors support AVX2 and it's a common scenario
There was a problem hiding this comment.
Pull request overview
This PR fixes the calculation of scoring for the Dots game variant by inferring it from ownership rather than using complex heuristics based on intermediate game state. The changes simplify the scoring logic and improve code quality through const correctness and C++17 style improvements.
Changes:
- Refactored Dots scoring calculation to infer from ownership instead of computing from state (activeColor, placedColor, territory, grounding)
- Added const qualifiers to pointer parameters in training data writing functions
- Improved CMake configuration to enable AVX2 by default on non-ARM platforms
- Enhanced Windows CI to test both OPENCL and EIGEN backends
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cpp/neuralnet/nninputs.cpp | Simplified Dots scoring logic to infer from ownership array; removed complex heuristics and replaced with direct ownership-to-scoring mapping |
| cpp/dataio/trainingwrite.h | Added const qualifiers to finalFullArea, finalOwnership, and finalWhiteScoring parameters |
| cpp/dataio/trainingwrite.cpp | Added const qualifiers and refactored ownership checking logic using C++17 init-statements in if-conditions for clarity |
| cpp/CMakeLists.txt | Changed AVX2 default from disabled to enabled on non-ARM platforms; improved ARM architecture detection and messaging |
| .github/workflows/build.yml | Added matrix strategy to test both OPENCL and EIGEN backends on Windows; removed conditional artifact upload restriction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cpp/dataio/trainingwrite.cpp
Outdated
| if (!hist.rules.isDots) { | ||
| if (Color finalFullAreaAtLoc = finalFullArea[loc]; finalFullAreaAtLoc != C_EMPTY) { | ||
| //Mark full area points that ended up not being owned | ||
| rowOwnership[pos+posArea] = static_cast<int8_t>(finalFullAreaAtLoc == nextPlayer ? 1 : -1); |
There was a problem hiding this comment.
The static_cast<int8_t> here is inconsistent with lines 713 and 715 where no cast is used for similar assignments to rowOwnership[pos]. Since rowOwnership is an int8_t* array, the implicit conversion from integer literals is safe and the cast is unnecessary. For consistency, consider removing the cast or applying it to all similar assignments.
| rowOwnership[pos+posArea] = static_cast<int8_t>(finalFullAreaAtLoc == nextPlayer ? 1 : -1); | |
| rowOwnership[pos+posArea] = (finalFullAreaAtLoc == nextPlayer ? 1 : -1); |
192f12c to
673029b
Compare
No description provided.