#include "aoc.h" #include namespace aoc2015 { static spell bosskill = {0, 1, 8, 0, 0, 0, 0}; static spell spells[5] = { {53, 1, 4, 0, 0, 0, 0}, {73, 1, 2, 2, 0, 0, 0}, {113, 6, 0, 0, 0, 7, 0}, {173, 6, 3, 0, 0, 0, 0}, {229, 5, 0, 0, 101, 0, 0}, }; void effects(wizard& w) { for (int i = 0; i < 5; i++) { spell* s = w.spells[i]; if (s != nullptr && s->tick > 0) { w.points -= s->damage; w.wp->points += s->heals; w.wp->mana += s->payback; w.wp->armor += s->protect; s->tick -= 1; } } } void fight(int turn, wizard& me, wizard& boss, int* cost, std::vector& costs) { // wizard* w = turn % 2 == 1 ? &me : &boss; } std::pair day22(wizard me, wizard boss) { me.wp = &boss; boss.wp = &me; me.spells[0] = &bosskill; for (int i = 0; i < 5; i++) { boss.spells[i] = spells + i; } int cost{0}; std::vector costs; fight(1, me, boss, &cost, costs); int min{INT32_MAX}; for(auto& c : costs) { if (c < min) { min = c; } } return {min, 0}; } }