Beispiel #1
0
def playGame(myGame):
    print(f"The game is {myGame.gameName}")
    myDeck = Deck(myGame)
    myDeck.shuffleCards

    myHands = Hand.createHandsFromList(Hand, myDeck, myGame.players)
    communityHand = Hand(myDeck)

    # Deal each round
    for rnd in myGame.rounds:
        if isinstance(rnd[0], list):
            for subrnd in rnd:
                if subrnd[1] == 'c':
                    Hand.dealCommunityCards(Hand, myHands,
                                            communityHand, subrnd[0])
                elif subrnd[1] == 'u' or subrnd[1] == 'd':
                    Hand.dealRound(Hand, myHands, subrnd[0])
                else:
                    pass
                    # TODO - code for draw
        else:
            if rnd[1] == 'c':
                Hand.dealCommunityCards(Hand, myHands,
                                        communityHand, rnd[0])
            elif rnd[1] == 'u' or rnd[1] == 'd':
                Hand.dealRound(Hand, myHands, rnd[0])
            else:
                pass
                # TODO - code for draw
    Hand.calculateHandValues(Hand, myHands, communityHand, myGame)
    myHands.sort(key=lambda x: x.value, reverse=True)
    printCurrentStandings(myGame, myHands, communityHand)
    input("Press Enter to continue...")
Beispiel #2
0
def main():
    players = ["Peter", "John", "David", "Ford", "Derrick",
               "Darcy", "Jim", "Joyce", "Joanne", "Ruth"]
    myGame = game.Holdem(players)
    myDeck = Deck(myGame)
    myHands = Hand.createHandsFromList(Hand, myDeck, myGame.players)
    communityHand = Hand(myDeck)
    print(myGame.players)