Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/simulator/hooks/useSimulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,15 @@ function generateFeedbackType(
recommendedTechniques.includes(t),
)

// Randomly select feedback type with weighted probability
// Randomly select feedback type with weighted probability.
// We use magic numbers here to simulate the non-deterministic,
// subjective nature of human responses in therapeutic settings.
// Even if a recommended technique is used perfectly, a client might not
// always respond positively. This avoids creating a binary training environment.
const rand = Math.random()

if (usedRecommendedTechnique) {
// Higher chance of positive feedback when using recommended techniques
// 70% chance of POSITIVE, 15% DEVELOPMENTAL, 15% TECHNIQUE_SUGGESTION
if (rand < 0.7) {
return FeedbackType.POSITIVE
} else if (rand < 0.85) {
Expand All @@ -223,6 +227,7 @@ function generateFeedbackType(
return FeedbackType.TECHNIQUE_SUGGESTION
}
} else if (rand < 0.3) {
// 30% chance of POSITIVE, 30% DEVELOPMENTAL, 20% TECHNIQUE_SUGGESTION, 20% ALTERNATIVE_APPROACH
return FeedbackType.POSITIVE
} else if (rand < 0.6) {
Comment on lines 228 to 232
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The probability breakdown comment is placed inside the else if (rand < 0.3) branch, which can read as if that branch itself has a 30/30/20/20 distribution (but it actually returns POSITIVE 100% of the time once inside). Move this comment to the start of the !usedRecommendedTechnique path (e.g., immediately after the closing brace of the usedRecommendedTechnique block / before the first rand threshold check) so it clearly documents the distribution for the whole else-case.

Copilot uses AI. Check for mistakes.
return FeedbackType.DEVELOPMENTAL
Expand Down
Loading