Compare commits

...

13 Commits

Author SHA1 Message Date
Fabian Schmidt
5531e8aa7a Merge 2024-12-01 19:51:02 +01:00
Fabian Schmidt
cd1249a5fe Getting closer to y2015d22p2 2024-12-01 19:45:27 +01:00
00692c18df y2015d22 new approach, no recursion, still broken 2024-11-15 16:01:09 +01:00
46deb678df y2015d22 tests work, solution incorrect and slow 2024-11-15 13:23:57 +01:00
Fabian Schmidt
7d0ed36699 refactoring 2024-11-10 19:51:54 +01:00
1d9c848525 y2015d21 2024-11-05 15:44:23 +01:00
aa28df24b3 y2015d20 2024-11-04 15:56:30 +01:00
261a2e89c9 y2015d19 I should look at the input more 2024-11-04 14:41:15 +01:00
16ed2a8cae y2015d18 2024-11-04 12:44:22 +01:00
0d2fd4b451 Format y2015d15 and add check to prevent overriding days... 2024-11-04 11:32:48 +01:00
9438245d84 y2015d17 + fix some warnings 2024-11-04 10:16:20 +01:00
Fabian Schmidt
7f93abc07d y2015d16 2024-11-02 13:35:50 +01:00
Fabian Schmidt
a687f18918 Script to prepare days and years 2024-11-01 16:52:33 +01:00
2 changed files with 30 additions and 1 deletions

View File

@ -63,7 +63,6 @@ pub fn process_part1(input: &str) -> i32 {
highest_happiness highest_happiness
} }
pub fn process_part2(input: &str) -> i32 { pub fn process_part2(input: &str) -> i32 {
let mut happiness_table = HashMap::new(); let mut happiness_table = HashMap::new();
let mut people = Vec::new(); let mut people = Vec::new();

View File

@ -36,6 +36,36 @@ pub fn process_part1(input: &str) -> u32 {
if leaf.state == State::Playing { if leaf.state == State::Playing {
//println!("try for leaf"); //println!("try for leaf");
for spell in Spell::get_all() { for spell in Spell::get_all() {
match spell.name {
SpellID::MagicMissile | SpellID::Drain => {}
SpellID::Shield => {
if !leaf
.player
.status_effects
.iter()
.any(|effect| effect.name == SpellID::Shield && effect.duration > 1)
{
continue;
}
}
SpellID::Poison => {
if !leaf
.player
.status_effects
.iter()
.any(|effect| effect.name == SpellID::Poison && effect.duration > 1)
{
continue;
}
}
SpellID::Recharge => {
if !leaf.player.status_effects.iter().any(|effect| {
effect.name == SpellID::Recharge && effect.duration > 1
}) {
continue;
}
}
}
leafs.push(leaf.use_spell(spell)); leafs.push(leaf.use_spell(spell));
} }
} }