This commit is contained in:
Oystein Kristoffer Tveit 2020-09-15 11:20:53 +02:00
parent b01983bdba
commit ba3ad0437a
2 changed files with 23 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class multiplicationGame:
def checkIfUserWantsNewQuestion(self): def checkIfUserWantsNewQuestion(self):
if not self.userWantsNewQuestion(): if not self.userWantsNewQuestion():
exit(0) exit(0)
print()
def wrongAnswer(self): def wrongAnswer(self):
self.currentTries -= 1 self.currentTries -= 1

View File

@ -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()