Skip to content

Commit

Permalink
Corrección Roadmap 41 + Nuevo ejercicio 42
Browse files Browse the repository at this point in the history
  • Loading branch information
mouredev committed Oct 14, 2024
1 parent 908df76 commit 0f38d13
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
## Corrección y próximo ejercicio

> #### Lunes 14 de octubre de 2024 a las 20:00 (hora España) desde **[Twitch](https://twitch.tv/mouredev)**
> #### Consulta el **[horario](https://discord.gg/juhmSSRF?event=1290376752622993469)** por país y crea un **[recordatorio](https://discord.gg/juhmSSRF?event=1290376752622993469)**
> #### Lunes 21 de octubre de 2024 a las 20:00 (hora España) desde **[Twitch](https://twitch.tv/mouredev)**
> #### Consulta el **[horario](https://discord.gg/K4SGshHf?event=1294092672793051177)** por país y crea un **[recordatorio](https://discord.gg/K4SGshHf?event=1294092672793051177)**
## Roadmap

Expand Down Expand Up @@ -75,7 +75,8 @@
|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/)
|39|[BATMAN DAY](./Roadmap/39%20-%20BATMAN%20DAY/ejercicio.md)|[📝](./Roadmap/39%20-%20BATMAN%20DAY/python/mouredev.py)|[▶️](https://youtu.be/Lmj5enZG5pg)|[👥](./Roadmap/39%20-%20BATMAN%20DAY/)
|40|[FORTNITE RUBIUS CUP](./Roadmap/40%20-%20FORTNITE%20RUBIUS%20CUP/ejercicio.md)|[📝](./Roadmap/40%20-%20FORTNITE%20RUBIUS%20CUP/python/mouredev.py)|[▶️](https://youtu.be/UlWtFvLLSXw)|[👥](./Roadmap/40%20-%20FORTNITE%20RUBIUS%20CUP/)
|41|[CAMISETA RAR](./Roadmap/41%20-%20CAMISETA%20RAR/ejercicio.md)|[🗓️ 14/10/24](https://discord.gg/juhmSSRF?event=1290376752622993469)||[👥](./Roadmap/41%20-%20CAMISETA%20RAR/)
|41|[CAMISETA RAR](./Roadmap/41%20-%20CAMISETA%20RAR/ejercicio.md)|[📝](./Roadmap/41%20-%20CAMISETA%20RAR/python/mouredev.py)||[👥](./Roadmap/41%20-%20CAMISETA%20RAR/)
|42|[TORNEO DRAGON BALL](./Roadmap/42%20-%20TORNEO%20DRAGON%20BALL/ejercicio.md)|[🗓️ 21/10/24](https://discord.gg/K4SGshHf?event=1294092672793051177)||[👥](./Roadmap/42%20-%20TORNEO%20DRAGON%20BALL/)

## Cursos en YouTube

Expand Down
51 changes: 51 additions & 0 deletions Roadmap/41 - CAMISETA RAR/python/mouredev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import zipfile
import os


def zip_file(path: str, file: str) -> str:

file_path = os.path.join(path, file)

if os.path.exists(file_path):

zip_file = f"{file}.zip"
zip_path = os.path.join(path, zip_file)

with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
zipf.write(file_path, file)
print(f"Archivo {file} comprimido como {zip_file}.")
return zip_file

else:
print(f"El archivo {file} no existe el directorio {path}.")

return None


def unzip_file(path: str, file: str):

file_path = os.path.join(path, file)

if os.path.exists(file_path):

zip_path = os.path.join(path, file)

with zipfile.ZipFile(zip_path) as zipf:
zipf.extractall(path)
print(f"Archivo {file} descomprimido en {path}.")

else:
print(f"El archivo {file} no existe el directorio {path}.")


path = os.path.dirname(os.path.abspath(__file__)) # Directorio actual
file = "nombre_de_mi_archivo"

zip = zip_file(path, file)

if zip != None:

# Borro el fichero original antes de descomprimir el zip
os.remove(os.path.join(path, file))

unzip_file(path, zip)
47 changes: 47 additions & 0 deletions Roadmap/42 - TORNEO DRAGON BALL/ejercicio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# #42 TORNEO DRAGON BALL
> #### Dificultad: Difícil | Publicación: 14/10/24 | Corrección: 21/10/24
## Ejercicio

```
/*
* EJERCICIO:
* ¡El último videojuego de Dragon Ball ya está aquí!
* Se llama Dragon Ball: Sparking! ZERO.
*
* Simula un Torneo de Artes Marciales, al más puro estilo
* de la saga, donde participarán diferentes luchadores, y el
* sistema decidirá quién es el ganador.
*
* Luchadores:
* - Nombre.
* - Tres atributos: velocidad, ataque y defensa
* (con valores entre 0 a 100 que tú decidirás).
* - Comienza cada batalla con 100 de salud.
* Batalla:
* - En cada batalla se enfrentan 2 luchadores.
* - El luchador con más velocidad comienza atacando.
* - El daño se calcula restando el daño de ataque del
* atacante menos la defensa del oponente.
* - El oponente siempre tiene un 20% de posibilidad de
* esquivar el ataque.
* - Si la defensa es mayor que el ataque, recibe un 10%
* del daño de ataque.
* - Después de cada turno y ataque, el oponente pierde salud.
* - La batalla finaliza cuando un luchador pierde toda su salud.
* Torneo:
* - Un torneo sólo es válido con un número de luchadores
* potencia de 2.
* - El torneo debe crear parejas al azar en cada ronda.
* - Los luchadores se enfrentan en rondas eliminatorias.
* - El ganador avanza a la siguiente ronda hasta que sólo
* quede uno.
* - Debes mostrar por consola todo lo que sucede en el torneo,
* así como el ganador.
*/
```
#### Tienes toda la información extendida sobre el roadmap de retos de programación en **[retosdeprogramacion.com/roadmap](https://retosdeprogramacion.com/roadmap)**.

Sigue las **[instrucciones](../../README.md)**, consulta las correcciones y aporta la tuya propia utilizando el lenguaje de programación que quieras.

> 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 comments on commit 0f38d13

Please sign in to comment.