Example #1
0
    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)
Example #2
0
    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)+".")
Example #3
0
    def next_turn(methods,info):
        ''' increment turn and find winner if hitting and standing over '''

        try:
            Plugin.turn += 1
            if Plugin.turn == len(Plugin.player_lst):
                #all players have find winner
                total_lst = [player.show_player_hand().hand_total() for player in Plugin.player_lst]
                index,value = max(list(enumerate(total_lst)), key=lambda x:x[1])
                if total_lst.count(value) == 1:
                    Plugin.winner = Plugin.player_lst[index].get_name()
                    methods["send"](info["address"],"The winner is "+Plugin.winner+"!")
                else:
                    methods["send"](info["address"],"This round has ended in a draw!")
                Plugin.bj_created = False
        except Exception as e:
            print("woops, blackjack turn change error ",e)
Example #4
0
print(POT.show_pot())
POT.increase_pot(24)
print(POT.show_pot())
POT.increase_pot(6)
print(POT.show_pot())

print(" ".join([
    c.show_card() for h in game_init.game[3]
    for c in h.show_player_hand().show_hand_obj()
]))

print(
    len(game_init.game[0]) + len(game_init.game[1]) +
    len(game_init.game[3]) * 2)

for player in game_init.game[3]:
    print(
        player.general_name(),
        player.show_player_hand().show_hand(),
        player.chips(),
        player.position_nr(),
        player.position_name(),
        player.show_player_hand().hand_strength(board),
        player.show_player_hand().best_five(board),
    )

game_init.game[0].show_deck()
game_init.game[1].show_board()
for p in game_init.game[3]:
    p.show_player_hand().show_hand()
Example #5
0
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(),
        player.position_name(),
        player.show_player_hand().hand_strength(board),
        str(player.show_player_hand().best_five(board)),
    )

print(len(deck.show_deck()))
Example #6
0
        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(), \
        player.position_name(), player.show_player_hand().hand_strength(board), str(player.show_player_hand().best_five(board)))

print(len(deck.show_deck()))
Example #7
0
print(str(player2.chips()))
print(player2.position_name())
player2.add_position(7)
print(player2.position_name())

pot1 = pot.Pot()
print(pot1.show_pot())
pot1.increase_pot(55)
print(pot1.show_pot())
POT = pot.Pot()
print(POT.show_pot())
POT.increase_pot(24)
print(POT.show_pot())
POT.increase_pot(6)
print(POT.show_pot())

print(" ".join([c.show_card() for h in game_init.game[3] for c in h.show_player_hand().show_hand_obj()]))


print(len(game_init.game[0])+len(game_init.game[1])+len(game_init.game[3])*2)

for player in game_init.game[3]:
    print(player.general_name(), player.show_player_hand().show_hand(), player.chips(), \
          player.position_nr(), player.position_name(), \
          player.show_player_hand().hand_strength(board), player.show_player_hand().best_five(board))

game_init.game[0].show_deck()
game_init.game[1].show_board()
for p in game_init.game[3]:
    p.show_player_hand().show_hand()