Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: 六仪击刑,入墓,伏吟、天显时格、五不遇时、宫迫 #44

Open
jackygu2006 opened this issue May 19, 2024 · 1 comment

Comments

@jackygu2006
Copy link

Hey, guys,

我添加了六仪击刑,入墓,伏吟、天显时格、五不遇时、宫迫等功能,请review下,看是否能合并到你的代码中,我的代码如下,在kinqimen.py中:

    #六仪擊刑 
    def jixing(self, sky):
        jixing_mapping = {"庚":"艮","戊":"震","癸":"巽","壬":"巽","辛":"离","己":"坤"}
        result = {}
        for gong, gan in sky.items():
            if gan in jixing_mapping and gong == jixing_mapping[gan]:
                result[gan] = gong
        return result

		#入墓
    def rumu(self, sky, earth):
        rumu_mapping = {"乙":"坤","癸":"坤","乙":"乾","丙":"乾","戊":"乾","辛":"巽","壬":"巽","丁":"艮","己":"艮","庚":"艮"}
        result = {}
        for gong, gan in sky.items():
            if gan in rumu_mapping and gong == rumu_mapping[gan]:
                result[gan] = gong
        for gong, gan in earth.items():
            if gan in rumu_mapping and gong == rumu_mapping[gan]:
                result[gan] = gong
        return result

    # 伏吟    
    def fuying(self, star, door):
        result = {}
        if door['坎'] == '休':
            result['门伏吟'] = 1
        elif door['坎'] == '景':
            result['门反伏吟'] = 1

        if star['坎'] == '蓬':
            result['星伏吟'] = 1
        elif star['坎'] == '英':
            result['星反伏吟'] = 1
        
        return result
        
    # 天显时格
    def tianxian(self, gz):
      ri = gz[2]
      shi = gz[3]
      mapping = {'甲':['甲子','甲戌'],'乙':['甲申'],'丙':['甲午'],'丁':['甲辰'],'戊':['甲寅'],'己':['甲子','甲戌'],'庚':['甲申'],'辛':['甲午'],'壬':['甲辰'],'癸':['甲寅']}
      if shi in mapping[ri[0]]:
        return 1
      else:
        return 0

    # 五不遇时
    def wubuyushi(self, gz):
      ri = gz[2]
      shi = gz[3]
      mapping = {'甲':'庚午','乙':'辛巳','丙':'壬辰','丁':'癸卯','戊':'甲寅','己':'乙丑','庚':'丙子','辛':'丁酉','壬':'戊申','癸':'己未'}
      if mapping[ri[0]] == shi:
        return 1
      else:
        return 0
    
    # 宫迫 
    def gongpo(self, doors):
      gongpo = {}
      menpo = {}
      for gong, door in doors.items():
        doorWuxing = config.doorWuxing[door]
        gongWuxing = config.gongWuxing[gong]
        # print(gong, door, gongWuxing, doorWuxing)
        if doorWuxing[1] == gongWuxing[0]:
          gongpo[gong] = door
        if gongWuxing[1] == doorWuxing[0]:
          menpo[gong] = door
      return {"宫迫": gongpo, "门迫": menpo}
      
@kentang2017
Copy link
Owner

謝謝建議, 需要再做修改才能放進去

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants