Exemplo n.º 1
0
 def initUi(self):
     """
     Initialize the main UI and it's content based on player color
     :return:
     """
     self.frame = Tkinter.Frame(self)
     self.player = PlayerWindow(self, self.newPlayerCallback)
     self.playerColor = self.player.color
     self.center(700, 350)
     self.turnNumber = 4
     self.setScore()
     self.setComputerLabel()
     self.setPlayerLabel()
     Tkinter.Frame(self.frame,height=40,width=1,bg="lightgrey").grid(row=0, column=2, padx=15)
     self.setGameTable()
     self.setBtnBox()
     Tkinter.Label(self.frame, text=utils.gameInstructions(), anchor=Tkinter.W, justify=Tkinter.LEFT, wraplength=600).grid(row=8, columnspan=6)
     self.frame.pack()
Exemplo n.º 2
0
            playerOptions = utils.redOptions() if playerColor == 'red' else utils.blueOptions()
            playerOptions = [x.title() for x in playerOptions]
            playerMove = raw_input("%s "%playerOptions)
            try:
                responce = self.submitPlayerMove(playerMove)
            except utils.ServerException, e:
                continue
            print "%s Player picked %s"%(responce.get('computerColor').title(), responce.get('computerChoice').title())
            print "Red: %s\nBlue: %s"%(responce['score'].get('red'), responce['score'].get('blue'))
            turnNum += -1



if __name__ == "__main__":
    ctrl = Controller()

    if len(sys.argv) > 1:
        # Check if any sys arguments were passed in while starting the game.
        if sys.argv[1] == '--commandLine':
            # Check if the command line flag was used
            print utils.gameInstructions()
            print "Point System:"
            print utils.getPointSystem()
            print "Welcome!"
            ctrl.newRawGame()
        else:
            # if an unrecognized flag is used display the help instructions
            print utils.getHelp()
    else:
        # if no sys arguments are passed then run the UI mode of game using Tk
        ctrl.newGameWindow()
Exemplo n.º 3
0
            playerOptions = [x.title() for x in playerOptions]
            playerMove = raw_input("%s " % playerOptions)
            try:
                responce = self.submitPlayerMove(playerMove)
            except utils.ServerException, e:
                continue
            print "%s Player picked %s" % (responce.get('computerColor').title(
            ), responce.get('computerChoice').title())
            print "Red: %s\nBlue: %s" % (responce['score'].get('red'),
                                         responce['score'].get('blue'))
            turnNum += -1


if __name__ == "__main__":
    ctrl = Controller()

    if len(sys.argv) > 1:
        # Check if any sys arguments were passed in while starting the game.
        if sys.argv[1] == '--commandLine':
            # Check if the command line flag was used
            print utils.gameInstructions()
            print "Point System:"
            print utils.getPointSystem()
            print "Welcome!"
            ctrl.newRawGame()
        else:
            # if an unrecognized flag is used display the help instructions
            print utils.getHelp()
    else:
        # if no sys arguments are passed then run the UI mode of game using Tk
        ctrl.newGameWindow()