コード例 #1
0
 def printHeader(self):
     splashMessage('Players')
コード例 #2
0
 def playRound(self, roundNum):
     
     # at the beginning of each round, select a puzzle and instantiate the big board
     self.curPuzzle = self.puzzles.newPuzzle()
     self.board = bigBoard.theBigBoard(self.curPuzzle)
     self.players.newRound()
     self.player = self.players.getFirstPlayer()
     
     while True:
         
         self.printHeader(roundNum)
         self.board.printPuzzle()
         self.players.printPlayers()
         self.printRoundMenu()
         ch = getAkey().upper()
         if ch == " ":
             newTile = self.wheel.spin()
             if newTile.tileTypeOf == wheel.tileType_money:
                 print "You spin the wheel and get...\n "
                 splashMessage('$ %i' % newTile.value, True)
                 thisLetter = self.getAconsonant()
                 if thisLetter == None:
                     self.players.getNextPlayer()
                     getKeyOrExit()
                     continue
                 count = self.board.guessALetter(thisLetter)
                 if count:
                     print "Great! Number of %s's found: %i" % (thisLetter , count)
                     self.player.gotConsonant(newTile.value*count)
                 else:
                     print "No %s's found...next player" % (thisLetter)
                     self.player = self.players.getNextPlayer()
             else:
                 splashMessage(newTile.nameFromInt(newTile.tileTypeOf))
                 if newTile.tileTypeOf == wheel.tileType_bankrupt:
                     self.player.wentBankrupt()
                 self.player = self.players.getNextPlayer()
             getKeyOrExit()
         elif ch == "S":
             guess = getAline("You'd like to try to solve...type the answer...")
             success = self.board.guessThePuzzle(guess)
             if success:
                 splashMessage('Great Job!')
                 self.player.winner(self.houseMinimum)
                 getKeyOrExit()
                 return True
             else:
                 print "Not quite, next player...press any key"
                 self.players.getNextPlayer()
                 getKeyOrExit()
         elif ch == "V":
             if self.player.moneyThisRound < self.vowelCost:
                 print "Don't have enough money to buy a vowel!"
                 self.players.getNextPlayer()
             else:
                 thisLetter = self.getAvowel()
                 if thisLetter == None:
                     self.players.getNextPlayer()
                     getKeyOrExit()
                     continue
                 count = self.board.guessALetter(thisLetter)
                 self.player.boughtVowel(self.vowelCost)
                 if count:
                     print "Great! Number of %s's found: %i" % (thisLetter , count)
                 else:
                     print "No %s's found...next player" % (thisLetter)
                     self.player = self.players.getNextPlayer()
             getKeyOrExit()
         elif ch == "N":
             print "Are you sure to want to skip this round? (y/n)"
             if getAkey() in ["y", "Y"]:
                 return True
         elif ch == '\033':
             sys.exit(0)
         else:
             pass 
コード例 #3
0
 def endOfGameSummary(self):
     splashMessage("Results!")
     print ""
     for player in self.players:
         player.printPlayerTotal()
     getKeyOrExit()
コード例 #4
0
 def printWelcome(self):
     splashMessage(self.gameName)
     print "Welcome, press any key to start, but press ESCAPE to quit!"
     getKeyOrExit(True)
コード例 #5
0
 def printHeader(self, roundNum):
     splashMessage("ROUND " + str(roundNum))
コード例 #6
0
 def playBonusRound(self):
     splashMessage("BONUS ROUND!")
     
     # select winner
     self.player = self.players.getWinner()
     
     print "Press any key for the bonus round, %s!" % self.player.name
     getKeyOrExit(True)
     
     self.curPuzzle = self.puzzles.getBonusPuzzle()
     self.board = bigBoard.theBigBoard(self.curPuzzle)
     self.board.guessedLetters = ['R', 'S', 'T', 'L', 'N', 'E']
     self.players.newRound()
     self.player = self.players.getWinner()
     
     consonantsFound = 0
     while consonantsFound < 3:
         splashMessage("BONUS ROUND!")
         self.board.printPuzzle()
         self.player.printPlayer(True)
         print ""
         self.board.printAvailableConsonants()
         print "\nGive me a consonant! (Press ESCAPE to exit)"
         ch = getKeyOrExit(True).upper()
         if ch == None:
             continue
         else:
             if self.isAconsonant(ch):
                 if ch in self.board.guessedLetters:
                     continue
                 self.board.guessedLetters.append(ch)
                 consonantsFound += 1
             else:
                 continue
             
     vowelsFound = 0
     while vowelsFound < 1:
         splashMessage("BONUS ROUND!")
         self.board.printPuzzle()
         self.player.printPlayer(True)
         print ""
         self.board.printAvailableVowels()
         print "\nGive me a vowel! (Press ESCAPE to exit)"
         ch = getKeyOrExit(True).upper()
         if ch == None:
             continue
         else:
             if self.isAvowel(ch):
                 if ch in self.board.guessedLetters:
                     continue
                 self.board.guessedLetters.append(ch)
                 vowelsFound += 1               
             else:
                 continue
                 
     bonusAmount = self.wheel.bonusRoundTile()
     splashMessage("BONUS ROUND!")
     self.board.printPuzzle()
     self.player.printPlayer(True)
     print ""
     guess = getAline("Solve the puzzle...type the answer...")
     success = self.board.guessThePuzzle(guess)
     if success:
         self.player.moneyOverall += bonusAmount
         splashMessage("Wonderful!")
         print "\nBonus prize was $%i" % bonusAmount
     else:
         splashMessage("Oops, not quite!")
         print "\nPuzzle answer was...\n"
         print "  " + self.board.puzzleString
         
     print "\n%s wins $%i!" % (self.player.name, self.player.moneyOverall)
     print "Press any key to end game"
     getAkey()
コード例 #7
0
    def playRound(self, roundNum):

        # at the beginning of each round, select a puzzle and instantiate the big board
        self.curPuzzle = self.puzzles.newPuzzle()
        self.board = bigBoard.theBigBoard(self.curPuzzle)
        self.players.newRound()
        self.player = self.players.getFirstPlayer()

        while True:

            self.printHeader(roundNum)
            self.board.printPuzzle()
            self.players.printPlayers()
            self.printRoundMenu()
            ch = getAkey().upper()
            if ch == " ":
                newTile = self.wheel.spin()
                if newTile.tileTypeOf == wheel.tileType_money:
                    print "You spin the wheel and get...\n "
                    splashMessage('$ %i' % newTile.value, True)
                    thisLetter = self.getAconsonant()
                    if thisLetter == None:
                        self.players.getNextPlayer()
                        getKeyOrExit()
                        continue
                    count = self.board.guessALetter(thisLetter)
                    if count:
                        print "Great! Number of %s's found: %i" % (thisLetter,
                                                                   count)
                        self.player.gotConsonant(newTile.value * count)
                    else:
                        print "No %s's found...next player" % (thisLetter)
                        self.player = self.players.getNextPlayer()
                else:
                    splashMessage(newTile.nameFromInt(newTile.tileTypeOf))
                    if newTile.tileTypeOf == wheel.tileType_bankrupt:
                        self.player.wentBankrupt()
                    self.player = self.players.getNextPlayer()
                getKeyOrExit()
            elif ch == "S":
                guess = getAline(
                    "You'd like to try to solve...type the answer...")
                success = self.board.guessThePuzzle(guess)
                if success:
                    splashMessage('Great Job!')
                    self.player.winner(self.houseMinimum)
                    getKeyOrExit()
                    return True
                else:
                    print "Not quite, next player...press any key"
                    self.players.getNextPlayer()
                    getKeyOrExit()
            elif ch == "V":
                if self.player.moneyThisRound < self.vowelCost:
                    print "Don't have enough money to buy a vowel!"
                    self.players.getNextPlayer()
                else:
                    thisLetter = self.getAvowel()
                    if thisLetter == None:
                        self.players.getNextPlayer()
                        getKeyOrExit()
                        continue
                    count = self.board.guessALetter(thisLetter)
                    self.player.boughtVowel(self.vowelCost)
                    if count:
                        print "Great! Number of %s's found: %i" % (thisLetter,
                                                                   count)
                    else:
                        print "No %s's found...next player" % (thisLetter)
                        self.player = self.players.getNextPlayer()
                getKeyOrExit()
            elif ch == "N":
                print "Are you sure to want to skip this round? (y/n)"
                if getAkey() in ["y", "Y"]:
                    return True
            elif ch == '\033':
                sys.exit(0)
            else:
                pass
コード例 #8
0
 def printHeader(self, roundNum):
     splashMessage("ROUND " + str(roundNum))
コード例 #9
0
 def printWelcome(self):
     splashMessage(self.gameName)
     print "Welcome, press any key to start, but press ESCAPE to quit!"
     getKeyOrExit(True)
コード例 #10
0
    def playBonusRound(self):
        splashMessage("BONUS ROUND!")

        # select winner
        self.player = self.players.getWinner()

        print "Press any key for the bonus round, %s!" % self.player.name
        getKeyOrExit(True)

        self.curPuzzle = self.puzzles.getBonusPuzzle()
        self.board = bigBoard.theBigBoard(self.curPuzzle)
        self.board.guessedLetters = ['R', 'S', 'T', 'L', 'N', 'E']
        self.players.newRound()
        self.player = self.players.getWinner()

        consonantsFound = 0
        while consonantsFound < 3:
            splashMessage("BONUS ROUND!")
            self.board.printPuzzle()
            self.player.printPlayer(True)
            print ""
            self.board.printAvailableConsonants()
            print "\nGive me a consonant! (Press ESCAPE to exit)"
            ch = getKeyOrExit(True).upper()
            if ch == None:
                continue
            else:
                if self.isAconsonant(ch):
                    if ch in self.board.guessedLetters:
                        continue
                    self.board.guessedLetters.append(ch)
                    consonantsFound += 1
                else:
                    continue

        vowelsFound = 0
        while vowelsFound < 1:
            splashMessage("BONUS ROUND!")
            self.board.printPuzzle()
            self.player.printPlayer(True)
            print ""
            self.board.printAvailableVowels()
            print "\nGive me a vowel! (Press ESCAPE to exit)"
            ch = getKeyOrExit(True).upper()
            if ch == None:
                continue
            else:
                if self.isAvowel(ch):
                    if ch in self.board.guessedLetters:
                        continue
                    self.board.guessedLetters.append(ch)
                    vowelsFound += 1
                else:
                    continue

        bonusAmount = self.wheel.bonusRoundTile()
        splashMessage("BONUS ROUND!")
        self.board.printPuzzle()
        self.player.printPlayer(True)
        print ""
        guess = getAline("Solve the puzzle...type the answer...")
        success = self.board.guessThePuzzle(guess)
        if success:
            self.player.moneyOverall += bonusAmount
            splashMessage("Wonderful!")
            print "\nBonus prize was $%i" % bonusAmount
        else:
            splashMessage("Oops, not quite!")
            print "\nPuzzle answer was...\n"
            print "  " + self.board.puzzleString

        print "\n%s wins $%i!" % (self.player.name, self.player.moneyOverall)
        print "Press any key to end game"
        getAkey()