Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type mismatches and clamping issues in colony system calculations #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/systems/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ impl Cell {
neighbors: Vec::new(),
energy: 100.0,
dimensional_position: DimensionalPosition {
emergence: 50,
coherence: 50,
resilience: 50,
intelligence: 50,
efficiency: 50,
integration: 50,
emergence: 50.0,
coherence: 50.0,
resilience: 50.0,
intelligence: 50.0,
efficiency: 50.0,
integration: 50.0,
},
dopamine: 0.5,
enhanced_state: EnhancedCellState::new(),
Expand Down Expand Up @@ -530,10 +530,10 @@ impl Cell {
let efficiency_adj = (dimension_adjustment * 10.0) as i32;

// Apply adjustments and clamp to 0-100 range
self.dimensional_position.emergence = (self.dimensional_position.emergence + emergence_adj).clamp(0, 100);
self.dimensional_position.coherence = (self.dimensional_position.coherence + coherence_adj).clamp(0, 100);
self.dimensional_position.intelligence = (self.dimensional_position.intelligence + intelligence_adj).clamp(0, 100);
self.dimensional_position.efficiency = (self.dimensional_position.efficiency + efficiency_adj).clamp(0, 100);
self.dimensional_position.emergence = (self.dimensional_position.emergence + emergence_adj as f64).clamp(0.0, 100.0);
self.dimensional_position.coherence = (self.dimensional_position.coherence + coherence_adj as f64).clamp(0.0, 100.0);
self.dimensional_position.intelligence = (self.dimensional_position.intelligence + intelligence_adj as f64).clamp(0.0, 100.0);
self.dimensional_position.efficiency = (self.dimensional_position.efficiency + efficiency_adj as f64).clamp(0.0, 100.0);

// Adjust dopamine based on context alignment
self.dopamine = self.dopamine * 0.9 + self.context_alignment_score * 0.1;
Expand Down
13 changes: 6 additions & 7 deletions src/systems/colony.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,13 +1100,12 @@ impl Colony {
let integration_adj = (adjustment_factor * 9.0) as i32;

// Apply adjustments and clamp to 0-100 range
cell.dimensional_position.emergence = (cell.dimensional_position.emergence + emergence_adj).clamp(0, 100);
cell.dimensional_position.coherence = (cell.dimensional_position.coherence + coherence_adj).clamp(0, 100);
cell.dimensional_position.resilience = (cell.dimensional_position.resilience + resilience_adj).clamp(0, 100);
cell.dimensional_position.intelligence = (cell.dimensional_position.intelligence + intelligence_adj).clamp(0, 100);
cell.dimensional_position.efficiency = (cell.dimensional_position.efficiency + efficiency_adj).clamp(0, 100);
cell.dimensional_position.integration = (cell.dimensional_position.integration + integration_adj).clamp(0, 100);

cell.dimensional_position.coherence = (cell.dimensional_position.coherence + coherence_adj as f64).clamp(0.0, 100.0);
cell.dimensional_position.resilience = (cell.dimensional_position.resilience + resilience_adj as f64).clamp(0.0, 100.0);
cell.dimensional_position.intelligence = (cell.dimensional_position.intelligence + intelligence_adj as f64).clamp(0.0, 100.0);
cell.dimensional_position.efficiency = (cell.dimensional_position.efficiency + efficiency_adj as f64).clamp(0.0, 100.0);
cell.dimensional_position.integration = (cell.dimensional_position.integration + integration_adj as f64).clamp(0.0, 100.0);

println!("Cell {} dimensional audit:", cell_id);
println!(" Plan execution rate: {:.1}%", execution_rate * 100.0);
println!(" Emergence: {:.1}", cell.dimensional_position.emergence);
Expand Down