def createItems(): doc1 = doctor('1', 'Ольга', 'Яновская', 'Андреевна', 'Психолог', 'высшая категория') doc2 = doctor('2', 'Елена', 'Дорофеева', 'Борисовна', 'Психолог', '1 категория') h.appendDoctor(doc1) h.appendDoctor(doc2) r1 = procedure('1', 'тыкнуть носом', 50, doc1) r2 = procedure('2', 'консультация', 350, doc2) h.appendProcedure(r1) h.appendProcedure(r2) p1 = patient('1', 'Кирилл', 'Вторцев', 'Дмитриевич', '21.11.2001', 50) p2 = patient('2', 'Марк', 'Захаров', '', '08.05.2001', -90) h.appendPatient(p1) h.appendPatient(p2) d1 = deal('1', '02.11.2020', 'что-то там 1', p1, [r1]) d2 = deal('2', '03.11.2020', 'что-то там 2', p2, [r1, r2]) h.appendDeal(d1) d1.appendProcedure(r1) h.appendDeal(d2) d2.appendProcedure(r1) d2.appendProcedure(r2) h.save('res.json')
def threadFun(): try: time = int(e2.get()) except Exception as e: time = 1 pass finally: e2.delete(0, "end") deal.deal(beginX.get(), beginY.get(), endX.get(), endY.get(), time, text)
def hand_percentages(n=700 * 1000): "Sample n random hands and print a table of frequencies for each type of hand" counts = [0] * 9 for i in range(n / 10): for hand in deal(10): ranking = hand_rank(hand)[0] counts[ranking] += 1 for i in reversed(range(9)): print "%14s: %6.3f %%" % (hand_names[i], 100. * counts[i] / n)
def hand_percentages(n=700*1000): "Sample n random hands and print a table of frequencies for each type of hand" counts = [0] * 9 for i in range(n/10): for hand in deal(10): ranking = hand_rank(hand)[0] counts[ranking] += 1 for i in reversed(range(9)): print "%14s: %6.3f %%" % (hand_names[i], 100.*counts[i]/n)
def hand_percentages(n=1000000): """ sample n random hands and print percentages for each hand """ counts = [0]*9 for i in range(n/10): hands = deal(10) for hand in hands: rank = hand_rank(hand)[0] counts[rank] += 1 for i in reversed(range(9)): print "%20s: %6.3f %%" % (hand_names[i], (100.*counts[i]/n))
def changeItems(): doc3 = doctor('3', 'Наталия', 'Чехонина', 'Павловна', 'стоматолог', '1 категория') h.appendDoctor(doc3) r3 = procedure('3', 'консультация', 500, doc3) h.appendProcedure(r3) p2 = patient('2', 'Марк', 'Захаров', '', '08.05.2001', -90) h.appendPatient(p2) d3 = deal('3', '13.12.2020', 'Зубной налет', p2, [r3]) h.appendDeal(d3)
def __init__(self, name,path,switch=False,solr=None): self.name=name self.switch=switch self.path=path+'\logs\\'+self.name if not os.path.exists(path+'\logs'): os.mkdir(path+'\logs') if not os.path.exists(self.path): os.mkdir(self.path) self.routor=Routor(name,path) self.queue=Queue.Queue(maxsize=0) self.failQueue=Queue.Queue(maxsize=0)#失败队列 self.logger=self.newLogging(name) self.bloomfilter=BloomFilter() self.count=0 self.queue.put(self.routor.route[0]['pattern']) self.sleeptime=self.routor.route[-1]['sleeptime'] self.block=SleepTime(self.sleeptime)#屏蔽模块 self.fail=0 self.job=deal(name,'job',path,solr) self.company=deal(name,'company',path,solr)
def hand_percenteges(n=700 * 1000): ''' Sample n random hands and print a table of percentages for each type of hand. ''' hand_names = ('High Card', 'Pair', '2 Pair', '3 Kind', 'Straight', 'Flush', 'Full House', '4 Kind', 'Straight Flush') counts = [0] * 9 for i in range(n // 10): for poker.hand in deal.deal(10): counts[poker.hand_rank(poker.hand)[0]] += 1 for j in reversed(range(9)): print('{:14} {:6.3%}'.format(hand_names[j], counts[j] / n))
def hand_percentage(n=700*1000): """Sample n random hands and print a table of percentages for each type of hand. Args: n: int indicates total number of hands to be dealt. """ counts = [0]*9 for i in range(n/10): for hand in deal(10): ranking = hand_rank(hand)[0] counts[ranking] += 1 for i in reversed(range(9)): print "%14s: %6.3f %%" % (hand_names[i], 100.*counts[i]/n)
def sangriento(n, texas_holdem=True): if texas_holdem: hands = texas_holdem_deal(n) else: hands = deal(n) for hand in hands: print hand winner = poker(hands) ranking = hand_rank(winner[0])[0] print "Winner hand(s):" print hand_names[ranking] return winner
def generate_game(game_no, model): # deal cards l, p1, p2 = deal(model) landlord = HandCard(l.card_dict, 'dict', is_landlord=True) peasant1 = HandCard(p1.card_dict, 'dict') peasant2 = HandCard(p2.card_dict, 'dict') # construct game tree node = Node(current=landlord, down=peasant1, up=peasant2) game_data = pd.DataFrame() for i in range(100): # calculate next step _, node = minimax(node, 3, -inf, +inf) if node is None or node.is_over(): break if node.pre1_combo is None: combo_str = '' primal_str = '' primal_type = 0 kicker_len = 0 kicker_type = 0 else: combo_str = node.pre1_combo.__str__() primal_str = node.pre1_combo.primal.__str__() primal_type = node.pre1_combo.get_primal_type() kicker_len = 0 if node.pre1_combo.kicker is None else node.pre1_combo.kicker.kicker_len kicker_type = node.pre1_combo.get_kicker_type() player_no = i % 3 + 1 round_no = (i // 3) + 1 current_str = node.current.__str__() up_str = node.up.__str__() down_str = node.down.__str__() data = pd.DataFrame({ 'game_no': [game_no], 'player_no': [player_no], 'round_no': [round_no], 'primal_type': [primal_type], 'kicker_type': [kicker_type], 'kicker_len': [kicker_len], 'combo_str': [combo_str], 'primal_str': [primal_str], 'current_str': [current_str], 'up_str': [up_str], 'down_str': [down_str] }) game_data = pd.concat([game_data, data]) return game_data
doctors = doctorList() procedures = procedureList() doc1 = doctor(1, 'Ольга', 'Яновская', 'Андреевна', 'Психолог', 'высшая категория') doc2 = doctor(2, 'Елена', 'Дорофеева', 'Борисовна', 'Психолог', '1 категория') doctors.appendList(doc1) doctors.appendList(doc2) r1 = procedure(0, 'тыкунть носом', 500, doc1) r2 = procedure(0, 'консультация', 3500, doc2) r3 = procedure(0, 'консультация2', 100, doc2) procedures.appendList(r1) procedures.appendList(r2) procedures.appendList(r3) p1 = patient(1, 'Кирилл', 'Вторцев', 'Дмитриевич', '21.11.2001', 50) p2 = patient(2, 'Марк', 'Захаров', '', '08.05.2001', -90) patients.appendList(p1) patients.appendList(p2) d1 = deal(1, '02.11.2020', 'что-то там 1', p1, [r1]) d2 = deal(2, '03.11.2020', 'что-то там 2', p2, [r1, r2]) d3 = deal(3, '11.11.2020', 'что-то там 3', p1, [r3]) #d1.setPatient(p1) #d2.setPatient(p2) deals.appendList(d1) deals.appendList(d2) deals.appendList(d3) print(procedures)
# b.show_pack_of_card() # Input my hand card1, card2 = hand.UI.input_my_hand() c = hand.myhand(card1, card2) my_hand_list = c.myhand_list() c.show_my_hand(new_line=True) # Remove hand from the pack of card # b.remove_card(card1) # b.remove_card(card2) # b.show_pack_of_card() # # # Create my hand # my_hand = hand.myhand(card1,card2) # Flop mid_card = deal(b) flop = mid_card.flop() mid_card.show_flop(new_line=True) turn = mid_card.turn() mid_card.show_turn(new_line=True) river = mid_card.river() mid_card.show_river(new_line=True) combination = hand.combination(my_hand_list, flop, turn, river) # hand.find_all_combination(combination)
import deal,transfer,layers path=r'C:\Users\mimota\OneDrive\python\机器学习\lihongyi_hw_1\train.csv' matrix=deal.deal(path) x_9,y_10=transfer.transfer(matrix) layers.layer(x_9,y_10)
import deal # import draw deal.init() while True: # 处理事件 if deal.deal(): break # 绘图
for k, v in kwargs.items(): print(k) def process_command(self, cmd, *args, **kwargs): ss_count = 0 sub_cmd = '' if cmd in self.tmap: sub_cmd = cmd else: for map_cmd in self.tmap: if(map_cmd[:cmd.__len__()] == cmd): sub_cmd = map_cmd ss_count += 1 if(ss_count >= 2): sub_cmd = '' break if(sub_cmd): self.tmap[sub_cmd](*args, **kwargs) if __name__ == "__main__": c = Controller() d, h1, h2, h3, h4 = deal() kwargs = {'one': 23} print(c.tmap) #["foo"]() c.fmap["one"](**kwargs) c.fmap["two"](**kwargs) print(Controller._get_method_dict(c)) c.process_command('f') c.process_command('fun') c.process_command('foo')
def test_deal(self): i=deal(3) self.assertIn(i,"012")