four-pillars 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/four-pillars.rb +61 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cae18ae8469d23ee4f7114902d3bc722621bf2d6b09392968ad8854d4f8676a
|
4
|
+
data.tar.gz: 30ff71bb5aa3e3cdf255fbef1e1d99e76656673cdf49e5a3b2bb8222ebbab576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a83c3eb9bf581259d968063279c1b9c1904f1eb59ab78df5144fbdbda0364d362afd05073287af5b653dbdf021dd8eab021d3a5c5b980f9af8a6edc8078d810
|
7
|
+
data.tar.gz: 251f178751f795ce3d171e3e61cbcaa36155caa4596649478fb373a7ed1ec5183e6dc32ed4c366c36e51bd0ac39099031c11b5c1e602d3d0adb2510d2e418e4a
|
data/lib/four-pillars.rb
CHANGED
@@ -84,6 +84,33 @@ class FourPillarsLogic
|
|
84
84
|
end
|
85
85
|
SETSUIRI_HASH, SETSUIRI_LIST = load_setsuiri
|
86
86
|
|
87
|
+
# 通変星
|
88
|
+
def self.tsuhensei(j_day,j_src) # 日柱の十干、月柱または年柱の十干
|
89
|
+
j = JIKKAN.index(j_day)
|
90
|
+
if j % 2 == 0 # 陽
|
91
|
+
jikkan = JIKKAN
|
92
|
+
else # 陰
|
93
|
+
jikkan = JIKKAN_IN
|
94
|
+
end
|
95
|
+
t = jikkan.index(j_src) - jikkan.index(j_day)
|
96
|
+
t += 10 if t < 0
|
97
|
+
TSUHENSEI[t]
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.jyuniunsei(j_day,j_src) # 日柱の十干, 十二支
|
101
|
+
j = JIKKAN.index(j_day)
|
102
|
+
if j % 2 == 0 # 陽
|
103
|
+
jyunishi = JYUNISHI
|
104
|
+
else # 陰
|
105
|
+
jyunishi = JYUNISHI_IN
|
106
|
+
end
|
107
|
+
offset = [1,7,10,10,10,10,7,1,4,4][j] # 十二運表より求めたオフセット
|
108
|
+
ji = jyunishi.index(j_src)
|
109
|
+
JYUNIUNSEI[(ji + offset) % 12]
|
110
|
+
end
|
111
|
+
|
112
|
+
# TODO エネルギー
|
113
|
+
|
87
114
|
# 生年月日時間, 性別(大運の向きに使用)
|
88
115
|
attr_reader :birth_dt,:gender
|
89
116
|
|
@@ -231,20 +258,9 @@ class FourPillarsLogic
|
|
231
258
|
|
232
259
|
# 通変星(nil,月,年)
|
233
260
|
def tsuhensei
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
else # 陰
|
238
|
-
jikkan = JIKKAN_IN
|
239
|
-
end
|
240
|
-
j = jikkan.index(kanshi[0][0])
|
241
|
-
j_month = jikkan.index(kanshi[1][0])
|
242
|
-
j_year = jikkan.index(kanshi[2][0])
|
243
|
-
t_month = j_month - j
|
244
|
-
t_month += 10 if t_month < 0
|
245
|
-
t_year = j_year - j
|
246
|
-
t_year += 10 if t_year < 0
|
247
|
-
[nil,TSUHENSEI[t_month],TSUHENSEI[t_year]]
|
261
|
+
m = FourPillarsLogic::tsuhensei(kanshi[0][0],kanshi[1][0])
|
262
|
+
y = FourPillarsLogic::tsuhensei(kanshi[0][0],kanshi[2][0])
|
263
|
+
[nil,m,y]
|
248
264
|
end
|
249
265
|
|
250
266
|
# 蔵干通変星
|
@@ -270,20 +286,10 @@ class FourPillarsLogic
|
|
270
286
|
|
271
287
|
# 十二運星
|
272
288
|
def jyuniunsei
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
jyunishi = JYUNISHI_IN
|
278
|
-
end
|
279
|
-
offset = [1,7,10,10,10,10,7,1,4,4][j] # 十二運表より求めたオフセット
|
280
|
-
j_day = jyunishi.index(kanshi[0][1])
|
281
|
-
j_month = jyunishi.index(kanshi[1][1])
|
282
|
-
j_year = jyunishi.index(kanshi[2][1])
|
283
|
-
u_day = (j_day + offset) % 12
|
284
|
-
u_month = (j_month + offset) % 12
|
285
|
-
u_year = (j_year + offset) % 12
|
286
|
-
[JYUNIUNSEI[u_day],JYUNIUNSEI[u_month],JYUNIUNSEI[u_year]]
|
289
|
+
d = FourPillarsLogic::jyuniunsei(kanshi[0][0],kanshi[0][1])
|
290
|
+
m = FourPillarsLogic::jyuniunsei(kanshi[0][0],kanshi[1][1])
|
291
|
+
y = FourPillarsLogic::jyuniunsei(kanshi[0][0],kanshi[2][1])
|
292
|
+
[d,m,y]
|
287
293
|
end
|
288
294
|
|
289
295
|
def jyuniunsei_energy
|
@@ -457,6 +463,33 @@ class FourPillarsLogic
|
|
457
463
|
end
|
458
464
|
return [order,year]
|
459
465
|
end
|
466
|
+
|
467
|
+
def taiun_table
|
468
|
+
order,year = taiun
|
469
|
+
return [] if order.nil?
|
470
|
+
d = order == '順行' ? 1 : -1
|
471
|
+
j_day = kanshi[0][0] # 日柱の十干
|
472
|
+
k = kanshi_as_number[1] - 1 # 月柱の干支番号
|
473
|
+
rows = []
|
474
|
+
# [0,1,"癸亥","偏印","死",2]
|
475
|
+
y1, y2 = 0, year
|
476
|
+
8.times do |i|
|
477
|
+
k_month = KANSHI_ARRAY[k] # 月柱の干支
|
478
|
+
t = FourPillarsLogic::tsuhensei(j_day,k_month[0])
|
479
|
+
j = FourPillarsLogic::jyuniunsei(j_day,k_month[1])
|
480
|
+
je = JYUNIUNSEI_ENERGY[j]
|
481
|
+
rows += [[y1,y2,k_month,t,j,je]]
|
482
|
+
if y1 == 0
|
483
|
+
y1 = year
|
484
|
+
else
|
485
|
+
y1 += 10
|
486
|
+
end
|
487
|
+
y2 += 10
|
488
|
+
k += d
|
489
|
+
k = 0 if k < 0 || 59 < k
|
490
|
+
end
|
491
|
+
return rows
|
492
|
+
end
|
460
493
|
end
|
461
494
|
|
462
495
|
if __FILE__ == $0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: four-pillars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yosei Ito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A class which tells fortune by Four Pillar astrology(四柱推命).
|
14
14
|
email: y-itou@lumber-mill.co.jp
|