From 0f831acf45358c54494a2e01f421227fd1f1e291 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Mon, 9 Nov 2026 17:03:58 -0500 Subject: [PATCH] add permanent weapon marks --- simulator/src/main.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/simulator/src/main.rs b/simulator/src/main.rs index 378d823..087f947 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -84,6 +84,11 @@ impl Robot { .map(|contact| contact.point1.distance(self.pose.translation)).reduce(|x: f32,y: f32| x.min(y)) } + fn crater(&self) -> (f32, f32, f32, Color) { + let tl = self.pose.translation; + (tl.x, tl.y, KILL_RADIUS, ORANGE) + } + fn draw_weapon(&self) { let tl = self.pose.translation; draw_circle(tl.x, tl.y, KILL_RADIUS, ORANGE); @@ -166,6 +171,8 @@ async fn run_simulation() -> (i32, i32) { let mut watchdog = 0; // iterations since something interesting let mut robots = Vec::new(); + let mut craters: Vec<(f32, f32, f32, Color)> = Vec::new(); + let mut score = HashMap::new(); for i in 5..20 { @@ -198,6 +205,12 @@ async fn run_simulation() -> (i32, i32) { //let rendered = false; clear_background(LIGHTGRAY); + if rendered { + for crater in &craters { + draw_circle(crater.0, crater.1, crater.2, Color::new(0.75, 0.75, 0.75, 1.0)); + } + } + for food in &mut food{ if let Some(team) = food.detect(robots.iter()) { if food.living() { @@ -248,7 +261,8 @@ async fn run_simulation() -> (i32, i32) { death = false; // pacifists } if death { - if true {robot.draw_weapon();} + if rendered {robot.draw_weapon();} + craters.push(robot.crater()); robot.weapon(peers); } if rendered { robot.draw();}