fix health reset on feeding

This commit is contained in:
Max Känner 2025-01-22 00:42:55 +01:00
parent 3a163fd6e7
commit d858d88e76

View File

@ -458,12 +458,12 @@ impl Snake {
pub fn advance(&mut self, head: Coord) { pub fn advance(&mut self, head: Coord) {
self.body.push_back(head); self.body.push_back(head);
self.body.pop_front(); self.body.pop_front();
self.health = 100;
} }
pub fn feed(&mut self) { pub fn feed(&mut self) {
if let Some(tail) = self.body.front() { if let Some(tail) = self.body.front() {
self.body.push_front(*tail); self.body.push_front(*tail);
self.health = 100;
} }
} }
} }