Penalty Systems
Relevant source files
The following files were used as context for generating this wiki page:
The Penalty System is a core behavioral enforcement mechanism within the Solo System project designed to gamify personal development. It monitors user progress on daily tasks and applies point deductions when goals are not met within a specific timeframe. This system ensures accountability by linking task completion directly to the user's Rank and Experience (XP) progression.
The system operates on a daily cycle, utilizing localized time zones to synchronize task resets and penalty evaluations. By tracking the delta between the current date and the last recorded update, the system can determine if a user has failed to complete their assigned daily objectives, subsequently triggering a "Penalty" state that reduces the user's total point balance.
Sources: Quest.html:1-10, index.html:1-10
Architecture and Data Flow
The penalty logic is integrated into the client-side JavaScript engine and relies on localStorage for persistence. The system state is encapsulated in a systemData object, which tracks total points, the last update timestamp, current daily tasks, and the most recent penalty amount.
The flow above illustrates how the system detects a date change and triggers the penalty calculation before allowing new tasks to be generated.
Sources: Quest.html:142-178, index.html:142-178
State Management
The system tracks the following data structure to maintain consistency across sessions:
| Field | Type | Description |
|---|---|---|
points | Number | The current total XP/Points of the user. |
lastUpdate | String | ISO date string of the last time the system cycled. |
dailyTasks | Array | List of objects containing task name, category, and completion status. |
lastPenalty | Number | The value of the most recent deduction applied to the user. |
Sources: Quest.html:101-103, index.html:101-103
Penalty Logic and Calculations
The penalty system is dynamic, scaling the severity of the deduction based on the user's current Rank. As a user progresses to higher ranks (e.g., Rank S or R), the "Failure Deduction" (pen) increases, making maintenance of high ranks more challenging.
Rank-Based Scaling
The function getRankConfig(pts) defines the penalty parameters for each point threshold:
| Rank | Point Threshold | Reward | Penalty (pen) | Difficulty Level |
|---|---|---|---|---|
| R | 3000+ | 6 | 8 | r |
| SS | 2000 | 6 | 8 | r |
| S | 1200 | 4 | 6 | a |
| A | 800 | 4 | 6 | a |
| B | 500 | 4 | 6 | d |
| C | 300 | 3 | 5 | d |
| D | 150 | 3 | 5 | d |
| E/F | 0-149 | 2 | 3 | f |
Sources: Quest.html:105-115, index.html:105-115
Penalty Execution Process
The checkDailyCycle function is responsible for executing penalties. It compares the current date (Asia/Riyadh time zone) with systemData.lastUpdate. If a discrepancy is found, it iterates through the dailyTasks array. For every task where task.d (done) is false, the system adds the current rank's pen value to a totalPenalty variable.
Sources: Quest.html:150-174, index.html:150-174
User Interface and Feedback
The system provides immediate visual feedback when a penalty is applied. The updateUI function modifies the status-msg element to warn the user of point loss.
- Penalty Notification: If
systemData.lastPenaltyis greater than 0, the message⚠️ تم تطبيق عقوبة: خصم [X] نقاط لتجاهل المهام!is displayed in red. - Deduction Reset: The penalty message is cleared as soon as a user interacts with a new task via the
toggleTaskfunction, settinglastPenaltyback to 0.
Sources: Quest.html:127-140, index.html:127-140, Quest.html:180-186
Task Generation and Difficulty
The penalty system is intrinsically linked to the task generator. The system pulls tasks from taskDatabase and filters them based on the diff (difficulty) parameter associated with the user's current rank. This ensures that users are penalized based on their ability level.
Task Database structure
The database contains categories for Physical, Discipline, and Mental tasks, each mapped to difficulty levels:
f: Easy (Beginner)d: Medium (Intermediate)a: Hard (Advanced)r: Extreme (Ranker)
Sources: Quest.html:84-100, index.html:84-100
Conclusion
The Penalty System serves as the primary enforcement tool within the Solo System, ensuring that progression is not merely a matter of time but of consistent daily effort. By scaling penalties with rank and automating the detection of failed tasks via a localized daily cycle, the system creates a high-stakes environment for user productivity.