Exemple #1
0
 def test_hasLost_chanchesCounterIsSetToZero_shouldReturnTrue(self):
     player = Player()
     player.chancesLeft = 0
     self.assertTrue(player.hasLost())
Exemple #2
0
 def test_hasLost_chancesCounterIsSetToOne_shouldReturnFalse(self):
     player = Player()
     player.chancesLeft = 1
     self.assertFalse(player.hasLost())
Exemple #3
0
def isSentence(guess):
    return len(guess) > 1

if __name__ == '__main__':
    sentence = Sentence()
    coveredSentence = sentence.cover()
    player = Player()
    inputWarning = ""

    while True:
        system('cls')

        print(coveredSentence)
        print("Pozostało {} szans.".format(player.chancesLeft))

        if player.hasLost():
            print("Przegrana")
            system('pause')
            break
        elif coveredSentence.isGuessed():
            print("Wygrana")
            system('pause')
            break

        print(inputWarning)
        guess = player.makeGuess()
        inputWarning = ""

        if isLetter(guess):
            if guess not in player.rememberedLetters:
                if sentence.isLetterOccurrs(guess):