Sort residents by least flexibility first
This commit is contained in:
@@ -17,8 +17,8 @@ const YEAR: i32 = 2026;
|
||||
pub struct ToxicPair((ResidentId, ResidentId));
|
||||
|
||||
impl ToxicPair {
|
||||
pub fn new(res_id_1: u8, res_id_2: u8) -> Self {
|
||||
Self((ResidentId(res_id_1), ResidentId(res_id_2)))
|
||||
pub fn new(r_id_1: u8, r_id_2: u8) -> Self {
|
||||
Self((ResidentId(r_id_1), ResidentId(r_id_2)))
|
||||
}
|
||||
|
||||
pub fn matches(&self, other: &ToxicPair) -> bool {
|
||||
@@ -134,6 +134,14 @@ impl UserConfig {
|
||||
}
|
||||
supply
|
||||
}
|
||||
|
||||
pub fn flexibility_map(&self) -> HashMap<ResidentId, u8> {
|
||||
let mut map = HashMap::new();
|
||||
for r in &self.residents {
|
||||
map.insert(r.id, r.allowed_types.len() as u8);
|
||||
}
|
||||
map
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for UserConfig {
|
||||
|
||||
Reference in New Issue
Block a user