Skip to content

[BUG] [v0.0.7] BRAIN_WIDTH constant is 37 but all BRAIN_ART lines are 36 characters wide (off-by-one) #143

@Antics7777

Description

@Antics7777

Description

In cortex-core/src/widgets/brain.rs, the BRAIN_WIDTH constant is set to 37, but every line in BRAIN_ART is exactly 36 characters wide.

const BRAIN_ART: &[&str] = &[
    "          %%#*##*****###@@          ",  // 36 chars
    "      @%***+****+++#+**#%#@@@@      ",  // 36 chars
    // ... all 12 lines are 36 chars
    "@#*#*++++@#****+++++*##++##%%%*#@@@@", // 36 chars (no padding)
    // ...
];

const BRAIN_WIDTH: u16 = 37;  // BUG: should be 36

This off-by-one causes three incorrect behaviors:

  1. Centering is shifted: area.width.saturating_sub(BRAIN_WIDTH) / 2 subtracts 37 instead of 36, shifting the brain right by ~0.5 characters
  2. Wave animation center is wrong: center_x = BRAIN_WIDTH as f32 / 2.0 = 18.5 instead of 18.0, making the radial pulsation asymmetric
  3. Concentric band animation center is wrong: get_display_char also uses BRAIN_WIDTH for its center, creating off-center band rings

Error Message

No crash, but visually incorrect behavior: the wave and band animations pulse from an off-center point (18.5 instead of 18.0).

Debug Logs

Verified by measuring all 12 art lines:

Line 01 Length=36: [          %%#*##*****###@@          ]
Line 02 Length=36: [      @%***+****+++#+**#%#@@@@      ]
Line 03 Length=36: [    @%*++*%#*+*+*#+++##*%%++@@@@    ]
Line 04 Length=36: [ @%***+**+++***+*#++*****%%@@%*%@@  ]
Line 05 Length=36: [ %++****+##++*++*##******%@*#@%#@@@ ]
Line 06 Length=36: [@#*#*++++@#****+++++*##++##%%%*#@@@@]
Line 07 Length=36: [%*++*+++***+*#*+++**++++**%@%#*%@@@@]
Line 08 Length=36: [@**+**+**+#*#+++#*+###*#####@@@@@@@@]
Line 09 Length=36: [ ##@@%@@#+#**###%@@%%%%#####%@@@@@@@]
Line 10 Length=36: [   @@@@ @@@@@#%@@@@@@%*+**#*#@@@@   ]
Line 11 Length=36: [           @@@@   @@%%@%%%%%%@@@    ]
Line 12 Length=36: [                     @##@@@@@@      ]

System Information

Bounty Challenge System Information
====================================
Version: 0.1.0
## Operating System
  OS: Windows
  Version: Microsoft Windows [Version 10.0.26200.7840]
## Build Environment
  Rust: rustc 1.90.0 (1159e78c4 2025-09-14)
  Target: x86_64
====================================

Steps to Reproduce

  1. Count character widths of BRAIN_ART lines in cortex-core/src/widgets/brain.rs
  2. Compare with BRAIN_WIDTH constant (37)
  3. All 12 lines are 36 characters — BRAIN_WIDTH is off by one

Or, observe the animation center point: center_x = BRAIN_WIDTH as f32 / 2.0 = 18.5, but the actual center of a 36-char-wide art is 18.0.

Expected Behavior

BRAIN_WIDTH should be 36 to match the actual art width. The wave animation and centering should use the correct width.

Actual Behavior

BRAIN_WIDTH is 37, causing off-center wave animation and slightly shifted centering.

Additional Context

  • Affected code: cortex-core/src/widgets/brain.rs:50
  • Fix: Change const BRAIN_WIDTH: u16 = 37; to const BRAIN_WIDTH: u16 = 36;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions