23 lines
736 B
Python
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()
|
|
|