Add evaluate() function that combines the eval fn's with weights

This commit is contained in:
tali 2023-03-07 19:10:26 -05:00
parent c2e91dc30a
commit d52e4da215
1 changed files with 25 additions and 0 deletions

View File

@ -5,6 +5,31 @@ mod downstacking;
pub use downstacking::mystery_mdse;
pub fn evaluate(mat: &Mat, pcnt: usize) -> i32 {
// TODO: public interface for weights etc.
struct Weights {
height: i32,
i_deps: i32,
mdse: i32,
pcnt: i32,
}
const W: Weights = Weights {
height: 5,
i_deps: 10,
mdse: 10,
pcnt: 10,
};
let mut rating = 0;
rating += max_height(mat) * W.height;
rating += i_deps(mat) * W.i_deps;
rating += mystery_mdse(mat) * W.mdse;
rating += (pcnt as i32) * W.pcnt;
rating
}
pub fn max_height(matrix: &Mat) -> i32 {
matrix.rows() as i32
}