Skip to content

Fix getHexagonRequiredNodeId1 case 3 condition for all even rings#588

Merged
chrxh merged 1 commit intofeatures/ConstructionSequencesfrom
copilot/fix-hexagon-required-node-id
Apr 8, 2026
Merged

Fix getHexagonRequiredNodeId1 case 3 condition for all even rings#588
chrxh merged 1 commit intofeatures/ConstructionSequencesfrom
copilot/fix-hexagon-required-node-id

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

ShapeGenerator::getHexagonRequiredNodeId1 side 4 (case 3) duplicates the 3rd entry only for even-k rings, but the condition was hardcoded to k == 4 instead of checking all even rings.

  • Changed condition from k == 4 && pos == 2 to (k % 2 == 0) && pos == 2
// Before
if (k == 4 && pos == 2) {
    return s + 3 * k - 1;
}

// After
if ((k % 2 == 0) && pos == 2) {
    return s + 3 * k - 1;
}

Verified against the full expected sequence (127 values through ring 7) and the generateHexagon_61cells_withSeparation integration test.

@chrxh chrxh marked this pull request as ready for review April 8, 2026 20:20
@chrxh chrxh merged commit ff60467 into features/ConstructionSequences Apr 8, 2026
@chrxh chrxh deleted the copilot/fix-hexagon-required-node-id branch April 8, 2026 20:20
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.

2 participants