-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 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
41 changes: 41 additions & 0 deletions
41
Retos/Reto #25 - EL CÓDIGO KONAMI [Media]/python/mouredev.py
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,41 @@ | ||
from pynput.keyboard import Key, KeyCode, Listener | ||
|
||
KONAMI_CODE = [ | ||
Key.up, Key.up, Key.down, Key.down, | ||
Key.left, Key.right, Key.left, Key.right, | ||
KeyCode.from_char("b"), KeyCode.from_char("a") | ||
] | ||
|
||
key_position = 0 | ||
last_key = Key.esc | ||
|
||
def on_press(key): | ||
|
||
global key_position, last_key | ||
|
||
if key == Key.esc: | ||
print("Exit") | ||
return False | ||
|
||
if key == KONAMI_CODE[key_position]: | ||
key_position += 1 | ||
elif key == KONAMI_CODE[1] and last_key == KONAMI_CODE[0]: | ||
# Se controla que se escriba varias veces la primera tecla válida | ||
key_position = 2 | ||
else: | ||
key_position = 0 | ||
|
||
if key_position == len(KONAMI_CODE): | ||
print(""" | ||
\n | ||
╦╔═╔═╗╔╗╔╔═╗╔╦╗╦ ╔═╗╔═╗╔╦╗╔═╗ | ||
╠╩╗║ ║║║║╠═╣║║║║ ║ ║ ║ ║║║╣ | ||
╩ ╩╚═╝╝╚╝╩ ╩╩ ╩╩ ╚═╝╚═╝═╩╝╚═╝ | ||
\n | ||
""") | ||
return False | ||
|
||
last_key = key | ||
|
||
with Listener(on_press=on_press) as listener: | ||
listener.join() |
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,21 @@ | ||
# Reto #26: Testing | ||
#### Dificultad: Media | Publicación: 26/06/23 | Corrección: 03/07/23 | ||
|
||
## Enunciado | ||
|
||
``` | ||
/* | ||
* Crea tres test sobre el reto 12: "Viernes 13". | ||
* - Puedes copiar una solución ya creada por otro usuario en | ||
* el lenguaje que estés utilizando. | ||
* - Debes emplear un mecanismo de ejecución de test que posea | ||
* el lenguaje de programación que hayas seleccionado. | ||
* - Los tres test deben de funcionar y comprobar | ||
* diferentes situaciones (a tu elección). | ||
*/ | ||
``` | ||
#### Tienes toda la información extendida sobre los retos de programación semanales en **[retosdeprogramacion.com/semanales2023](https://retosdeprogramacion.com/semanales2023)**. | ||
|
||
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)**. |