def start(methods,info): ''' start the game ''' Plugin.round_started = True Plugin.bj_created = True for player in Plugin.player_lst: player.add_hand(hand.Hand(Plugin.DECK.make_hand())) total = player.show_player_hand().hand_total() cards = " ".join([card.show_card() for card in player.show_player_hand().show_hand_obj()]) Plugin.checkHand(methods,info,player)
def checkHand(methods,info,player): ''' check the value of a player's hand ''' name = player.get_name() total = player.show_player_hand().hand_total() cards = " ".join([card.show_card() for card in player.show_player_hand().show_hand_obj()]) if total > 21: methods["send"](info["address"],name+"'s hand "+cards+" has a value of "+str(total)+" so you have been kicked out") for p in Plugin.player_lst: if p.get_name() == name: Plugin.player_lst.remove(p) if len(Plugin.player_lst) == 1: Plugin.winner = Plugin.player_lst[0].get_name() methods["send"](info["address"],"The winner is "+Plugin.winner+"!") Plugin.bj_created = False elif total == 21: methods["send"](info["address"],name+"'s hand "+cards+" has a value of 21 so you have won!") Plugin.winner = name Plugin.bj_created = False else: methods["send"](info["address"],name+"'s hand "+cards+" has a value of "+str(total)+".")
PLAYERS[i].add_position( (len(PLAYERS) * round + (i - (round - 1))) % len(PLAYERS)) return DECK, BOARD, POT, PLAYERS players = init_players(6, 100) game = init_game(players, 9) deck = game[0] board = game[1] pot = game[2] players = game[3] for card in board.get_board(): print(card.show_card()) print(pot.show_pot()) players[0].show_player_hand().best_five(board) for player in players: print(player.general_name()) print( player.general_name(), player.show_player_hand().show_hand()[0].show_card(), player.show_player_hand().show_hand()[1].show_card(), player.chips(), player.position_nr(),
def showHand(self): for card in self.hand: card.show_card()