def new_deal(self): dealer_name = self.dealer.player_name self.bc_pre("^R%s^~ (%s%s^~) gives the cards a good shuffle...\n" % (dealer_name, self.get_color_code(self.dealer), self.dealer)) deck = new_deck() deck.shuffle() # Deal out all of the cards. We'll flip the last one; that determines # the trump suit for the hand. self.bc_pre("^R%s^~ deals the cards out to all the players.\n" % dealer_name) for seat in self.seats: seat.data.hand = Hand() for i in range(13): for seat in self.seats: seat.data.hand.add(deck.discard()) # Flip the dealer's last card; it determines the trump suit. last_card = self.dealer.data.hand[-1] self.bc_pre("^R%s^~ flips their last card; it is ^C%s^~.\n" % (dealer_name, card_to_str(last_card, LONG))) self.trump_suit = last_card.suit # Sort everyone's hands. for seat in self.seats: seat.data.hand = sorted_hand(seat.data.hand, self.trump_suit) # Show everyone their hands. self.show_hands() # Set the trick counts to zero. self.ns.tricks = 0 self.ew.tricks = 0
def finish_deal(self): self.bc_pre("^R%s^~ finishes dealing the cards out.\n" % self.dealer.player_name) while len(self.deck): for seat in self.seats: seat.data.hand.add(self.deck.discard()) # Sort everyone's hands now that we have a trump suit. for seat in self.seats: seat.data.hand = sorted_hand(seat.data.hand, self.trump_suit) # Show everyone their completed hands. self.show_hands() # We're playing now. self.state.set("playing")
def finish_deal(self): self.bc_pre("^R%s^~ finishes dealing the cards out.\n" % self.dealer.player_name) while len(self.deck): for seat in self.seats: seat.data.hand.add(self.deck.discard()) # Sort everyone's hands now that we have a trump suit. for seat in self.seats: seat.data.hand = sorted_hand(seat.data.hand, self.trump_suit) # Show everyone their completed hands. self.show_hands() # We're playing now. self.state.set("playing")
def start_deal(self): # Set the trick counts to zero, appropriately for the mode. if self.mode == 4: self.ns.tricks = 0 self.ew.tricks = 0 else: self.west.data.tricks = 0 self.south.data.tricks = 0 self.east.data.tricks = 0 dealer_name = self.dealer.player_name self.bc_pre( "^R%s^~ (%s%s^~) gives the cards a good shuffle...\n" % (dealer_name, self.get_color_code(self.dealer), self.dealer)) self.new_deck() self.deck.shuffle() # Deal out five cards each. self.bc_pre("^R%s^~ deals five cards out to each of the players.\n" % dealer_name) for seat in self.seats: seat.data.hand = Hand() for i in range(5): for seat in self.seats: seat.data.hand.add(self.deck.discard()) # Clear the internal metadata about trumps. self.trump_suit = None # Sort the hakem's hand. self.hakem.data.hand = sorted_hand(self.hakem.data.hand) # Show the hakem their hand. if self.hakem.player: self.tell_pre(self.hakem.player, "Please choose a trump suit for this hand.\n") self.show_hand(self.hakem.player) # The hakem both chooses and, eventually, leads. self.turn = self.hakem self.layout.change_turn(self.hakem.data.who) # Shift into "choosing" mode. self.state.set("choosing")
def start_deal(self): # Set the trick counts to zero, appropriately for the mode. if self.mode == 4: self.ns.tricks = 0 self.ew.tricks = 0 else: self.west.data.tricks = 0 self.south.data.tricks = 0 self.east.data.tricks = 0 dealer_name = self.dealer.player_name self.bc_pre("^R%s^~ (%s%s^~) gives the cards a good shuffle...\n" % (dealer_name, self.get_color_code(self.dealer), self.dealer)) self.new_deck() self.deck.shuffle() # Deal out five cards each. self.bc_pre("^R%s^~ deals five cards out to each of the players.\n" % dealer_name) for seat in self.seats: seat.data.hand = Hand() for i in range(5): for seat in self.seats: seat.data.hand.add(self.deck.discard()) # Clear the internal metadata about trumps. self.trump_suit = None # Sort the hakem's hand. self.hakem.data.hand = sorted_hand(self.hakem.data.hand) # Show the hakem their hand. if self.hakem.player: self.tell_pre(self.hakem.player, "Please choose a trump suit for this hand.\n") self.show_hand(self.hakem.player) # The hakem both chooses and, eventually, leads. self.turn = self.hakem self.layout.change_turn(self.hakem.data.who) # Shift into "choosing" mode. self.state.set("choosing")
def new_deal(self): dealer_name = self.dealer.player_name self.bc_pre( "^R%s^~ (%s%s^~) gives the cards a good shuffle...\n" % (dealer_name, self.get_color_code(self.dealer), self.dealer)) deck = new_deck() deck.shuffle() # Deal out all of the cards. We'll flip the last one; that determines # the trump suit for the hand. self.bc_pre("^R%s^~ deals the cards out to all the players.\n" % dealer_name) for seat in self.seats: seat.data.hand = Hand() for i in range(13): for seat in self.seats: seat.data.hand.add(deck.discard()) # Flip the dealer's last card; it determines the trump suit. last_card = self.dealer.data.hand[-1] self.bc_pre("^R%s^~ flips their last card; it is ^C%s^~.\n" % (dealer_name, card_to_str(last_card, LONG))) self.trump_suit = last_card.suit # Sort everyone's hands. for seat in self.seats: seat.data.hand = sorted_hand(seat.data.hand, self.trump_suit) # Show everyone their hands. self.show_hands() # Set the trick counts to zero. self.ns.tricks = 0 self.ew.tricks = 0
def new_deal(self): # Set tricks and bids to zero. for seat in self.seats: seat.data.tricks = 0 seat.data.bid = 0 dealer_name = self.dealer.player_name self.bc_pre("^R%s^~ (%s%s^~) gives the cards a good shuffle...\n" % (dealer_name, self.get_color_code(self.dealer), self.dealer)) deck = new_deck() deck.shuffle() # Deal out all of the cards. self.bc_pre("^R%s^~ deals the cards out to all of the players.\n" % dealer_name) for seat in self.seats: seat.data.hand = Hand() for _ in range(13): for seat in self.seats: seat.data.hand.add(deck.discard()) # If we're in whist mode, flip the dealer's last card to determine # trumps. if self.whist: last_card = self.dealer.data.hand[-1] self.bc_pre("^R%s^~ flips their last card; it is ^C%s^~.\n" % (dealer_name, card_to_str(last_card, LONG))) self.trump_suit = last_card.suit else: # Hearts forever. self.trump_suit = HEARTS # Sort everyone's hands and show them to everyone. for seat in self.seats: seat.data.hand = sorted_hand(seat.data.hand, self.trump_suit) self.show_hands()