Add task
This commit is contained in:
parent
b01983bdba
commit
ba3ad0437a
@ -28,6 +28,7 @@ class multiplicationGame:
|
||||
def checkIfUserWantsNewQuestion(self):
|
||||
if not self.userWantsNewQuestion():
|
||||
exit(0)
|
||||
print()
|
||||
|
||||
def wrongAnswer(self):
|
||||
self.currentTries -= 1
|
22
Exercise 3/11 - Doble lokker/task11e.py
Normal file
22
Exercise 3/11 - Doble lokker/task11e.py
Normal 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()
|
||||
|
Loading…
Reference in New Issue
Block a user