0.5, // What socks to wear 'minor' => 2.0, // What to eat for lunch 'moderate' => 5.0, // Whether to go to the gym 'major' => 15.0, // Whether to accept a job offer 'critical' => 25.0 // Whether to move to a new city ]; /** * Represents the person's ability to make a decision based on their current mental energy * and the complexity of previous decisions made that day */ public function makeDecision(string $type, string $context): ?bool { if (!array_key_exists($type, $this->decisionWeights)) { throw new InvalidArgumentException("Unknown decision type"); } // Check if this is a habitual decision if ($this->isHabitualDecision($context)) { return $this->followHabit($context); } $energyCost = $this->calculateDecisionEnergyCost($type); // Apply decision fatigue factors $energyCost *= $this->getTimeFatigueFactor(); $energyCost *= $this->getDecisionStackFactor(); if ($this->mentalEnergy < $energyCost) { return $this->defaultToEasiestOption(); } $this->mentalEnergy -= $energyCost; $this->decisionsToday[] = [ 'type' => $type, 'context' => $context, 'energyCost' => $energyCost, 'timeOfDay' => time() ]; return $this->evaluateOptions($type, $context); } /** * Calculate how much harder decisions become as the day progresses */ private function getTimeFatigueFactor(): float { $hourOfDay = (int) date('H'); return 1 + ($hourOfDay / 24) * 0.5; } /** * Calculate how each subsequent decision becomes harder due to cognitive load */ private function getDecisionStackFactor(): float { $recentDecisions = array_filter($this->decisionsToday, function($decision) { return time() - $decision['timeOfDay'] < 3600; // Within last hour }); return 1 + (count($recentDecisions) * 0.1); } /** * When mental energy is too low, default to whatever requires least energy */ private function defaultToEasiestOption(): bool { // People tend to: // - Say "no" to new things // - Stick with defaults // - Choose whatever's presented first // - Postpone if possible return false; } /** * Restore mental energy through rest */ public function rest(int $minutes): void { $restorationRate = 0.5; // Mental energy points per minute $this->mentalEnergy = min( 100.0, $this->mentalEnergy + ($minutes * $restorationRate) ); } /** * Convert a decision into a habit to reduce future mental load */ public function formHabit(string $context, bool $defaultChoice): void { $this->habits[$context] = [ 'choice' => $defaultChoice, 'strength' => 0 ]; } /** * Strengthen a habit through repetition */ private function strengthenHabit(string $context): void { if (isset($this->habits[$context])) { $this->habits[$context]['strength'] = min( 100, $this->habits[$context]['strength'] + 1 ); } } }