def playVerb(self, name): while 1: GF.jumpLines(30) print(txt.WKVerben + txt.chosemode) mode = Sp.choseTitle(txt.VerbMode) if mode == "quit": print("Ende des Verbentraining.") sleep(2) break else: verbList = Verb.__callVerbList(self, mode) tenseList = Verb.__choseTense(self) Verb.__verbTraining(self, name, verbList, tenseList)
def __training(self, name, List): for elem in List: Input = input("Weiter? ") GF.jumpLines(30) if Input == "quit": break if elem[2] == 'Verb': print(elem[2], ': ', elem[0], "- Perfekt:", elem[1], '\nÜbersetzung:', elem[3], "\n\n") if elem[2] == 'Substantiv': print(elem[2] + ':', elem[0], "- Plural:", elem[1], '\nÜbersetzung:', elem[3], "\n\n") if elem[2] == 'Adjektiv': print(elem[2], ': ', elem[0], '\nÜbersetzung:', elem[3], "\n\n")
def playWS(self, name): while 1: GF.jumpLines(30) print(txt.WKWS + txt.chosemode) mode = Sp.choseTitle(txt.WSMode) if mode == "quit": print("Ende des Wortschatztraining.") sleep(2) break print(txt.choseWS) List = WortSchatz.__CrtSingList(self) if mode == "Training": WortSchatz.__training(self, name, List) elif mode == "Übung": WortSchatz.__practice(self, name, List)
def __playGameGeneral(self, name, substList, Input): Score = 0 if Input == 3: PN = Nomen.__listSTPrenouns(self) else: PN1 = "Definite" while 1: GF.jumpLines(30) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) turn = Sp.randList(substList) substTurn = substList[turn] transl = substTurn[3] if Input == 1: case = "Nominativ" else: case = txt.listCases[Sp.randList(txt.listCases)] if Input == 3: i = Sp.randList(PN) PreN = PN[i] else: refPN = Sp.refTitle(prenoun, PN1) PreN = [PN1, refPN[0]] pChance = randint(0, 3) if pChance == 0: nomen = substTurn[2] gender = "p" lastLetter = nomen[len(nomen) - 1] print("Nomen:", nomen, "(P) - Ubersetzung:", transl) if case == "Dativ": if lastLetter != 'n' and lastLetter != 's': nomen += 'n' else: nomen = substTurn[1] gender = substTurn[0] print("Nomen:", nomen, " - Ubersetzung:", transl) print("Case:", case, "- Artikel:", PreN) playerAnswer = input("answer: ") if playerAnswer == "quit": break print("PreN", PreN) realAnswer = (Nomen.__findAnswer(self, gender, PreN, case) + ' ' + nomen) if playerAnswer.lower() == realAnswer.lower(): Score += 1 # Sobe pontuação else: print("Falsch,", realAnswer), sleep(3)
def __playGameWithAdj(self, name, List): Score = 0 substList = List[0] adjList = List[1] PN = Nomen.__listSTPrenouns(self) while 1: GF.jumpLines(30) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) sub = Sp.randList(substList) adj = Sp.randList(adjList) pn = Sp.randList(PN) case = txt.listCases[Sp.randList(txt.listCases)] substTurn = substList[sub] adjTurn = adjList[adj] adjekt = adjTurn[0] PreN = PN[pn] transl = substTurn[3] pChance = randint(0, 3) if pChance == 0: nomen = substTurn[2] gender = "p" lastLetter = nomen[len(nomen) - 1] print("Nomen:", nomen, "(P) - Ubersetzung:", transl) if case == "Dativ": if lastLetter != 's' and lastLetter != 'n': nomen += 'n' else: nomen = substTurn[1] gender = substTurn[0] print("Nomen:", nomen, " - Ubersetzung:", transl) print("Adjektiv:", adjekt, "\nCase:", case, "- Artikel:", PreN[0]) playerAnswer = input("answer: ") if playerAnswer == "quit": break realAnswer = ( Nomen.__findAnswer2(self, gender, PreN, case, adjekt) + ' ' + nomen) if playerAnswer.lower() == realAnswer.lower(): Score += 1 else: print("Falsch,", realAnswer), sleep(3) return Score
def DeutschSpiel(): GF.jumpLines(30) print(txt.introdMsg) name = input("Spielername: ") while 1: GF.jumpLines(20) print("Herr", name,"\n", txt.chooseMode) mode = Sp.choseTitle(txt.modes) if mode == "Verben": player1 = Verb(name) player1.playVerb(player1.nameOfPlayer) if mode == "Nomen": player1 = Nomen(name) player1.playNomen(player1.nameOfPlayer) if mode == "Wortschatz": wort = WortSchatz(name) wort.playWS(wort.nameOfPlayer) elif mode == "quit": print("Ende des Deutschspiels"); break
def __verbTraining(self, name, verbList, tenseList): Score = 0 while 1: GF.jumpLines(30) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) verb = verbList[Sp.randList(verbList)] person = txt.NomPerson[Sp.randList(txt.NomPerson)] tense = tenseList[Sp.randList(tenseList)] print("Verb:", verb[0], "- Ubersetzung:", verb[1]) print("Zeit:", tense, "- Person:", person) playerAnswer = input("Antwort: ") if playerAnswer == "quit": break realAnswerList = Verb.__findAnswer(self, tense, person, verb[0]) realAnswer = GF.simpleAnswer(realAnswerList) if playerAnswer == realAnswer: Score += 1 else: print("Falsch, ", realAnswer) sleep(3)
def playNomen(self, name): while 1: GF.jumpLines(20) print(txt.WKNomen) GF.jumpLines(5) print(txt.chosemode) mode = Sp.choseTitle(txt.NomenMode) if mode == "quit": print("Ende des Nomentraining.") sleep(2) break else: GF.jumpLines(30) print(txt.WKNomen + txt.choseNomenList) List = Nomen.__substList(self) Input = 1 Input = txt.NomenMode.index(mode) + 1 if Input == 4: Nomen.__playGameWithAdj(self, name, List) else: substList = List[0] Nomen.__playGameGeneral(self, name, substList, Input)
def __practice(self, name, List): Score = 0 print(txt.choseWS) Answers = ['', ''] while 1: GF.jumpLines(30) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) rand = random.randint(0, len(List) - 1) elem = List[rand] if elem[2] == "Substantiv": Answers = WortSchatz.__subTraining(self, elem) if Answers[0] == Answers[1]: Score += 1 if Answers[0] == "quit": break if Answers[0] != Answers[1]: GF.jumpLines(20) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) print("\nFalsch,", elem[0]) a = input("Weiter? ") if elem[2] == "Verb": Answers = WortSchatz.__verbTraining(self, elem) if Answers[0] == Answers[1]: Score += 1 if Answers[0] == "quit": break if Answers[0] != Answers[1]: GF.jumpLines(20) print("Player: " + name + "\nScore: ", Score) GF.jumpLines(3) print("\nFalsch,", Answers[1]) a = input("Weiter? ") if elem[2] == "Adjektiv" or elem[2] == "Adverb": answer = WortSchatz.__Synonym(self, elem) if answer == True: Score += 1 a = input("Weiter? ") if a == "quit": break