Drain simulation projection header validators

This commit is contained in:
axiomlogicnexus 2026-06-25 02:37:40 +00:00
parent a0093950fe
commit 7350650204
5 changed files with 309 additions and 256 deletions

View file

@ -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<int32>(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<int32>(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<int32>(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;

View file

@ -397,6 +397,146 @@ namespace HyperTwistVirtual3333ProjectionLibraryInternal
}
}
bool FHyperTwistVirtual3333RuntimeState::IsStructurallyValid() const
{
const TArray<int32> 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<int32>(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<int32>(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();

View file

@ -113,46 +113,7 @@ struct FHyperTwistMelindaProjectedCubie
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Melinda")
TArray<FHyperTwistMelindaProjectedCubieFace> 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<int32>(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<FHyperTwistMelindaProjectedCubie> 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<int32>(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<FHyperTwistMelindaProjectedCell> 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<int32>(Cell.Cell);
if (!Cell.IsStructurallyValid()
|| CellIndex < 0
|| CellIndex >= 8
|| bSeenCells[CellIndex])
{
return false;
}
bSeenCells[CellIndex] = true;
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)

View file

@ -118,53 +118,7 @@ struct FHyperTwistVirtual3333RuntimeState
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|Virtual3333")
bool bIsSolved = true;
bool IsStructurallyValid() const
{
const TArray<int32> 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<FHyperTwistVirtual3333ProjectedCell> 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<int32>(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<FHyperTwistVirtual3333ProjectedTesseract> 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<int32>(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)

View file

@ -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