Created
May 8, 2024 17:50
-
-
Save gabrielbauman/cfa02949c7b5a05b17c041938f1bc5a8 to your computer and use it in GitHub Desktop.
A stupid module for calculating relationship satisfaction in a couple based on employment differences and jealousy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export module RelationshipModel { | |
// Constants for the model | |
const k1 = 0.5; // Influence of self-satisfaction on relationship satisfaction | |
const k2 = 0.3; // Influence of jealousy/admiration on relationship satisfaction | |
const k3 = 0.2; // Influence of motivated opportunities on relationship satisfaction | |
const k4 = 0.6; // Influence of employment success on self-satisfaction | |
const k5 = -0.4; // Impact of jealousy on self-satisfaction (negative implies reducing self-satisfaction) | |
const k6 = 0.2; // Impact of opportunities on self-satisfaction | |
const k7 = 0.5; // Sensitivity of jealousy/admiration to differences in success | |
const k8 = 0.3; // How desire for success affects jealousy/admiration | |
const k9 = 0.7; // Impact of jealousy/desire combination on motivation | |
const k10 = 0.3; // Impact of the gap between opportunities and current success on motivation | |
/** | |
* Calculates the level of jealousy (or admiration, if positive) that partner A feels towards partner B, | |
* based on the difference in their employment success and partner A's desire for success. | |
* @param ea - Employment success of partner A (range: 0-10) | |
* @param eb - Employment success of partner B (range: 0-10) | |
* @param desire - Partner A's desire for employment success (range: 0-10) | |
* @returns The level of jealousy (-ve value) or admiration (+ve value) of partner A towards partner B. | |
*/ | |
export function calculateJealousy(ea: number, eb: number, desire: number): number { | |
return k7 * (ea - eb) + k8 * desire; | |
} | |
/** | |
* Calculates the motivation level based on jealousy/admiration, desire for success, and the opportunity-employment gap. | |
* @param jealousy - Current level of jealousy/admiration (range: -10 to 10) | |
* @param desire - Desire for employment success (range: 0-10) | |
* @param opportunities - Available opportunities (range: 0-10) | |
* @param employment - Current employment success (range: 0-10) | |
* @returns Calculated motivation level, which can be negative if demotivation occurs. | |
*/ | |
export function calculateMotivation(jealousy: number, desire: number, opportunities: number, employment: number): number { | |
return k9 * (desire * jealousy) + k10 * (opportunities - employment); | |
} | |
/** | |
* Calculates self-satisfaction based on employment success, jealousy/admiration, and opportunities. | |
* @param employment - Current employment success (range: 0-10) | |
* @param jealousy - Current level of jealousy/admiration (range: -10 to 10) | |
* @param opportunities - Available opportunities (range: 0-10) | |
* @returns Self-satisfaction level, where higher values indicate greater satisfaction. | |
*/ | |
export function calculateSelfSatisfaction(employment: number, jealousy: number, opportunities: number): number { | |
return k4 * employment + k5 * jealousy + k6 * opportunities; | |
} | |
/** | |
* Calculates relationship satisfaction based on self-satisfaction, jealousy/admiration, and motivated opportunities. | |
* @param selfSatisfaction - Self-satisfaction of the individual (range: 0-10) | |
* @param jealousy - Current level of jealousy/admiration (range: -10 to 10) | |
* @param motivation - Current motivation level (can be negative) | |
* @param opportunities - Available opportunities (range: 0-10) | |
* @returns Relationship satisfaction level, where higher values indicate greater satisfaction. | |
*/ | |
export function calculateRelationshipSatisfaction(selfSatisfaction: number, jealousy: number, motivation: number, opportunities: number): number { | |
return k1 * selfSatisfaction + k2 * jealousy + k3 * (motivation * opportunities); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment