TDT4109/Exercise 3/11 - Doble lokker/task11e.py
2020-09-15 11:20:53 +02:00

23 lines
736 B
Python

from task11d import multiplicationGame
class newMultiplicationGame(multiplicationGame):
def __init__(self, roundsBetweenDifficultyUpdate, *args, **kwargs):
self.roundsBetweenDifficultyUpdate = roundsBetweenDifficultyUpdate
self.roundsPlayed = 0
return super().__init__(*args, **kwargs)
def updateDifficulty(self):
self.max = self.max + 5
print('Oppgavene har nå blitt litt vanskeligere.\n')
def updateProblem(self):
super().updateProblem()
self.roundsPlayed += 1
if self.roundsPlayed % self.roundsBetweenDifficultyUpdate == 0:
self.updateDifficulty()
if __name__ == "__main__":
game = newMultiplicationGame(roundsBetweenDifficultyUpdate=5, min=0, max=10, tries=3)
game.loop()