ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 메이플 코강 계산기(Python)
    일상/- 메 2022. 7. 11. 20:04

    하이퍼 버닝으로 아델을 키우다가 오랫만에 하다가 코강하기 어려워서 만들었다.

     

    요약하자면... 현재 뽑은 코어들을 입력해주면, 알아서 맞는 조합을 찾아서 출력해준다.

    변수들을 바꾸면, 몇중 몇코(몇 중첩으로 몇개의 코어를 사용해서 강화할 것인지), 강화하고 싶은 스킬 등을 변경가능하다.

     

    from collections import defaultdict
    from itertools import combinations
    from itertools import product
    
    #test _ 불독_2중 6코 9개 강화
    ov = 2
    nc = 6
    n_skills = [3, 5, 7, 8, 9, 10, 11, 12, 13]
    #차수/최종데미지증가량/스킬/수식어/강화효과20/강화효과40
    str = "플레임 오브, 포이즌 브레스, 이그나이트, 익스플로젼, 텔레포트 마스터리/포이즌리젼, 포이즌 미스트, 플레임 스윔, 미스트 이럽션, 이프리트, 플레임 헤이즈, 메테오, 파이어 오라, 메기도 플레임"
    skills = str.split(', ')
    #print(skills)
    N = len(skills)
    #possessed_cores 
    pc = defaultdict(list)
    #############################################################################    
    
    #코어 입력
    def get_pc():
        print("보유 코어 입력, 번호로 입력 예시(1 2 8)")
        print("코어 목록")
        for i in range(N):
            print(i+1," : ",skills[i])
            
        while(True):
            temp = input("코어입력(숫자만 입력)").split(' ')
            if temp[0] == '0':
                print("보유 코어입력을 종료합니다.\n\n\n")
                break
            if len(temp) != 3:
                print("잘못된 입력")
                continue
            pc[int(temp[0])].append([int(temp[1]), int(temp[2])])
    
    #보유한 코어 출력        
    def print_pc():
        print("현재 코어 목록")
        for m in pc:
            for s in pc[m]:
                print(skills[m-1], " / " , skills[s[0]-1] , " / ",skills[s[1]-1])
        print("\n\n\n")
    #코어를 조합에 의해 선택
    def pick_core():
        print("\npick_core...\n")
        ##ov = int(input("중첩 수 입력 : ")) #2중
        ##nc = int(input("코어 수 입력 : ")) #6코
        #주 코어로 사용될 수 있는 경우의 조합 계산
        combination_list = list(combinations(pc.keys(), nc))
        for i in range(len(combination_list)):
            #하나의 케이스 선택
            temp_c = combination_list[i]
            choose_nc_core = []
            for j in temp_c:#temp_c > [1, 4, 7]
                choose_one_core = []
                for k in pc[j]:#pc[j] > pc[1]
                    choose_one_core.append([j, k[0], k[1]])
                choose_nc_core.append(choose_one_core)
            
            #print(list(product(*choose_nc_core)))
            product_list = list(product(*choose_nc_core))
            #print(product_list)
            for j in product_list:
                calculate_overlaps(list(j))
        
    #중첩 횟수를 계산
    def calculate_overlaps(c):
        count_overlaps = defaultdict(int)#0초기화
        for i in c:
            for j in i:
                count_overlaps[j] += 1
        #print(list(count_overlaps.values()),"\n")
        if print_result(count_overlaps):
            for m in c:
                print(skills[m[0]-1], " / " , skills[m[1]-1] , " / ",skills[m[2]-1])
        
    def print_result(c):
        # 가능한 조합 출력
        for i in n_skills:
            if c[i] < ov:
                return False
        print("ok")
        return True
    
    def main():
        get_pc()
        print_pc()
        pick_core()
        
    if __name__ == "__main__":
    	main()

     

    ok 아래가 결과

    불독으로 대충 만든건데 잘 작동한다.

    각 직업군별로 데이터추가하고, 입력방식도 이미지 선택 등으로 바꾸면 좀 더 그럴듯?해보이긴 할 것같다.

    (나중에 하고싶어지면 그 때 생각해보는걸루...)

     

     

    '일상 > - 메' 카테고리의 다른 글

    메이플 유용한 것 정리  (0) 2022.08.24
Designed by Tistory.