Created
November 28, 2022 16:18
-
-
Save airvzxf/14ec3c662f73e663b1f2f658c858ad71 to your computer and use it in GitHub Desktop.
Tutorial de hackeo de videojuegos en Linux. Ejemplo de una supuesta funcionalidad de una función que decrece el dinero.
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
""" | |
Esta funcion simula el juego al perder dinero pero esta programada con funciones | |
""" | |
def decrease_money(money: int, amount: int): | |
""" | |
Decrease player money given an amount. | |
:type money: int | |
:param money: Total of money | |
:type amount: int | |
:param amount: Amount of money which will be reduced | |
""" | |
print(f"Money: ${money} - ${amount} = ${money - amount}") | |
print("PENDIENTE: modificar esta linea para demostrar que afecte todo") | |
return money - amount | |
if __name__ == "__main__": | |
print("=== Creating player ===") | |
israel = { | |
"name": "Israel", | |
"money": 100, | |
} | |
print("\n=== Creating enemy ===") | |
roldan = { | |
"name": "Roldan", | |
"money": 50, | |
} | |
print("\n=== Buying enemy recruits ===") | |
roldan["money"] = decrease_money(roldan.get("money"), 8) | |
roldan["money"] = decrease_money(roldan.get("money"), 8) | |
print("=== Enemy money ===") | |
print(f"Money: ${roldan.get('money')}") | |
print("\n=== Buying player recruits ===") | |
israel["money"] = decrease_money(israel.get("money"), 14) | |
israel["money"] = decrease_money(israel.get("money"), 14) | |
print("=== Player money ===") | |
print(f"Money: ${israel.get('money')}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment