From 735065020412cb39728f2cdfc0bdb1ebcf16ce8d Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Thu, 25 Jun 2026 02:37:40 +0000 Subject: [PATCH] Drain simulation projection header validators --- .../HyperTwistMelindaProjectionLibrary.cpp | 124 ++++++++++++++++ ...HyperTwistVirtual3333ProjectionLibrary.cpp | 140 ++++++++++++++++++ .../HyperTwistMelindaProjectionLibrary.h | 123 +-------------- .../HyperTwistVirtual3333ProjectionLibrary.h | 139 +---------------- .../HyperTwist/DEVELOPMENT.md | 39 +++++ 5 files changed, 309 insertions(+), 256 deletions(-) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.cpp index 2d5babd..3eeeeae 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.cpp @@ -311,6 +311,130 @@ namespace HyperTwistMelindaProjectionLibraryInternal } } +bool FHyperTwistMelindaProjectedCubie::IsStructurallyValid() const +{ + if (PositionIndex < 0 + || PositionIndex >= 16 + || PieceId < 0 + || PieceId >= 16 + || LocalGridCoordinate.X < -1 + || LocalGridCoordinate.X > 1 + || LocalGridCoordinate.X == 0 + || LocalGridCoordinate.Y < -1 + || LocalGridCoordinate.Y > 1 + || LocalGridCoordinate.Y == 0 + || LocalGridCoordinate.Z < -1 + || LocalGridCoordinate.Z > 1 + || LocalGridCoordinate.Z == 0 + || SlotLabel.IsEmpty() + || PieceLabel.IsEmpty() + || bPieceInSolvedPosition != (PositionIndex == PieceId) + || Faces.Num() != 3) + { + return false; + } + + bool bSeenAxes[4] = {false, false, false, false}; + for (const FHyperTwistMelindaProjectedCubieFace& Face : Faces) + { + const int32 AxisIndex = static_cast(Face.Axis); + if (!Face.IsStructurallyValid() + || AxisIndex < 0 + || AxisIndex >= 4 + || bSeenAxes[AxisIndex]) + { + return false; + } + + bSeenAxes[AxisIndex] = true; + } + + return true; +} + +bool FHyperTwistMelindaProjectedCell::IsStructurallyValid() const +{ + if (CellLabel.IsEmpty() + || DisplayCenter.ContainsNaN() + || AvailableAxes.Num() != 3 + || Cubies.Num() != 8) + { + return false; + } + + bool bSeenAvailableAxes[4] = {false, false, false, false}; + for (const EHyperTwistMelindaCellAxis Axis : AvailableAxes) + { + const int32 AxisIndex = static_cast(Axis); + if (AxisIndex < 0 + || AxisIndex >= 4 + || Axis == FixedAxis + || bSeenAvailableAxes[AxisIndex]) + { + return false; + } + + bSeenAvailableAxes[AxisIndex] = true; + } + + bool bSeenPositions[16] = { + false, false, false, false, + false, false, false, false, + false, false, false, false, + false, false, false, false + }; + for (const FHyperTwistMelindaProjectedCubie& Cubie : Cubies) + { + if (!Cubie.IsStructurallyValid() + || bSeenPositions[Cubie.PositionIndex]) + { + return false; + } + + bSeenPositions[Cubie.PositionIndex] = true; + for (const FHyperTwistMelindaProjectedCubieFace& Face : Cubie.Faces) + { + if (!AvailableAxes.Contains(Face.Axis)) + { + return false; + } + } + } + + return true; +} + +bool FHyperTwistMelindaCellFirstProjection::IsStructurallyValid() const +{ + if (ProjectionProfile.IsEmpty() + || !Definition.IsStructurallyValid() + || Cells.Num() != 8) + { + return false; + } + + bool bSeenCells[8] = { + false, false, false, false, + false, false, false, false + }; + for (const FHyperTwistMelindaProjectedCell& Cell : Cells) + { + const int32 CellIndex = static_cast(Cell.Cell); + if (!Cell.IsStructurallyValid() + || CellIndex < 0 + || CellIndex >= 8 + || bSeenCells[CellIndex]) + { + return false; + } + + bSeenCells[CellIndex] = true; + } + + return true; +} + + FString UHyperTwistMelindaProjectionLibrary::GetCellLabel(const EHyperTwistMelindaCell Cell) { return HyperTwistMelindaProjectionLibraryInternal::GetCellDescriptor(Cell).Label; diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.cpp index cc8b0b3..f49cd7c 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.cpp @@ -397,6 +397,146 @@ namespace HyperTwistVirtual3333ProjectionLibraryInternal } } +bool FHyperTwistVirtual3333RuntimeState::IsStructurallyValid() const +{ + const TArray SupportedSize = {3, 3, 3, 3}; + if (StateProfile.IsEmpty() + || !Definition.IsStructurallyValid() + || Definition.PuzzleId != TEXT("hypercube/3x3x3x3") + || Definition.PuzzleFamily != EHyperTwistPuzzleFamily::Hypercube + || Definition.Dimension != 4 + || Definition.SizeVector != SupportedSize + || PositionToPiece.Num() != 81 + || PieceOrientations.Num() != 81) + { + return false; + } + + bool bSeenPieces[81] = { + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false + }; + for (int32 PositionIndex = 0; PositionIndex < PositionToPiece.Num(); ++PositionIndex) + { + const int32 PieceId = PositionToPiece[PositionIndex]; + if (PieceId < 0 || PieceId >= 81 || bSeenPieces[PieceId]) + { + return false; + } + + bSeenPieces[PieceId] = true; + } + + for (const FHyperTwistVirtual3333PieceOrientation& Orientation : PieceOrientations) + { + if (!Orientation.IsStructurallyValid()) + { + return false; + } + } + + return true; +} + +bool FHyperTwistVirtual3333ProjectedTesseract::IsStructurallyValid() const +{ + if (PositionIndex < 0 + || PositionIndex >= 81 + || PieceId < 0 + || PieceId >= 81 + || LocalGridCoordinate.X < -1 + || LocalGridCoordinate.X > 1 + || LocalGridCoordinate.Y < -1 + || LocalGridCoordinate.Y > 1 + || LocalGridCoordinate.Z < -1 + || LocalGridCoordinate.Z > 1 + || SlotLabel.IsEmpty() + || PieceLabel.IsEmpty() + || bPieceInSolvedPosition != (PositionIndex == PieceId) + || VisibleCells.Num() != 3) + { + return false; + } + + bool bSeenAxes[4] = {false, false, false, false}; + for (const FHyperTwistVirtual3333ProjectedCell& Cell : VisibleCells) + { + const int32 AxisIndex = static_cast(Cell.Axis); + if (!Cell.IsStructurallyValid() + || AxisIndex < 0 + || AxisIndex >= 4 + || bSeenAxes[AxisIndex]) + { + return false; + } + + bSeenAxes[AxisIndex] = true; + } + + return true; +} + +bool FHyperTwistVirtual3333VisibleProjection::IsStructurallyValid() const +{ + if (ProjectionProfile.IsEmpty() + || !Definition.IsStructurallyValid() + || VisibleSliceCoordinate < -1 + || VisibleSliceCoordinate > 1 + || DisplayAxes.Num() != 3 + || Tesseracts.Num() != 27) + { + return false; + } + + bool bSeenDisplayAxes[4] = {false, false, false, false}; + for (const EHyperTwistVirtual3333Axis Axis : DisplayAxes) + { + const int32 AxisIndex = static_cast(Axis); + if (Axis == VisibleSliceAxis + || AxisIndex < 0 + || AxisIndex >= 4 + || bSeenDisplayAxes[AxisIndex]) + { + return false; + } + + bSeenDisplayAxes[AxisIndex] = true; + } + + bool bSeenPositions[81] = { + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false + }; + int32 VisibleCellCount = 0; + for (const FHyperTwistVirtual3333ProjectedTesseract& Tesseract : Tesseracts) + { + if (!Tesseract.IsStructurallyValid() || bSeenPositions[Tesseract.PositionIndex]) + { + return false; + } + + bSeenPositions[Tesseract.PositionIndex] = true; + VisibleCellCount += Tesseract.VisibleCells.Num(); + } + + return VisibleCellCount == 81; +} + + FHyperTwistPuzzleDefinitionRef UHyperTwistVirtual3333ProjectionLibrary::MakePuzzleDefinition() { return HyperTwistVirtual3333ProjectionLibraryInternal::BuildDefinition(); diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.h index 31e6b41..61d2d2f 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.h @@ -113,46 +113,7 @@ struct FHyperTwistMelindaProjectedCubie UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Melinda") TArray Faces; - bool IsStructurallyValid() const - { - if (PositionIndex < 0 - || PositionIndex >= 16 - || PieceId < 0 - || PieceId >= 16 - || LocalGridCoordinate.X < -1 - || LocalGridCoordinate.X > 1 - || LocalGridCoordinate.X == 0 - || LocalGridCoordinate.Y < -1 - || LocalGridCoordinate.Y > 1 - || LocalGridCoordinate.Y == 0 - || LocalGridCoordinate.Z < -1 - || LocalGridCoordinate.Z > 1 - || LocalGridCoordinate.Z == 0 - || SlotLabel.IsEmpty() - || PieceLabel.IsEmpty() - || bPieceInSolvedPosition != (PositionIndex == PieceId) - || Faces.Num() != 3) - { - return false; - } - - bool bSeenAxes[4] = {false, false, false, false}; - for (const FHyperTwistMelindaProjectedCubieFace& Face : Faces) - { - const int32 AxisIndex = static_cast(Face.Axis); - if (!Face.IsStructurallyValid() - || AxisIndex < 0 - || AxisIndex >= 4 - || bSeenAxes[AxisIndex]) - { - return false; - } - - bSeenAxes[AxisIndex] = true; - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -181,57 +142,7 @@ struct FHyperTwistMelindaProjectedCell UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Melinda") TArray Cubies; - bool IsStructurallyValid() const - { - if (CellLabel.IsEmpty() - || DisplayCenter.ContainsNaN() - || AvailableAxes.Num() != 3 - || Cubies.Num() != 8) - { - return false; - } - - bool bSeenAvailableAxes[4] = {false, false, false, false}; - for (const EHyperTwistMelindaCellAxis Axis : AvailableAxes) - { - const int32 AxisIndex = static_cast(Axis); - if (AxisIndex < 0 - || AxisIndex >= 4 - || Axis == FixedAxis - || bSeenAvailableAxes[AxisIndex]) - { - return false; - } - - bSeenAvailableAxes[AxisIndex] = true; - } - - bool bSeenPositions[16] = { - false, false, false, false, - false, false, false, false, - false, false, false, false, - false, false, false, false - }; - for (const FHyperTwistMelindaProjectedCubie& Cubie : Cubies) - { - if (!Cubie.IsStructurallyValid() - || bSeenPositions[Cubie.PositionIndex]) - { - return false; - } - - bSeenPositions[Cubie.PositionIndex] = true; - for (const FHyperTwistMelindaProjectedCubieFace& Face : Cubie.Faces) - { - if (!AvailableAxes.Contains(Face.Axis)) - { - return false; - } - } - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -248,35 +159,7 @@ struct FHyperTwistMelindaCellFirstProjection UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Melinda") TArray Cells; - bool IsStructurallyValid() const - { - if (ProjectionProfile.IsEmpty() - || !Definition.IsStructurallyValid() - || Cells.Num() != 8) - { - return false; - } - - bool bSeenCells[8] = { - false, false, false, false, - false, false, false, false - }; - for (const FHyperTwistMelindaProjectedCell& Cell : Cells) - { - const int32 CellIndex = static_cast(Cell.Cell); - if (!Cell.IsStructurallyValid() - || CellIndex < 0 - || CellIndex >= 8 - || bSeenCells[CellIndex]) - { - return false; - } - - bSeenCells[CellIndex] = true; - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h index 12fe85c..895a4ec 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h @@ -118,53 +118,7 @@ struct FHyperTwistVirtual3333RuntimeState UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Virtual3333") bool bIsSolved = true; - bool IsStructurallyValid() const - { - const TArray SupportedSize = {3, 3, 3, 3}; - if (StateProfile.IsEmpty() - || !Definition.IsStructurallyValid() - || Definition.PuzzleId != TEXT("hypercube/3x3x3x3") - || Definition.PuzzleFamily != EHyperTwistPuzzleFamily::Hypercube - || Definition.Dimension != 4 - || Definition.SizeVector != SupportedSize - || PositionToPiece.Num() != 81 - || PieceOrientations.Num() != 81) - { - return false; - } - - bool bSeenPieces[81] = { - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false - }; - for (int32 PositionIndex = 0; PositionIndex < PositionToPiece.Num(); ++PositionIndex) - { - const int32 PieceId = PositionToPiece[PositionIndex]; - if (PieceId < 0 || PieceId >= 81 || bSeenPieces[PieceId]) - { - return false; - } - - bSeenPieces[PieceId] = true; - } - - for (const FHyperTwistVirtual3333PieceOrientation& Orientation : PieceOrientations) - { - if (!Orientation.IsStructurallyValid()) - { - return false; - } - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -262,43 +216,7 @@ struct FHyperTwistVirtual3333ProjectedTesseract UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Virtual3333") TArray VisibleCells; - bool IsStructurallyValid() const - { - if (PositionIndex < 0 - || PositionIndex >= 81 - || PieceId < 0 - || PieceId >= 81 - || LocalGridCoordinate.X < -1 - || LocalGridCoordinate.X > 1 - || LocalGridCoordinate.Y < -1 - || LocalGridCoordinate.Y > 1 - || LocalGridCoordinate.Z < -1 - || LocalGridCoordinate.Z > 1 - || SlotLabel.IsEmpty() - || PieceLabel.IsEmpty() - || bPieceInSolvedPosition != (PositionIndex == PieceId) - || VisibleCells.Num() != 3) - { - return false; - } - - bool bSeenAxes[4] = {false, false, false, false}; - for (const FHyperTwistVirtual3333ProjectedCell& Cell : VisibleCells) - { - const int32 AxisIndex = static_cast(Cell.Axis); - if (!Cell.IsStructurallyValid() - || AxisIndex < 0 - || AxisIndex >= 4 - || bSeenAxes[AxisIndex]) - { - return false; - } - - bSeenAxes[AxisIndex] = true; - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -324,58 +242,7 @@ struct FHyperTwistVirtual3333VisibleProjection UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Virtual3333") TArray Tesseracts; - bool IsStructurallyValid() const - { - if (ProjectionProfile.IsEmpty() - || !Definition.IsStructurallyValid() - || VisibleSliceCoordinate < -1 - || VisibleSliceCoordinate > 1 - || DisplayAxes.Num() != 3 - || Tesseracts.Num() != 27) - { - return false; - } - - bool bSeenDisplayAxes[4] = {false, false, false, false}; - for (const EHyperTwistVirtual3333Axis Axis : DisplayAxes) - { - const int32 AxisIndex = static_cast(Axis); - if (Axis == VisibleSliceAxis - || AxisIndex < 0 - || AxisIndex >= 4 - || bSeenDisplayAxes[AxisIndex]) - { - return false; - } - - bSeenDisplayAxes[AxisIndex] = true; - } - - bool bSeenPositions[81] = { - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false - }; - int32 VisibleCellCount = 0; - for (const FHyperTwistVirtual3333ProjectedTesseract& Tesseract : Tesseracts) - { - if (!Tesseract.IsStructurallyValid() || bSeenPositions[Tesseract.PositionIndex]) - { - return false; - } - - bSeenPositions[Tesseract.PositionIndex] = true; - VisibleCellCount += Tesseract.VisibleCells.Num(); - } - - return VisibleCellCount == 81; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) diff --git a/docs/v6_5_deep_manual_pack/HyperTwist/DEVELOPMENT.md b/docs/v6_5_deep_manual_pack/HyperTwist/DEVELOPMENT.md index 4aec39c..ebea7a1 100644 --- a/docs/v6_5_deep_manual_pack/HyperTwist/DEVELOPMENT.md +++ b/docs/v6_5_deep_manual_pack/HyperTwist/DEVELOPMENT.md @@ -427,6 +427,45 @@ Latest same-day higher-dimensional runtime header cleanup follow-up still on simulation/recognition/core ownership rather than more Phase 6C runtime cleanup +Latest same-day simulation projection header cleanup follow-up still on +`2026-06-25`: + +- the next bounded simulation-family packet then moved the larger structural + validators out of: + - `Public/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h` + - `Public/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.h` +- private ownership now lives in: + - `Private/HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.cpp` + - `Private/HyperTwistSimulation/HyperTwistMelindaProjectionLibrary.cpp` +- the moved validator family covered: + - `FHyperTwistVirtual3333RuntimeState::IsStructurallyValid()` + - `FHyperTwistVirtual3333ProjectedTesseract::IsStructurallyValid()` + - `FHyperTwistVirtual3333VisibleProjection::IsStructurallyValid()` + - `FHyperTwistMelindaProjectedCubie::IsStructurallyValid()` + - `FHyperTwistMelindaProjectedCell::IsStructurallyValid()` + - `FHyperTwistMelindaCellFirstProjection::IsStructurallyValid()` +- `scripts/run-hypertwist-sentrux-source-only.sh` then improved again to: + - `Quality: 6175` + - all `7` rules passing +- the simulation projection headers now retain only smaller residual inline + validators: + - `24` lines for `FHyperTwistVirtual3333PieceOrientation` + - `6` lines for `FHyperTwistVirtual3333SliceTurnRequest` + - `4` lines for `FHyperTwistVirtual3333ProjectedCell` + - `4` lines for `FHyperTwistMelindaProjectedCubieFace` +- the overall public-header inline-validator hotspots now shift again toward + recognition/core plus a remaining viewer seam: + - `42` lines for `FHyperTwistVisionBrowserShellProfile` + - `42` lines for `FHyperTwistMelinda2x2x2x2ScramblePacket` + - `40` lines for `FHyperTwistSpeechMicrophoneShellProfile` + - `39` lines for `FHyperTwistSpeechProviderProfile` + - `36` lines for the current `HyperTwistViewerTypes.h` lead seam +- current truthful “vanilla refactor” reading tightens again: + - the simulation projection headers are no longer meaningful large + inline-validator hotspots + - if we continue the same structural hardening lane, the next honest family + is recognition/core ownership rather than more simulation projection cleanup + Latest same-day browser/distribution continuity follow-up still on `2026-06-24`: - auth-entry, protected-route loading, dashboard auth health, and release-authority fallback states now share a more deliberate operator-facing recovery shape instead of scattering single-line warnings across public and protected surfaces