ELASTIC WORDS (ELW) Documentation

Hour 1: Cargo Setup & Memory Structures for Family Feud 2.


Section 1: Project Initialization

Set up the Rust environment and add the necessary dependencies. Verify the installation by running the initial build.

cargo new family_feud
cd family_feud
cargo add ratatui crossterm rand
cargo run

Section 2: Core Data Structures

Define the base models in main.rs. We use i8 for the PointPool to prevent integer underflow during calculations before clamping.

use rand::Rng;

#[derive(Debug, Clone)]
pub struct PointPool {
    pub aggro: i8,
    pub comm: i8,
    pub amor: i8,
    pub prize: i8,
}

#[derive(Debug, Clone)]
pub enum EraModifier { Golden, Dark, None }

#[derive(Debug, Clone)]
pub enum Quirk {
    Charismatic, Frugal, Fierce, Passionate, Visionary,
    Peacemaker, Ruthless, Fertile, MidasTouch, Loyal,
}

#[derive(Debug, Clone)]
pub enum Fault {
    Abrasive, Wasteful, Cowardly, Frigid, Gullible,
    Traitorous, Reckless, Lustful, Slothful, Paranoid,
}

#[derive(Debug, Clone)]
pub struct FamilyMember {
    pub name: String,
    pub quirk: Quirk,
    pub fault: Fault,
}

#[derive(Debug, Clone)]
pub struct Family {
    pub members: Vec<FamilyMember>,
    pub pool: PointPool,
    pub active_era: EraModifier,
    pub growth_rate: u8,
}

Section 3: Trait Enumerations

These enums will be assigned to Family Members and influence the simulation's algorithmic weights.

Enum Name Type Values
Quirk Buff Charismatic, Frugal, Fierce, Passionate, Visionary, Peacemaker, Ruthless, Fertile, MidasTouch, Loyal
Fault Debuff Abrasive, Wasteful, Cowardly, Frigid, Gullible, Traitorous, Reckless, Lustful, Slothful, Paranoid

Section 4: Implementation

Implement the clamping logic to strictly enforce the 0-15 bounds of the Golden Rule.

impl PointPool {
    pub fn new() -> Self {
        Self {
            aggro: 7,
            comm: 7,
            amor: 7,
            prize: 7,
        }
    }

    pub fn apply_modifier(&mut self, aggro_mod: i8, comm_mod: i8, amor_mod: i8, prize_mod: i8) {
        self.aggro = (self.aggro + aggro_mod).clamp(0, 15);
        self.comm = (self.comm + comm_mod).clamp(0, 15);
        self.amor = (self.amor + amor_mod).clamp(0, 15);
        self.prize = (self.prize + prize_mod).clamp(0, 15);
    }
}

Section 5: Testing

Verify that large modifiers do not bypass the integer limits by running the unit tests.

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_point_pool_clamping() {
        let mut pp = PointPool::new();
        
        pp.apply_modifier(10, -10, 20, -20);
        
        assert_eq!(pp.aggro, 15);
        assert_eq!(pp.comm, 0);
        assert_eq!(pp.amor, 15);
        assert_eq!(pp.prize, 0);
    }
}
  1. Save main.rs in Emacs.
  2. Open vterm.
  3. Run cargo test to verify the Golden Rule.



© 2026 ELASTIC WORDS (ELW).
Optimized for 800x600 resolution.