Exemplo n.º 1
0
class hangmanDisplay:
    """ Display Hangman pictures and hidden word """
    
    def __init__(self, HANGMANPICS):
        """ Initialize the object
        
        >>> first = hangmanDisplay(HANGMANPICS)

        """
        self.HANGMANPICS = HANGMANPICS
        
    def game(self, word, hidden, wrongGuess=[], rightGuess=[]): 
        """
        >>> first.game("parrot", "pa--ot","wdf")
        """
        
        self.word = Word()
        self.hidden = Word()
        self. wrongGuess = wrongGuess
        self.rightGuess = rightGuess
        
    def Display_game(self):
        """
        >>> first.Display_game()
        >>> +---+   
            |   |   
            0   |   
           /|   |   
                |   
                |   
          ========= 
        """
        
        print self.HANGMANPICS[len(self.wrongGuess)]
        
    def Display_hidden(self):
        """
        >>> first.Display_hidden()
        >>> pa--ot
        """
        self.hidden = "-"*len(self.word.currentWord())
        for i in range(len(self.word.currentWord())):
            if self.word.currentWord()[i] in self.rightGuess:
                self.hidden = self.hidden[:i] + self.word.currentWord()[i] +self.hidden[i+1:]
        print self.hidden 
        
        
Exemplo n.º 2
0
 def game(self, word, hidden, wrongGuess=[], rightGuess=[]): 
     """
     >>> first.game("parrot", "pa--ot","wdf")
     """
     
     self.word = Word()
     self.hidden = Word()
     self. wrongGuess = wrongGuess
     self.rightGuess = rightGuess
Exemplo n.º 3
0
 def __init__(self):
     self.S = Server()
     self.listaWords = []
     self.listaWords.append(Word(['g', 'i', 'r', 'a', 'f', 'a'], "Animal"))
     self.listaWords.append(Word(['b', 'a', 'l', 'e', 'i', 'a'], "Animal"))
     self.listaWords.append(Word(['g', 'a', 't', 'o'], "Animal"))
     self.listaWords.append(Word(['c', 'o', 'p', 'o'], "Objeto"))
     self.listaWords.append(Word(['p', 'o', 'r', 't', 'a'], "Objeto"))
     self.listaWords.append(Word(['p', 'e', 'n', 't', 'e'], "Objeto"))
     self.listaWords.append(
         Word(['i', 'n', 'g', 'l', 'a', 't', 'e', 'r', 'r', 'a'], "Lugar"))
     self.listaWords.append(Word(['b', 'r', 'a', 's', 'i', 'l'], "Lugar"))
     self.listaWords.append(
         Word(['k', 'u', 'r', 'o', 's', 'h', 'i', 't', 's', 'u', 'j', 'i'],
              "Anime"))