fuzzyworld

herd / commit

Change winThreshold to integer sheep count, surface it in HUD

b90608d0f73e69cc37b8fa640cf6a2990bb6e4af · Pavel Safronov · 2026-05-17 20:39:31 -0700 · parents 21437a01f03c

Change winThreshold to integer sheep count, surface it in HUD

winThreshold was a 0–1 fraction; it's now an explicit count (≤ sheepCount),
which is less ambiguous and easier to reason about when designing levels.
All 10 levels converted to preserve existing difficulty.

The HUD counter now shows "inPen / winThreshold" so players can see the
goal directly. On levels where the threshold is below the total flock,
a dim "(N total)" note appears so the slack is visible.

Pen fill progress now ramps to full-green at the win count rather than
at total flock size.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
 src/levels/LevelConfig.ts | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/levels/LevelConfig.ts b/src/levels/LevelConfig.ts
index 7a95ea2..d12ac01 100644
--- a/src/levels/LevelConfig.ts
+++ b/src/levels/LevelConfig.ts
@@ -29,7 +29,7 @@ export interface LevelConfig {
   penRect: { x: number; y: number; w: number; h: number } // fractions of canvas
   penGateSide: GateSide
   timeLimitSeconds: number | null
-  winThreshold: number
+  winThreshold: number // integer count of sheep that must enter the pen (≤ sheepCount)
 
   spawnClusters: SpawnCluster[]
   obstacles: ObstacleDef[]
@@ -54,7 +54,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.68, y: 0.05, w: 0.25, h: 0.25 },
     penGateSide: 'bottom',
     timeLimitSeconds: 120,
-    winThreshold: 0.8,
+    winThreshold: 5,
     spawnClusters: [{ cx: 0.5, cy: 0.55, r: 0.08, count: 6 }],
     obstacles: [],
     dynamicObstacles: [],
@@ -72,7 +72,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.38, y: 0.78, w: 0.22, h: 0.18 },
     penGateSide: 'top',
     timeLimitSeconds: 150,
-    winThreshold: 1.0,
+    winThreshold: 12,
     spawnClusters: [
       { cx: 0.08, cy: 0.1,  r: 0.04, count: 3 },
       { cx: 0.92, cy: 0.1,  r: 0.04, count: 3 },
@@ -95,7 +95,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.05, y: 0.35, w: 0.22, h: 0.28 },
     penGateSide: 'right',
     timeLimitSeconds: 180,
-    winThreshold: 1.0,
+    winThreshold: 15,
     spawnClusters: [
       { cx: 0.55, cy: 0.5, r: 0.12, count: 12 },
       { cx: 0.88, cy: 0.12, r: 0.03, count: 1 },
@@ -122,7 +122,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.37, y: 0.35, w: 0.26, h: 0.28 },
     penGateSide: 'left',
     timeLimitSeconds: 180,
-    winThreshold: 1.0,
+    winThreshold: 20,
     spawnClusters: [
       { cx: 0.12, cy: 0.5, r: 0.08, count: 10 },
       { cx: 0.88, cy: 0.5, r: 0.08, count: 10 },
@@ -146,7 +146,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.05, y: 0.05, w: 0.22, h: 0.22 },
     penGateSide: 'right',
     timeLimitSeconds: 210,
-    winThreshold: 0.85,
+    winThreshold: 13,
     spawnClusters: [{ cx: 0.55, cy: 0.55, r: 0.15, count: 15 }],
     obstacles: [
       { x: 0.88, y: 0.3,  r: 0.04 },
@@ -175,7 +175,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.7, y: 0.7, w: 0.26, h: 0.24 },
     penGateSide: 'top',
     timeLimitSeconds: 240,
-    winThreshold: 0.8,
+    winThreshold: 15,
     spawnClusters: [
       { cx: 0.15, cy: 0.2,  r: 0.05, count: 3 },
       { cx: 0.5,  cy: 0.15, r: 0.05, count: 3 },
@@ -200,7 +200,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.7, y: 0.3, w: 0.24, h: 0.38 },
     penGateSide: 'left',
     timeLimitSeconds: 180,
-    winThreshold: 0.9,
+    winThreshold: 20,
     spawnClusters: [{ cx: 0.25, cy: 0.5, r: 0.18, count: 22 }],
     obstacles: [
       { x: 0.5,  y: 0.25, r: 0.04 },
@@ -226,7 +226,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.38, y: 0.05, w: 0.24, h: 0.3 },
     penGateSide: 'bottom',
     timeLimitSeconds: 75,
-    winThreshold: 0.8,
+    winThreshold: 24,
     spawnClusters: [
       { cx: 0.2, cy: 0.65, r: 0.12, count: 15 },
       { cx: 0.8, cy: 0.65, r: 0.12, count: 15 },
@@ -247,7 +247,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.38, y: 0.38, w: 0.24, h: 0.24 },
     penGateSide: 'bottom',
     timeLimitSeconds: 270,
-    winThreshold: 1.0,
+    winThreshold: 16,
     spawnClusters: [
       { cx: 0.1,  cy: 0.1,  r: 0.06, count: 2 },
       { cx: 0.5,  cy: 0.05, r: 0.06, count: 2 },
@@ -277,7 +277,7 @@ export const LEVELS: LevelConfig[] = [
     penRect: { x: 0.65, y: 0.05, w: 0.3, h: 0.35 },
     penGateSide: 'bottom',
     timeLimitSeconds: null,
-    winThreshold: 1.0,
+    winThreshold: 25,
     spawnClusters: [
       { cx: 0.2, cy: 0.45, r: 0.12, count: 13 },
       { cx: 0.45, cy: 0.8, r: 0.12, count: 12 },