Generation

generate functionThu, 19 Jan 2023

Create a game where you arrive at your destination in exactly 100 steps. The player has 125 stamina and consumes 1 stamina for each step taken. Running consumes 110% of his/her strength. When the number of steps taken at a time is 10 or more, the player's stamina is increased by 5% for each step taken. 20 steps are required to solve a problem. If you answer a question correctly, your strength is reset to 125. If you answer incorrectly, your strength cannot be reset. First, the player enters 'run' or 'walk'. Next, the player enters the number of steps.

def game(move, steps): if move == 'walk': if steps < 10: return 100 - steps, 125 - steps else: return 100 - steps, 125 - steps + 5 * steps else: if steps < 10: return 100 - steps, 125 - steps * 1.1 else: return 100 - steps, 125 - steps * 1.1 + 5 * steps

Questions about programming?Chat with your personal AI assistant