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

@@ -10,22 +10,25 @@
--- Day 21: RPG Simulator 20XX ---
Little Henry Case got a new video game for Christmas. It's an RPG, and he's stuck on a boss.
He needs to know what equipment to buy at the shop. He hands you the controller.
Little Henry Case got a new video game for Christmas. It's an RPG, and he's
stuck on a boss. He needs to know what equipment to buy at the shop. He
hands you the controller.
In this game, the player (you) and the enemy (the boss) take turns attacking. The player
always goes first. Each attack reduces the opponent's hit points by at least 1. The first
character at or below 0 hit points loses.
In this game, the player (you) and the enemy (the boss) take turns
attacking. The player always goes first. Each attack reduces the opponent's
hit points by at least 1. The first character at or below 0 hit points
loses.
Damage dealt by an attacker each turn is equal to the attacker's damage score minus the
defender's armor score. An attacker always does at least 1 damage. So, if the attacker has a
damage score of 8, and the defender has an armor score of 3, the defender loses 5 hit points.
If the defender had an armor score of 300, the defender would still lose 1 hit point.
Damage dealt by an attacker each turn is equal to the attacker's damage
score minus the defender's armor score. An attacker always does at least 1
damage. So, if the attacker has a damage score of 8, and the defender has an
armor score of 3, the defender loses 5 hit points. If the defender had an
armor score of 300, the defender would still lose 1 hit point.
Your damage score and armor score both start at zero. They can be increased by buying items in
exchange for gold. You start with no items and have as much gold as you need. Your total
damage or armor is equal to the sum of those stats from all of your items. You have 100 hit
points.
Your damage score and armor score both start at zero. They can be increased
by buying items in exchange for gold. You start with no items and have as
much gold as you need. Your total damage or armor is equal to the sum of
those stats from all of your items. You have 100 hit points.
Here is what the item shop is selling:
@@ -51,12 +54,13 @@
Defense +2 40 0 2
Defense +3 80 0 3
You must buy exactly one weapon; no dual-wielding. Armor is optional, but you can't use more
than one. You can buy 0-2 rings (at most one for each hand). You must use any items you buy.
The shop only has one of each item, so you can't buy, for example, two rings of Damage +3.
You must buy exactly one weapon; no dual-wielding. Armor is optional, but
you can't use more than one. You can buy 0-2 rings (at most one for each
hand). You must use any items you buy. The shop only has one of each item,
so you can't buy, for example, two rings of Damage +3.
For example, suppose you have 8 hit points, 5 damage, and 5 armor, and that the boss has 12
hit points, 7 damage, and 2 armor:
For example, suppose you have 8 hit points, 5 damage, and 5 armor, and that
the boss has 12 hit points, 7 damage, and 2 armor:
 The player deals 5-2 = 3 damage; the boss goes down to 9 hit points.
 The boss deals 7-5 = 2 damage; the player goes down to 6 hit points.
@@ -68,15 +72,16 @@
In this scenario, the player wins! (Barely.)
You have 100 hit points. The boss's actual stats are in your puzzle input. What is the least
amount of gold you can spend and still win the fight?
You have 100 hit points. The boss's actual stats are in your puzzle input.
What is the least amount of gold you can spend and still win the fight?
Your puzzle answer was 91.
--- Part Two ---
Turns out the shopkeeper is working with the boss, and can persuade you to buy whatever items
he wants. The other rules still apply, and he still only has one of each item.
Turns out the shopkeeper is working with the boss, and can persuade you to
buy whatever items he wants. The other rules still apply, and he still only
has one of each item.
What is the most amount of gold you can spend and still lose the fight?
@@ -84,12 +89,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@@ -103,6 +107,3 @@ References
. https://en.wikipedia.org/wiki/Game_controller
. http://adventofcode.com/
. http://adventofcode.com/day/21/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22RPG+Simulator+20XX%22+%2D+Day+21+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F21&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F21
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F21&title=I%27ve+completed+%22RPG+Simulator+20XX%22+%2D+Day+21+%2D+Advent+of+Code