Skip to content

Commit d2cf779

Browse files
committed
Corrección Roadmap 39 + Nuevo ejercicio 40
1 parent 3908e2b commit d2cf779

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
|36|[EL SOMBRERO SELECCIONADOR](./Roadmap/36%20-%20EL%20SOMBRERO%20SELECCIONADOR/ejercicio.md)|[📝](./Roadmap/36%20-%20EL%20SOMBRERO%20SELECCIONADOR/python/mouredev.py)|[▶️](https://youtu.be/_UjOD587elY)|[👥](./Roadmap/36%20-%20EL%20SOMBRERO%20SELECCIONADOR/)
7474
|37|[OASIS VS LINKIN PARK](./Roadmap/37%20-%20OASIS%20VS%20LINKIN%20PARK/ejercicio.md)|[📝](./Roadmap/37%20-%20OASIS%20VS%20LINKIN%20PARK/python/mouredev.py)|[▶️](https://youtu.be/q-zBKriHupY)|[👥](./Roadmap/37%20-%20OASIS%20VS%20LINKIN%20PARK/)
7575
|38|[MOUREDEV PRO](./Roadmap/38%20-%20MOUREDEV%20PRO/ejercicio.md)|[📝](./Roadmap/38%20-%20MOUREDEV%20PRO/python/mouredev.py)|[▶️](https://youtu.be/AbGROLoAVLs)|[👥](./Roadmap/38%20-%20MOUREDEV%20PRO/)
76-
|39|[BATMAN DAY](./Roadmap/39%20-%20BATMAN%20DAY/ejercicio.md)|[🗓️ 30/09/24](https://discord.gg/Ak6SdZZ8?event=1285336208586833930)||[👥](./Roadmap/39%20-%20BATMAN%20DAY/)
76+
|39|[BATMAN DAY](./Roadmap/39%20-%20BATMAN%20DAY/ejercicio.md)|[📝](./Roadmap/39%20-%20BATMAN%20DAY/python/mouredev.py)||[👥](./Roadmap/39%20-%20BATMAN%20DAY/)
77+
|40|[FORTNITE RUBIUS CUP](./Roadmap/40%20-%20FORTNITE%20RUBIUS%20CUP/ejercicio.md)|[🗓️ 07/10/24](https://discord.gg/u3R4HUUE?event=1287881476460773456)||[👥](./Roadmap/40%20-%20FORTNITE%20RUBIUS%20CUP/)
7778

7879
## Cursos en YouTube
7980

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
from datetime import datetime, timedelta
2+
3+
# Reto 1
4+
5+
year_of_creation = 1939
6+
anniversary_year = year_of_creation + 85
7+
8+
batman_day_anniversary_dates = []
9+
10+
while anniversary_year <= year_of_creation + 100:
11+
12+
september = datetime(anniversary_year, 9, 1)
13+
14+
first_saturday = 5 - september.weekday() if september.weekday() <= 5 else 12 - \
15+
september.weekday()
16+
17+
third_saturday = september + timedelta(days=first_saturday + 14)
18+
19+
batman_day_anniversary_dates.append(
20+
(
21+
anniversary_year,
22+
anniversary_year - year_of_creation,
23+
third_saturday.strftime("%d-%m-%Y")
24+
)
25+
)
26+
27+
anniversary_year += 1
28+
29+
for year, anniversary, batman_day in batman_day_anniversary_dates:
30+
print(f"Batman day {year} ({anniversary} aniversario): {batman_day}")
31+
32+
# Reto 2
33+
34+
35+
def sum_subgrid_alerts(sensors, center_x, center_y) -> int:
36+
37+
total = 0
38+
39+
for x in range(center_x - 1, center_x + 2):
40+
for y in range(center_y - 1, center_y + 2):
41+
for sensor in sensors:
42+
if sensor[0] == x and sensor[1] == y:
43+
total += sensor[2]
44+
45+
return total
46+
47+
48+
def batcave_security_system(sensors):
49+
50+
max_alert_level = 0
51+
max_alert_coordinate = (0, 0)
52+
53+
for x in range(1, 19):
54+
for y in range(1, 19):
55+
alert_level = sum_subgrid_alerts(sensors, x, y)
56+
if alert_level > max_alert_level:
57+
max_alert_level = alert_level
58+
max_alert_coordinate = (x, y)
59+
60+
distance = abs(max_alert_coordinate[0]) + abs(max_alert_coordinate[1])
61+
activate_protocol = max_alert_level > 20
62+
63+
return max_alert_coordinate, max_alert_level, distance, activate_protocol
64+
65+
66+
sensors = [
67+
(2, 3, 7),
68+
(4, 3, 8),
69+
(2, 2, 7),
70+
(10, 12, 8),
71+
(11, 11, 8),
72+
(10, 11, 8),
73+
(15, 18, 4)
74+
]
75+
76+
result = batcave_security_system(sensors)
77+
print(f"Centro cuadrícula más amenazada: {result[0]}.")
78+
print(f"Máximo nivel de alerta: {result[1]}.")
79+
print(f"Distancia a la Batcueva: {result[2]}.")
80+
print(f"Activar protocolo de seguridad: {"Sí" if result[3] else "No"}.")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# #40 FORTNITE RUBIUS CUP
2+
> #### Dificultad: Media | Publicación: 30/09/24 | Corrección: 07/10/24
3+
4+
## Ejercicio
5+
6+
```
7+
/*
8+
* EJERCICIO:
9+
* ¡Rubius tiene su propia skin en Fortnite!
10+
* Y va a organizar una competición para celebrarlo.
11+
* Esta es la lista de participantes:
12+
* https://x.com/Rubiu5/status/1840161450154692876
13+
*
14+
* Desarrolla un programa que obtenga el número de seguidores en
15+
* Twitch de cada participante, la fecha de creación de la cuenta
16+
* y ordene los resultados en dos listados.
17+
* - Usa el API de Twitch: https://dev.twitch.tv/docs/api/reference
18+
* (NO subas las credenciales de autenticación)
19+
* - Crea un ranking por número de seguidores y por antigüedad.
20+
* - Si algún participante no tiene usuario en Twitch, debe reflejarlo.
21+
*/
22+
```
23+
#### Tienes toda la información extendida sobre el roadmap de retos de programación en **[retosdeprogramacion.com/roadmap](https://retosdeprogramacion.com/roadmap)**.
24+
25+
Sigue las **[instrucciones](../../README.md)**, consulta las correcciones y aporta la tuya propia utilizando el lenguaje de programación que quieras.
26+
27+
> Recuerda que cada semana se publica un nuevo ejercicio y se corrige el de la semana anterior en directo desde **[Twitch](https://twitch.tv/mouredev)**. Tienes el horario en la sección "eventos" del servidor de **[Discord](https://discord.gg/mouredev)**.

0 commit comments

Comments
 (0)