Reflowed problems and added solutions

This commit is contained in:
2018-03-15 11:24:23 -05:00
parent 986d17f104
commit 2a37946673
50 changed files with 2124 additions and 1464 deletions

View File

@@ -1,50 +1,52 @@
Advent of Code
br0xen 44*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- Day 22: Wizard Simulator 20XX ---
Little Henry Case decides that defeating bosses with swords and stuff is boring. Now he's
playing the game with a wizard. Of course, he gets stuck on another boss and needs your help
again.
Little Henry Case decides that defeating bosses with swords and stuff is
boring. Now he's playing the game with a wizard. Of course, he gets stuck on
another boss and needs your help again.
In this version, combat still proceeds with the player and the boss taking alternating turns.
The player still goes first. Now, however, you don't get any equipment; instead, you must
choose one of your spells to cast. The first character at or below 0 hit points loses.
In this version, combat still proceeds with the player and the boss taking
alternating turns. The player still goes first. Now, however, you don't get
any equipment; instead, you must choose one of your spells to cast. The
first character at or below 0 hit points loses.
Since you're a wizard, you don't get to wear armor, and you can't attack normally. However,
since you do magic damage, your opponent's armor is ignored, and so the boss effectively has
zero armor as well. As before, if armor (from a spell, in this case) would reduce damage below
1, it becomes 1 instead - that is, the boss' attacks always deal at least 1 damage.
Since you're a wizard, you don't get to wear armor, and you can't attack
normally. However, since you do magic damage, your opponent's armor is
ignored, and so the boss effectively has zero armor as well. As before, if
armor (from a spell, in this case) would reduce damage below 1, it becomes 1
instead - that is, the boss' attacks always deal at least 1 damage.
On each of your turns, you must select one of your spells to cast. If you cannot afford to
cast any spell, you lose. Spells cost mana; you start with 500 mana, but have no maximum
limit. You must have enough mana to cast a spell, and its cost is immediately deducted when
you cast it. Your spells are Magic Missile, Drain, Shield, Poison, and Recharge.
On each of your turns, you must select one of your spells to cast. If you
cannot afford to cast any spell, you lose. Spells cost mana; you start with
500 mana, but have no maximum limit. You must have enough mana to cast a
spell, and its cost is immediately deducted when you cast it. Your spells
are Magic Missile, Drain, Shield, Poison, and Recharge.
 Magic Missile costs 53 mana. It instantly does 4 damage.
 Drain costs 73 mana. It instantly does 2 damage and heals you for 2 hit points.
 Shield costs 113 mana. It starts an effect that lasts for 6 turns. While it is active,
your armor is increased by 7.
 Poison costs 173 mana. It starts an effect that lasts for 6 turns. At the start of each
turn while it is active, it deals the boss 3 damage.
 Recharge costs 229 mana. It starts an effect that lasts for 5 turns. At the start of each
turn while it is active, it gives you 101 new mana.
Effects all work the same way. Effects apply at the start of both the player's turns and the
boss' turns. Effects are created with a timer (the number of turns they last); at the start of
each turn, after they apply any effect they have, their timer is decreased by one. If this
decreases the timer to zero, the effect ends. You cannot cast a spell that would start an
effect which is already active. However, effects can be started on the same turn they end.
 Drain costs 73 mana. It instantly does 2 damage and heals you for 2 hit
points.
For example, suppose the player has 10 hit points and 250 mana, and that the boss has 13 hit
points and 8 damage:
 Shield costs 113 mana. It starts an effect that lasts for 6 turns. While
it is active, your armor is increased by 7.
 Poison costs 173 mana. It starts an effect that lasts for 6 turns. At
the start of each turn while it is active, it deals the boss 3 damage.
 Recharge costs 229 mana. It starts an effect that lasts for 5 turns. At
the start of each turn while it is active, it gives you 101 new mana.
Effects all work the same way. Effects apply at the start of both the
player's turns and the boss' turns. Effects are created with a timer (the
number of turns they last); at the start of each turn, after they apply any
effect they have, their timer is decreased by one. If this decreases the
timer to zero, the effect ends. You cannot cast a spell that would start an
effect which is already active. However, effects can be started on the same
turn they end.
For example, suppose the player has 10 hit points and 250 mana, and that the
boss has 13 hit points and 8 damage:
-- Player turn --
- Player has 10 hit points, 0 armor, 250 mana
@@ -68,7 +70,8 @@
- Boss has 3 hit points
Poison deals 3 damage. This kills the boss, and the player wins.
Now, suppose the same initial conditions, except that the boss has 14 hit points instead:
Now, suppose the same initial conditions, except that the boss has 14 hit
points instead:
-- Player turn --
- Player has 10 hit points, 0 armor, 250 mana
@@ -135,27 +138,45 @@
- Boss has 2 hit points
Poison deals 3 damage. This kills the boss, and the player wins.
You start with 50 hit points and 500 mana points. The boss's actual stats are in your puzzle
input. What is the least amount of mana you can spend and still win the fight? (Do not include
mana recharge effects as "spending" negative mana.)
You start with 50 hit points and 500 mana points. The boss's actual stats
are in your puzzle input. What is the least amount of mana you can spend and
still win the fight? (Do not include mana recharge effects as "spending"
negative mana.)
To begin, get your puzzle input.
Your puzzle answer was 1824.
Answer: _____________________ [ [Submit] ]
--- Part Two ---
You can also [Shareon Twitter Google+ Reddit] this puzzle.
On the next run through the game, you increase the difficulty to hard.
At the start of each player turn (before any other effects apply), you lose
1 hit point. If this brings you to or below 0 hit points, you lose.
With the same starting stats for you and the boss, what is the least amount
of mana you can spend and still win the fight?
Your puzzle answer was 1937.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, all that is left is for you to admire your advent calendar.
If you still want to see it, you can get your puzzle input.
References
Visible links
. http://adventofcode.com/
. http://adventofcode.com/about
. http://adventofcode.com/stats
. http://adventofcode.com/leaderboard
. http://adventofcode.com/settings
. http://adventofcode.com/auth/logout
. http://adventofcode.com/day/21
. http://adventofcode.com/day/22/input
. https://twitter.com/intent/tweet?text=%22Wizard+Simulator+20XX%22+%2D+Day+22+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F22&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F22
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F22&title=%22Wizard+Simulator+20XX%22+%2D+Day+22+%2D+Advent+of+Code
. http://adventofcode.com/2015/about
. http://adventofcode.com/2015/support
. http://adventofcode.com/2015/events
. http://adventofcode.com/2015/settings
. http://adventofcode.com/2015/auth/logout
. http://adventofcode.com/2015
. http://adventofcode.com/2015
. http://adventofcode.com/2015/leaderboard
. http://adventofcode.com/2015/stats
. http://adventofcode.com/2015/sponsors
. http://adventofcode.com/2015/day/21
. http://adventofcode.com/2015
. http://adventofcode.com/2015/day/22/input