MCPcopy Create free account
hub / github.com/ActiveState/code / Match

Class Match

recipes/Python/580811_Uno_TextBased/recipe-580811.py:716–1324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714 return self.zero
715
716class Match():
717
718 elementsInit = {
719 ### Names (final) ###
720 'P1Name':' ', 'P2Name':' ', 'P3Name':' ', 'P4Name':' ',
721 ### Card Values ###
722 'P1Cards':' ', 'P2Cards':' ', 'P3Cards':' ', 'P4Cards':' ',
723 ### Turn Colors / Hand###
724 'P1Turn':'', 'P2Turn':'', 'P3Turn':'', 'P4Turn':'',
725 'HName':'\t\t', 'HVisual':'' ,'Hand':'',
726 ### Deck ###
727 'DNum':'', 'Deck':['','','','','','','','',''],
728 'PostDNum':'',
729 ### Pile ###
730 'uHeader':'\t\t\t\t', 'uMiddle':' ', 'uLower':' ',
731 'oHeader':'\t\t\t', 'oMiddle':['\t\t\t','\t\t\t','\t\t\t','\t\t\t','\t\t\t','\t\t\t','\t\t\t','\t\t\t'],
732 ### Messages ###
733 'Console':'', 'Error':''
734 }
735
736 speeds = {'slow':2,'normal':1,'fast':0}
737
738
739 def __init__(self, gs):
740 ### Decks ###
741 self.deck = Deck(True)
742 self.pile = Deck(False)
743
744 ### Player Information ###
745 self.players = gs.players
746 self.turnList = []
747 self.handTitles = {'play1':'','play2':'','play3':'','play4':''}
748
749 ### Carry Information ###
750 self.displayEffects = gs.displayEffects
751 self.hideComputerHands = gs.hideComputerHands
752 self.zeroChange = gs.zeroChange
753 self.computerSpeed = self.speeds[gs.computerSpeed]
754 self.simulation = gs.computerSimulation
755
756 ### Data ###
757 self.handPosition = 0 # For hand displays
758 self.drawAmount = 0 # Used for force draws
759 self.passes = 0 # Keep track of consecutive passes for emergency color change
760 self.passMax = 0 # Max passes before color change
761 self.turn = '' # Current turn
762 self.event = '' # Wild, Reverse, Skip, etc
763 self.wildColorChange = '' # Specifies color to change wild card to
764 self.currentColor = '' # Current color
765 self.currentValue = '' # Current value
766 self.winnerID = '' # ID of Player who Won
767 self.reverse = False # Is turn order reversed
768 self.turnComplete = False # Is turn complete
769 self.matchComplete = False # Is the Game over?
770 self.matchAbort = False # Did the match conclude without a winner?
771 self.forcedWild = False # Force change wild
772
773 ### Initialize Names / Cards / Deck (Assuming New Game) ###

Callers 1

playMatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected