Exemplo n.º 1
0
 def BuildDefaultMenu(self):
   self._menus = {} ## keep multiple menus
   self._menus['default'] = Menu()
   self._menus['default'].AddEntry( 'quit', "Exit the program")
   self._menus['default'].AddEntry( 'master', "Request master action", True)
   self._menus['default'].AddEntry( 'exception', "Throw intentional exception", not( _debug))
   self._menus['default'].AddEntry( '', "Ready", True)
   self._menus['default'].AddEntry( 'end', "End the game", True)
   self._menus['default'].AddEntry( '2p', "Start two player game", True) ## debugging purposes
   self._menus['messages'] = Menu( info=True)
Exemplo n.º 2
0
 def DistributeTalon(self):
     cards = list(self._talon.values())
     shuffle(cards)
     Npile = self.Npiles()
     ## create a pile menu to choose which cards to pick up
     self._talonMenu = Menu()
     self._talonMenu.Deactivate()
     for i in range(Npile):
         tag = 'pile{}'.format(i)
         desc = ''  ## description of cards in pile
         ## create a menu for each pile of cards
         menu = Menu(info=True)
         ## distribute cards to the piles
         ## build the description for the pile menu
         for card in cards[i * self._num:(i + 1) * self._num]:
             menu.AddEntry(card.ShortName(),
                           card.LongName())  ## entry for each card
             desc = desc + ('/' if (len(desc) > 0) else '') + '{}'.format(
                 card.LongName())
         self._talonMenu.AddEntry(tag, desc)  ## entry for picking piles
         self._pileMenus.append(menu)
Exemplo n.º 3
0
 def InitializeMenus(self):
     self._bidMenu = Menu()
     self._bidMenu.AddEntry('pass', 'No bid')
     self._bidMenu.AddEntry('K', 'Klop')
     self._bidMenu.AddEntry('3', 'Three w/ partner')
     self._bidMenu.AddEntry('2', 'Two   w/ partner')
     self._bidMenu.AddEntry('1', 'One   w/ partner')
     self._bidMenu.AddEntry('S3', 'Solo Three')
     self._bidMenu.AddEntry('S2', 'Solo Two')
     self._bidMenu.AddEntry('S1', 'Solo One')
     self._bidMenu.AddEntry('B', 'Beggar')
     self._bidMenu.AddEntry('S0', 'Solo Without')
     self._bidMenu.AddEntry('OB', 'Open Beggar')
     self._bidMenu.AddEntry('CV', 'Color Valat Without')
     self._bidMenu.AddEntry('V', 'Valat Without')
     self._bidMenu.Deactivate()
     self._kingMenu = Menu()
     self._kingMenu.AddEntry('diamond', 'King of Diamonds')
     self._kingMenu.AddEntry('spade', 'King of Spades')
     self._kingMenu.AddEntry('heart', 'King of Hearts')
     self._kingMenu.AddEntry('club', 'King of Clubs')
     self._kingMenu.Deactivate()
     self._announcementMenu = Menu()
     self._announcementMenu.AddEntry('pass', 'No announcement')
     self._announcementMenu.AddEntry('kontra', 'Kontra game (x2)')
     self._announcementMenu.AddEntry('rekontra', 'Rekontra game (x4)')
     self._announcementMenu.AddEntry('subkontra', 'Subkontra game (x8)')
     self._announcementMenu.AddEntry('mordkontra', 'Mordkontra game (x16)')
     self._announcementMenu.AddEntry('trula',
                                     'End game in possession of trula')
     self._announcementMenu.AddEntry('kings',
                                     'End game in possession of all kings')
     self._announcementMenu.AddEntry('king_ult',
                                     'Win called king on last trick')
     self._announcementMenu.AddEntry('pagat_ult',
                                     'Win last trick with pagat')
     self._announcementMenu.AddEntry('valat', 'Win all tricks')
     self._announcementMenu.Deactivate()
Exemplo n.º 4
0
 def Cleanup(self):
     self._handMenu = Menu(info=True)
     self._hand = {}  ## Card class objects, keys are Card.ShortName()
     self._tricks = {}  ## Card class objects won in tricks
     self._talonCards = []  ## track cards that came from talon