def event_loop(cookie): ec = join_event(cookie) while True: try: events = ec.getEventsTimeout(300000) for event in events: print_event(event, -1) except InvalidOperation: print "Bad getEventsTimeout call" return 0
t2 = TTransport.TBufferedTransport(t2) p2 = TBinaryProtocol.TBinaryProtocol(t2) t2.open() event_client = TarabishMsg.Client(p2) print str(event_client.login(cookie)) return event_client game = 0 ec = join_event(cookie) cards = [] trick = 0 #count = 0 while True: events = ec.getEventsTimeout(300000) for event in events: print_event(event, seatnum) # if event.type == EventType.HAND_DONE: # count = count + 1 # print "BELLA hand count: " + str(count) if event.type == EventType.DEAL: cards += event.dealt trick = 0 if event.type == EventType.ASK_TRUMP and event.seat == seatnum: try: client.callTrump(tableid, PASS) except InvalidOperation, e: # Forced client.callTrump(tableid, SPADES) if event.type == EventType.PLAY_CARD and event.seat == seatnum: cards.remove(event.card) if event.type == EventType.ASK_CARD and event.seat == seatnum: