在基于《易经》的占卜中,无论是八字、六壬、奇门,小至梅花,六爻,都需要用到旺衰。所谓旺衰,即一个五行在不同季节的不同状态:
在春天,木火旺,其他五行衰;
在夏天,火土旺,其他五行衰;
在秋天,金水旺,其他五行衰;
在冬天,水木旺,其他五行衰;
因为季节是和节气相关的,那么我们首先应该先确定当下时间的节气,我们把节气建立成一个列表。
__Li = [19600205, 19600505, 19600807, 19601107, 19610204, 19610506, 19610808, 19611107, 19620204, 19620506,
19620808, 19621108, 19630204, 19630506, 19630808, 19631108, 19640205, 19640505, 19640807, 19641107,
19650204, 19650506, 19650808, 19651107, 19660204, 19660506, 19660808, 19661108, 19670204, 19670506,
19670808, 19671108, 19680205, 19680505, 19680807, 19681107, 19690204, 19690506, 19690808, 19691107,
19700204, 19700506, 19700808, 19701108, 19710204, 19710506, 19710808, 19711108, 19720205, 19720505,
19720807, 19721107, 19730204, 19730505, 19730808, 19731107, 19740204, 19740506, 19740808, 19741108,
19750204, 19750506, 19750808, 19751108, 19760205, 19760505, 19760807, 19761107, 19770204, 19770505,
19770807, 19771107, 19780204, 19780506, 19780808, 19781108, 19790204, 19790506, 19790808, 19791108,
19800205, 19800505, 19800807, 19801107, 19810204, 19810505, 19810807, 19811107, 19820204, 19820506,
19820808, 19821108, 19830204, 19830506, 19830808, 19831108, 19840204, 19840505, 19840807, 19841107,
19850204, 19850505, 19850807, 19851107, 19860204, 19860506, 19860808, 19861108, 19870204, 19870506,
19870808, 19871108, 19880204, 19880505, 19880807, 19881107, 19890204, 19890505, 19890807, 19891107,
19900204, 19900506, 19900808, 19901108, 19910204, 19910506, 19910808, 19911108, 19920204, 19920505,
19920807, 19921107, 19930204, 19930505, 19930807, 19931107, 19940204, 19940506, 19940808, 19941107,
19950204, 19950506, 19950808, 19951108, 19960204, 19960505, 19960807, 19961107, 19970204, 19970505,
19970807, 19971107, 19980204, 19980506, 19980808, 19981107, 19990204, 19990506, 19990808, 19991108,
20000204, 20000505, 20000807, 20001107, 20010204, 20010505, 20010807, 20011107, 20020204, 20020506,
20020808, 20021107, 20030204, 20030506, 20030808, 20031108, 20040204, 20040505, 20040807, 20041107,
20050204, 20050505, 20050807, 20051107, 20060204, 20060505, 20060807, 20061107, 20070204, 20070506,
20070808, 20071108, 20080204, 20080505, 20080807, 20081107, 20090204, 20090505, 20090807, 20091107,
20100204, 20100505, 20100807, 20101107, 20110204, 20110506, 20110808, 20111108, 20120204, 20120505,
20120807, 20121107, 20130204, 20130505, 20130807, 20131107, 20140204, 20140505, 20140807, 20141107,
20150204, 20150506, 20150808, 20151108, 20160204, 20160505, 20160807, 20161107, 20170203, 20170505,
20170807, 20171107, 20180204, 20180505, 20180807, 20181107, 20190204, 20190506, 20190808, 20191108,
20200204, 20200505, 20200807, 20201107, 20210203, 20210505, 20210807, 20211107, 20220204, 20220505,
20220807, 20221107, 20230204, 20230506, 20230808, 20231108, 20240204, 20240505, 20240807, 20241107,
20250203, 20250505, 20250807, 20251107, 20260204, 20260505, 20260807, 20261107, 20270204, 20270506,
20270808, 20271107, 20280204, 20280505, 20280807, 20281107, 20290203, 20290505, 20290807, 20291107,
20300204, 20300505, 20300807, 20301107] #1960到2030年的立春立夏立冬立秋,一共284个
节气有了,我们首先要做的就是计算出当下时间所对应季节:
self.celander = self.year * 10000 + self.month * 100 + self.day
if self.celander in self.__Li:
self.celander = self.celander + 1
self.int_celander = int(self.celander)
self.__Li.append(self.int_celander)
self.__Li.sort()
self.result = int(self.__Li.index(self.int_celander))
self.final_result = self.result % 4
self.__Li.remove(self.int_celander)
if self.final_result == 0:
return None
# return self.__Jijie[self.final_result]
return self.__Jijie[self.final_result]
即将输入的时间放置在列表中,并通过list.index来求出这个季节所在列表的位置。得到位置后,除以4取余,即是所在的季节。
季节有了,旺衰就很好求了。
def Judge_WangShuai(self, *args): # 各季节中五行的旺衰
self.season = self.__LeiXiang[self.final_result]
# print(self.season)
self.args = args
for self.item in self.args:
if self.item in self.season:
self.qiang.append(self.item)
else:
self.ruo.append(self.item)
return (self.qiang, self.ruo)