add tests

This commit is contained in:
2022-05-03 15:45:37 +02:00
parent d8e2107cce
commit 1d49b31272
4 changed files with 355 additions and 148 deletions
+13 -14
View File
@@ -1,25 +1,24 @@
// use crate::prelude::*;
// pub const MUTATION_TRAIT_INCREASE_PROBABILITY:i32 = 50;
// pub const MUTATION_TRAIT_CHANGE_AMOUNT:i32 = 20;
#[derive(Debug)]
// #[derive(Debug)]
pub struct Disease {
pub infection_rate:u32,
pub curing_rate:u32,
pub death_rate:u32,
pub infection_rate: u32,
pub curing_rate: u32,
pub death_rate: u32,
pub traits: Vec<u32>,
pub name: String,
}
impl Disease{
pub fn new(infection_r:u32,curing_r:u32,death_r:u32,the_name:String) -> Self{
Self{
infection_rate : infection_r,
curing_rate : curing_r,
death_rate : death_r,
name : the_name,
traits : vec![infection_r,curing_r,death_r],
impl Disease {
pub fn new(infection_r: u32, curing_r: u32, death_r: u32, the_name: String) -> Self {
Self {
infection_rate: infection_r,
curing_rate: curing_r,
death_rate: death_r,
name: the_name,
traits: vec![infection_r, curing_r, death_r],
}
}
// pub fn mutate(&mut self){
@@ -39,4 +38,4 @@ impl Disease{
// self.traits[i] = new_ratio as u32;
// }
// }
}
}