Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions src/kata1/rps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,42 @@
#'Ganaste!'
#'Perdiste!'
def quienGana(player, ai):
return ""
player = player.lower()
ai = ai.lower()

if ai == "piedra" and player == "papel":
return "Ganaste!"
elif ai == "piedra" and player == "piedra":
return "Empate!"
elif ai == "piedra" and player == "tijeras":
return "Perdiste!"
elif ai == "papel" and player == "papel":
return "Empate!"
elif ai == "papel" and player == "piedra":
return "Perdiste!"
elif ai == "papel" and player == "tijeras":
return "Ganaste!"
elif ai == "tijeras" and player == "papel":
return "Perdiste!"
elif ai == "tijeras" and player == "piedra":
return "Ganaste!"
elif ai == "tijeras" and player == "tijeras":
return "Empate!"


# Entry Point
def Game():
#
#

print("Estás jugando a piedra, papel o tijeras.")
player = input("Por favor, introduce cual de los 3 movimientos quieres hacer: ")


suerte = randint(0,2)
ai = options[suerte]

#
#

winner = quienGana(player, ai)

print(winner)

print(winner)
14 changes: 7 additions & 7 deletions src/kata2/rpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import string

def RandomPasswordGenerator(passLen=10):
#
#

#
#

return ""
caracteres = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"]
for i in range(passLen):
if i == 0:
contra = random.choice(caracteres)
else:
contra = contra + random.choice(caracteres)
return contragit
30 changes: 23 additions & 7 deletions src/kata3/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@
# Definimos algunas funciones para los comandos. Estos generalmente toman los dos argumentos update y context
def start(update, context):
"""Envia un mensaje cuando se emita el comando /start."""
return ""
mensaje = "Hola, Geeks"
update.message.reply_text(mensaje)
return mensaje

def help(update, context):
"""Envia un mensaje cuando se emita el comando /help."""
return ""
mensaje = "Ayudame!"
update.message.reply_text(mensaje)
return mensaje

def mayus(update, context):
#
return ""
#context.args[1]
mensaje = context.args[0]
mensaje = mensaje.upper()
update.message.reply_text(mensaje)
return mensaje

def alreves(update, context):
"""Repite el mensaje del usuario."""
#
return ""
mensaje = context.args[0]
txt = mensaje[::-1]
update.message.reply_text(txt)
print(txt)
return "txt"

def error(update, context):
"""Envia los errores por consola"""
Expand All @@ -34,16 +45,21 @@ def error(update, context):
def main():
"""Inicio del Bot"""
#Colocamos el Token creado por FatherBot
updater = Updater("", use_context=True)
updater = Updater("871576518:AAEL_8TH16g29zCn4kYheuQC3p089PwYobw", use_context=True)

# Es el Registro de Comandos a través del dispartcher
dp = #
dp = updater.dispatcher

# Añadimos a la lista de Registro todos los comandos con su función [start - help - mayus]
#
#
#

updater.dispatcher.add_handler(CommandHandler("start", start))
updater.dispatcher.add_handler(CommandHandler("mayus", mayus))
updater.dispatcher.add_handler(CommandHandler("help", help))
updater.dispatcher.add_handler(CommandHandler(alreves))

# Este comando es un Trigger que se lanza cuando no hay comandos [alreves]
#

Expand Down
3 changes: 1 addition & 2 deletions tests/test_kata1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ def test_papel_vs_piedra():
assert(quienGana('Papel', 'Piedra') == 'Ganaste!')

def test_tijeras_vs_papel():
assert(quienGana('Tijeras', 'Papel') == 'Ganaste!')

assert(quienGana('Tijeras', 'Papel') == 'Ganaste!')