Esempio n. 1
0
 def ButtonEstimate(self, e):
     cp_no = self.gp.curr_player_no
     outlist = []
     for i in range(0, 50):
         if self.flag_up[i] > 0:
             outlist.append(i)
     if len(outlist) > 0:
         player = libqp.gp_get_player(self.gp, cp_no)
         hand_p = libqp.gp_get_player_hand(player)
         hand_out = libqp.hand_new(len(outlist))
         for j in outlist:
             card = libqp.hand_get(hand_p, j)
             libqp.hand_push(hand_out, card)
         libqp.gp_handtype(self.gp, hand_out)
         self.sel_handtype = hand_out.type
         self.sel_handparam = hand_out.param
         self.Refresh()
Esempio n. 2
0
 def ButtonEstimate(self, e):
     cp_no = self.gp.curr_player_no
     outlist = []
     for i in range(0, 50):
         if self.flag_up[i] > 0:
             outlist.append(i)
     if len(outlist) > 0:
         player = libqp.gp_get_player(self.gp, cp_no)
         hand_p = libqp.gp_get_player_hand(player)
         hand_out = libqp.hand_new(len(outlist))
         for j in outlist:
             card = libqp.hand_get(hand_p, j)
             libqp.hand_push(hand_out, card)
         libqp.gp_handtype(self.gp, hand_out)
         self.sel_handtype = hand_out.type
         self.sel_handparam = hand_out.param
         self.Refresh()
Esempio n. 3
0
 def OnRightDown(self, e):
     pt = e.GetPosition()
     cp_no = self.gp.curr_player_no
     if self.rcHand[cp_no].Inside(pt):
         outlist = []
         for i in range(0, 50):
             if self.flag_up[i] > 0:
                 outlist.append(i)
         if len(outlist) > 0:
             player = libqp.gp_get_player(self.gp, cp_no)
             hand_p = libqp.gp_get_player_hand(player)
             hand_out = libqp.hand_new(len(outlist))
             for j in outlist:
                 card = libqp.hand_get(hand_p, j)
                 libqp.hand_push(hand_out, card)
             htype = libqp.hand_type()
             libqp.gp_handtype(self.gp, hand_out, htype)
             ret = libqp.gp_canplay(self.gp, hand_out, htype)
             if ret > 0:
                 libqp.gp_play(self.gp, cp_no, hand_out)
                 num = libqp.hand_num(hand_p)
                 pokerW, pokerH = self.bmpPoker['0'].GetSize()
                 self.rcHand[cp_no].SetWidth(pokerW +
                                             (num - 1) * self.pokerOffsetW)
                 for i in range(0, 50):
                     self.flag_up[i] = 0
                 self.Refresh()
             else:
                 print "can't play:", htype.type, htype.logic_value1
         else:
             # pass
             libqp.gp_pass(self.gp, cp_no)
             self.Refresh()
     else:
         # reset flag_up
         flag = 0
         for i in range(0, 50):
             if self.flag_up[i] > 0:
                 flag = 1
                 self.flag_up[i] = 0
         if flag > 0:
             self.Refresh()
Esempio n. 4
0
 def OnRightDown(self, e):
     pt = e.GetPosition()
     cp_no = self.ddz.curr_player_no
     if self.rcHand[cp_no].Inside(pt):
         outlist = []
         for i in range(0, 50):
             if self.flag_up[i] > 0:
                 outlist.append(i)
         if len(outlist) > 0:
             player = libqp.ddz_get_player(self.ddz, cp_no)
             hand_p = libqp.ddz_get_player_hand(player)
             hand_out = libqp.hand_new(len(outlist))
             for j in outlist:
                 card = libqp.hand_get(hand_p, j)
                 libqp.hand_push(hand_out, card)
             htype = libqp.hand_type()
             libqp.ddz_handtype(hand_out, htype)
             ret = libqp.ddz_canplay(self.ddz, hand_out, htype)
             if ret > 0:
                 libqp.ddz_play(self.ddz, cp_no, hand_out)
                 num = libqp.hand_num(hand_p)
                 pokerW, pokerH = self.bmpPoker['0'].GetSize()
                 self.rcHand[cp_no].SetWidth(pokerW + (num - 1) * self.pokerOffsetW)
                 for i in range(0, 50):
                     self.flag_up[i] = 0
                 self.Refresh()
             else:
                 print "can't play:",htype.type,htype.logic_value1
         else:
             # pass
             libqp.ddz_pass(self.ddz, cp_no)
             self.Refresh()
     else:
         # reset flag_up
         flag = 0
         for i in range(0, 50):
             if self.flag_up[i] > 0:
                 flag = 1
                 self.flag_up[i] = 0
         if flag > 0:
             self.Refresh()
Esempio n. 5
0
'''
libqp test script
'''
import libqp

print 'test hand and card:'
cd = libqp.card_t()
cd.suit = libqp.cdSuitHeart
cd.rank = libqp.cdRankAce
h = libqp.hand_new(20)
print 'push'  a card to hand'
libqp.hand_push(h,cd)
cd.rank = libqp.cdRank2
print 'push a card to hand'
libqp.hand_push(h,cd)

print 'print a hand'
libqp.hand_print(h,10)