Hi Loic,

 

I'm struggling with PacketPokerChipsPot2Player : PacketPokerChipsBet2Pot :
PacketPokerChipsPlayer2Bet

 

As in:    Info = (

                                     ('chips', [], 'c' ),

                             )

 

I understand what it's trying to do:          chips: list of integers
counting the number of chips to move.

The value of each chip is, respectively:

 
1 2 5 10 20 25 50 100 250 500 1000 2000 5000.

 

 

But not understanding these functions:

 

*******

 

def chips2amount(chips):

    amount = 0

    for i in xrange(len(chips) / 2):

        amount += chips[i*2] * chips[i*2 + 1]

    return amount

 

class PokerClientPackets:

    @staticmethod

    def unpackchips(block):

        amount = int(unpack('!I', block[:4])[0])

        if amount > 0:

            chips = (1, amount)

        else:

            chips = []

        return ( block[4:], chips )

    

Packet.format_info['c'] = {

    'pack': lambda data: pack('!I', chips2amount(data)),

    'unpack': PokerClientPackets.unpackchips,

    'calcsize': lambda data: 4,

    }

 

 

********

 

 

Please advise

 

Otherwise everything seems on track!

 

_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to