forked from github/codespaces-blank
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#1 from rcruz63/feature/dia1
New: dia 1 completed
- Loading branch information
Showing
11 changed files
with
2,258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Day 1: Trebuchet?! | ||
Something is wrong with global snow production, and you've been selected to take a look. The Elves have even given you a map; on it, they've used stars to mark the top fifty locations that are likely to be having problems. | ||
|
||
You've been doing this long enough to know that to restore snow operations, you need to check all fifty stars by December 25th. | ||
|
||
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck! | ||
|
||
You try to ask why they can't just use a weather machine ("not powerful enough") and where they're even sending you ("the sky") and why your map looks mostly blank ("you sure ask a lot of questions") and hang on did you just say the sky ("of course, where do you think snow comes from") when you realize that the Elves are already loading you into a trebuchet ("please hold still, we need to strap you in"). | ||
|
||
As they're making the final adjustments, they discover that their calibration document (your puzzle input) has been amended by a very young Elf who was apparently just excited to show off her art skills. Consequently, the Elves are having trouble reading the values on the document. | ||
|
||
The newly-improved calibration document consists of lines of text; each line originally contained a specific calibration value that the Elves now need to recover. On each line, the calibration value can be found by combining the first digit and the last digit (in that order) to form a single two-digit number. | ||
|
||
For example: | ||
|
||
``` | ||
1abc2 | ||
pqr3stu8vwx | ||
a1b2c3d4e5f | ||
treb7uchet | ||
``` | ||
|
||
In this example, the calibration values of these four lines are 12, 38, 15, and 77. Adding these together produces 142. | ||
|
||
Consider your entire calibration document. What is the sum of all of the calibration values? | ||
|
||
## Part Two | ||
Your calculation isn't quite right. It looks like some of the digits are actually spelled out with letters: one, two, three, four, five, six, seven, eight, and nine also count as valid "digits". | ||
|
||
Equipped with this new information, you now need to find the real first and last digit on each line. For example: | ||
|
||
two1nine | ||
eightwothree | ||
abcone2threexyz | ||
xtwone3four | ||
4nineeightseven2 | ||
zoneight234 | ||
7pqrstsixteen | ||
In this example, the calibration values are 29, 83, 13, 24, 42, 14, and 76. Adding these together produces 281. | ||
|
||
What is the sum of all of the calibration values? | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Día 1: ¿Un trebuchet?! | ||
|
||
Algo está mal con la producción global de nieve, y te han seleccionado para echar un vistazo. Los Elfos incluso te han dado un mapa; en él, han utilizado estrellas para marcar las cincuenta ubicaciones principales que probablemente estén teniendo problemas. | ||
|
||
Llevas suficiente tiempo haciendo esto como para saber que para restaurar las operaciones de nieve, necesitas revisar todas las cincuenta estrellas antes del 25 de diciembre. | ||
|
||
Recolecta estrellas resolviendo acertijos. Dos acertijos estarán disponibles cada día en el calendario de Adviento; el segundo acertijo se desbloquea cuando completes el primero. Cada acertijo otorga una estrella. ¡Buena suerte! | ||
|
||
Intentas preguntar por qué no pueden simplemente usar una máquina del tiempo ("no lo suficientemente potente") y dónde te están enviando incluso ("al cielo") y por qué tu mapa parece mayormente en blanco ("haces muchas preguntas") y espera, ¿acabas de decir el cielo? ("por supuesto, ¿de dónde crees que viene la nieve?") cuando te das cuenta de que los Elfos ya te están cargando en un trebuchet ("por favor, quédate quieto, necesitamos atarte"). | ||
|
||
Mientras están haciendo los ajustes finales, descubren que su documento de calibración (tu entrada para el acertijo) ha sido modificado por un Elf muy joven que aparentemente estaba emocionado por mostrar sus habilidades artísticas. En consecuencia, los Elfos tienen problemas para leer los valores en el documento. | ||
|
||
El documento de calibración recientemente mejorado consiste en líneas de texto; cada línea originalmente contenía un valor de calibración específico que los Elfos ahora necesitan recuperar. En cada línea, el valor de calibración se puede encontrar combinando el primer dígito y el último dígito (en ese orden) para formar un número de dos dígitos. | ||
|
||
Por ejemplo: | ||
|
||
``` | ||
1abc2 | ||
pqr3stu8vwx | ||
a1b2c3d4e5f | ||
treb7uchet | ||
``` | ||
|
||
En este ejemplo, los valores de calibración de estas cuatro líneas son 12, 38, 15 y 77. Sumar estos valores produce 142. | ||
|
||
Considera todo tu documento de calibración. ¿Cuál es la suma de todos los valores de calibración? | ||
|
||
# Parte Dos --- | ||
Tu cálculo no está del todo correcto. Parece que algunos de los dígitos están escritos con letras: uno, dos, tres, cuatro, cinco, seis, siete, ocho y nueve también cuentan como "dígitos" válidos. | ||
|
||
Equipado con esta nueva información, ahora necesitas encontrar el primer y último dígito reales en cada línea. Por ejemplo: | ||
|
||
dos1nueve | ||
ocho dos tres | ||
abcuno2tresxyz | ||
xtwouno3cuatro | ||
4nueveocho siete2 | ||
zonoocho234 | ||
7pqrstdieciséis | ||
En este ejemplo, los valores de calibración son 29, 83, 13, 24, 42, 14 y 76. Sumándolos se obtiene 281. | ||
|
||
¿Cuál es la suma de todos los valores de calibración? |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from adv2023.app import run | ||
# Si nombre == "main" ejecuto app.run() | ||
|
||
if __name__ == "__main__": | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""This is the main application file for the adv2023 package. """ | ||
from adv2023.dia1.dia1 import dia1_1, dia1_2 | ||
|
||
|
||
def run(): | ||
"""This is the main function for the adv2023 package. """ | ||
# Use a loop to keep representing a menu until the user chooses to exit | ||
while True: | ||
# Print the menu | ||
print("Welcome to the menu") | ||
print("1. Dia 1") | ||
print("Q. Exit") | ||
|
||
# Ask the user for a choice | ||
choice = input("What would you like to do? ") | ||
# If the user chooses option 1, call option1() | ||
if choice == "1": | ||
dia1_1("data1_1.txt") | ||
dia1_2("data1_2.txt") | ||
# If the user chooses Q, exit the loop | ||
elif choice.upper() == "Q": | ||
break | ||
else: | ||
print("That is not a valid option") |
Empty file.
Oops, something went wrong.