From 382c7e5d1c620cab0fb3fa65dcf1aa5648aae791 Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Mon, 27 Apr 2026 22:54:27 +0200 Subject: [PATCH] Shape coach decks by handoff preference --- .../HyperTwistTrainingSubsystem.cpp | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp index ff953cb..180ff7d 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp @@ -97,26 +97,54 @@ namespace HyperTwistTrainingSubsystemInternal int32 ResolvePreferredCoachCaseBudget( const int32 MaxCases, const EHyperTwistTrainingCoachGuidanceLane DeckLane, - const FHyperTwistTrainingCoachMemorySnapshot& CoachMemorySnapshot) + const FHyperTwistTrainingCoachMemorySnapshot& CoachMemorySnapshot, + const bool bQueuedLaunch) { - int32 DesiredCaseCount = MaxCases > 0 ? MaxCases : 3; + const int32 DesiredCaseCount = MaxCases > 0 ? MaxCases : 3; + int32 AdjustedCaseCount = DesiredCaseCount; if (CoachMemorySnapshot.PreferredGuidanceLane == EHyperTwistTrainingCoachGuidanceLane::FollowUp && DeckLane == EHyperTwistTrainingCoachGuidanceLane::FollowUp) { - return FMath::Max(1, DesiredCaseCount - 1); + AdjustedCaseCount = FMath::Max(1, AdjustedCaseCount - 1); } - - if (CoachMemorySnapshot.PreferredGuidanceLane == EHyperTwistTrainingCoachGuidanceLane::Recommended + else if (CoachMemorySnapshot.PreferredGuidanceLane == EHyperTwistTrainingCoachGuidanceLane::Recommended && DeckLane == EHyperTwistTrainingCoachGuidanceLane::Recommended - && DesiredCaseCount <= 3 + && AdjustedCaseCount <= 3 && (CoachMemorySnapshot.bHasRepeatRecommendationPressure || CoachMemorySnapshot.RecommendedGuidanceContinueBias > 0 || CoachMemorySnapshot.RecurringCoachCaseIds.Num() >= 3)) { - return DesiredCaseCount + 1; + AdjustedCaseCount += 1; } - return DesiredCaseCount; + if (CoachMemorySnapshot.PreferredCoachHandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue + && bQueuedLaunch + && DeckLane != EHyperTwistTrainingCoachGuidanceLane::FollowUp + && (CoachMemorySnapshot.ScheduleDeferredEventCount > 0 + || CoachMemorySnapshot.ScheduleManualRescheduleEventCount > 0 + || CoachMemorySnapshot.bHasQueueExecutionCompletionGap)) + { + AdjustedCaseCount += 1; + } + else if (CoachMemorySnapshot.PreferredCoachHandoffKind == EHyperTwistTrainingCoachHandoffKind::FollowUp + && DeckLane == EHyperTwistTrainingCoachGuidanceLane::FollowUp + && (CoachMemorySnapshot.FollowUpReadyCoachSequenceCount > 0 + || CoachMemorySnapshot.ScheduleBlockedFollowUpEventCount > 0 + || CoachMemorySnapshot.FollowUpGuidanceContinueBias > 0)) + { + AdjustedCaseCount = FMath::Max(1, AdjustedCaseCount - 1); + } + else if (CoachMemorySnapshot.PreferredCoachHandoffKind == EHyperTwistTrainingCoachHandoffKind::Recommended + && DeckLane == EHyperTwistTrainingCoachGuidanceLane::Recommended + && AdjustedCaseCount <= 4 + && (CoachMemorySnapshot.bHasRepeatRecommendationPressure + || CoachMemorySnapshot.RecommendedGuidanceContinueBias > 0 + || CoachMemorySnapshot.RecurringCoachCaseIds.Num() >= 2)) + { + AdjustedCaseCount += 1; + } + + return FMath::Max(1, AdjustedCaseCount); } const FHyperTwistTrainingCoachSessionQueueStateEntry* FindNextRunnableCoachQueueEntry( @@ -176,7 +204,8 @@ namespace HyperTwistTrainingSubsystemInternal const int32 DesiredCaseCount = ResolvePreferredCoachCaseBudget( MaxCases, GuidanceLaneFromQueueSourceLabel(QueueEntry.SourceLabel), - CoachMemorySnapshot + CoachMemorySnapshot, + true ); FHyperTwistTrainingDeck SourceDeck; if (!QueueEntry.FocusDeckId.IsEmpty()) @@ -1166,7 +1195,8 @@ FHyperTwistTrainingDeck UHyperTwistTrainingSubsystem::BuildActiveCoachRecommende const int32 DesiredCaseCount = HyperTwistTrainingSubsystemInternal::ResolvePreferredCoachCaseBudget( MaxCases, EHyperTwistTrainingCoachGuidanceLane::Recommended, - ActiveCoachMemorySnapshot + ActiveCoachMemorySnapshot, + false ); TArray FocusCases; for (const FString& FocusCaseId : ActiveCoachBrief.FocusCaseIds) @@ -1244,7 +1274,8 @@ FHyperTwistTrainingDeck UHyperTwistTrainingSubsystem::BuildActiveCoachFollowUpDe const int32 DesiredCaseCount = HyperTwistTrainingSubsystemInternal::ResolvePreferredCoachCaseBudget( MaxCases, EHyperTwistTrainingCoachGuidanceLane::FollowUp, - ActiveCoachMemorySnapshot + ActiveCoachMemorySnapshot, + false ); TArray FocusCases; for (const FString& FocusCaseId : ActiveCoachFollowUpBrief.FocusCaseIds)