コード例 #1
0
def main(playerNumber):




    maxPlayers = 9

    players = []




    i = 0
    x = 0

    cards = AllCards()
    allCards = cards.getShuffeldCard()
    playerHand = []




    while i < playerNumber and i < maxPlayers:
        players.append(Player(str(i)))
        i += 1

    deal(players)


    """while i < playerNumber and i < maxPlayers:
        y = 0

        while y < 5:
            playerHand.append(allCards[x])
            x += 1
            y += 1
        players.append(Player(str(i), playerHand))
        playerHand = []

        i += 1"""


    x = 0

    while x < len(players):
        print "Player " + players[x].getPlayerName()

        cards = players[x].getPlayerCards()

        for y in cards:
            print str(y.getCardValue()) + " Color: " + y.getCardColor() + " "
        x += 1


    val = 0
コード例 #2
0
def deal(players):
    cards = AllCards()
    allCards = cards.getShuffeldCard()

    x = 0
    counter = 0
    while x < len(players):
        y = 0
        playerHand = []
        while y < 5:
            playerHand.append(allCards[counter])
            counter += 1
            y += 1
        players[x].setPlayerCards(playerHand)
        x += 1
コード例 #3
0
    def test_getShuffeldCard(self):
        allCards = AllCards()

        self.assertTrue(len(allCards.getShuffeldCard()) == 52)