feat: ✨ able to give file output
This commit is contained in:
parent
930223c0eb
commit
2eb0fff95d
4 changed files with 104 additions and 38 deletions
|
@ -1,3 +1,5 @@
|
|||
use core::fmt;
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -55,3 +57,13 @@ impl FoodSource {
|
|||
food_sources
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for FoodSource {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"fitness = {}\ncoordinates = {:#?}\ntry_counter = {}\n",
|
||||
self.fitness, self.coordinates, self.try_counter
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue