diff --git a/Exercise 3/11 - Doble lokker/11d.py b/Exercise 3/11 - Doble lokker/task11d.py similarity index 99% rename from Exercise 3/11 - Doble lokker/11d.py rename to Exercise 3/11 - Doble lokker/task11d.py index 669d1f9..a163f8c 100644 --- a/Exercise 3/11 - Doble lokker/11d.py +++ b/Exercise 3/11 - Doble lokker/task11d.py @@ -28,6 +28,7 @@ class multiplicationGame: def checkIfUserWantsNewQuestion(self): if not self.userWantsNewQuestion(): exit(0) + print() def wrongAnswer(self): self.currentTries -= 1 diff --git a/Exercise 3/11 - Doble lokker/task11e.py b/Exercise 3/11 - Doble lokker/task11e.py new file mode 100644 index 0000000..4ca2627 --- /dev/null +++ b/Exercise 3/11 - Doble lokker/task11e.py @@ -0,0 +1,22 @@ +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() +