コード例 #1
0
ファイル: U_Net.py プロジェクト: jmsking/game-landowner
 def _gen_agent(self):
     #random.shuffle(all_card.ALL_CARD_NO_COLOR)
     #main_agent = all_card.ALL_CARD_NO_COLOR[:20]
     #low_agent = all_card.ALL_CARD_NO_COLOR[20:38]
     #up_agent = all_card.ALL_CARD_NO_COLOR[38:]
     main_agent = [
         3, 3, 4, 4, 6, 7, 7, 7, 8, 10, 10, 11, 11, 12, 12, 12, 12, 15, 15,
         16
     ]
     low_agent = [3, 3, 4, 5, 8, 8, 8, 9, 9, 10, 11, 13, 13, 13, 14, 14, 15]
     up_agent = [4, 5, 5, 5, 6, 6, 6, 7, 9, 9, 10, 11, 13, 14, 14, 15, 17]
     main_agent_status = HandCardUtils.obtain_hand_card_status(main_agent)
     low_agent_status = HandCardUtils.obtain_hand_card_status(low_agent)
     up_agent_status = HandCardUtils.obtain_hand_card_status(up_agent)
     return main_agent_status, low_agent_status, up_agent_status
コード例 #2
0
def test_find_continues():
    hand_card = [
        3, 3, 3, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 10, 10, 10, 11, 12, 12,
        12, 13, 13, 13, 14, 14, 14
    ]
    k = 5
    hand_card_status = HandCardUtils.obtain_hand_card_status(hand_card)
    res = HandCardUtils.find_continues(hand_card_status, k)
    print(res)
コード例 #3
0
def test_find_even_three():
    hand_card = [
        3, 3, 3, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 10, 10, 10, 11, 12, 12,
        12, 13, 13, 13, 14, 14, 14
    ]
    k = 3
    hand_card_status = HandCardUtils.obtain_hand_card_status(hand_card)
    res = HandCardUtils.find_even_pair(hand_card_status, k)
    print(res)
コード例 #4
0
 def hand_card_color_seq(self, color_seq):
     self._hand_card_color_seq = sorted(color_seq, key=lambda x : x[1], reverse=False)
     # 将有花色序列转换为无花色序列
     self._hand_card_seq = list(map(lambda x:x[1], self._hand_card_color_seq))
     self._color_seq = list(map(lambda x:x[0], self._hand_card_color_seq))
     # 记录每张牌的状态
     self._hand_card_status = HandCardUtils.obtain_hand_card_status(self._hand_card_seq)
     # 记录每张牌的个数
     self._hand_card_count = sum(self._hand_card_status)
コード例 #5
0
 def _calc_put_card_seq_score(self, hand_card):
     ctj = CardTypeJudge()
     score = 0
     for item in hand_card:
         hand_card_status = HandCardUtils.obtain_hand_card_status(item)
         cts = ctj.judge_card_type(hand_card_status)
         one_hand_score = HandCardUtils.value_map(cts.primary_item,
                                                  cts.card_type,
                                                  cts.card_count)
         score += one_hand_score
     return score
コード例 #6
0
def _gen_agent(cards1, cards2, cards3):
    main_agent_status = HandCardUtils.obtain_hand_card_status(cards1)
    low_agent_status = HandCardUtils.obtain_hand_card_status(cards2)
    up_agent_status = HandCardUtils.obtain_hand_card_status(cards3)
    return main_agent_status, low_agent_status, up_agent_status