iching 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/iching.gemspec +1 -1
- data/lib/dictionaries.rb +1 -20
- data/lib/iching.rb +45 -25
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cff67291520838e0821b0e0648424d8beba77a291a64ee051753a5883b39418a
|
4
|
+
data.tar.gz: da51e48699b6ab49bd6ec874672d4b23e7aa46f6215ce6e1ec9323fe6adb3de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d5bbebbd7b3195f58554c1bdb5e3d8ac3f70fa5507990585e0c29872b5621b51ffe179d8c6b5a20b9bf437daf9ff3cbe7a94eed277f533a6dfe61cd7218639e
|
7
|
+
data.tar.gz: 24d2b091dbd5af5bc0b27e7aaed93cb9b47586e4c69ffe7657bb4bf8cac6c6c5ca664755c2cf77553f030685205a2c8c852145d94a7d793b1d08661b4fbff0ad
|
data/iching.gemspec
CHANGED
data/lib/dictionaries.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
module Dictionaries
|
3
|
-
|
4
|
-
6.times.map{ Random.new.rand(6..9) }.reverse
|
5
|
-
end
|
6
|
-
|
3
|
+
|
7
4
|
def list
|
8
5
|
{ '111111'=> '1. Force (乾 qián); The Creative; Possessing Creative Power & Skill',
|
9
6
|
'000000'=> '2. Field (坤 kūn); The Receptive; Needing Knowledge & Skill; Do not force matters and go with the flow',
|
@@ -70,20 +67,4 @@ module Dictionaries
|
|
70
67
|
'101010'=> '63. Already_Fording (既濟 jì jì); After Completion; Completion',
|
71
68
|
'010101'=> '64. Not-Yet Fording (未濟 wèi jì); Before Completion; Incompletion'}
|
72
69
|
end
|
73
|
-
|
74
|
-
def hexagram1_key
|
75
|
-
{ 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'}
|
76
|
-
end
|
77
|
-
|
78
|
-
def hexagram2_key
|
79
|
-
{ 6 => '-----', 7 => '-----', 8 => '-- --', 9 => '-- --'}
|
80
|
-
end
|
81
|
-
|
82
|
-
def binhex1_key
|
83
|
-
{ 6 => '0', 7 => '1', 8 => '0', 9 => '1'}
|
84
|
-
end
|
85
|
-
|
86
|
-
def binhex2_key
|
87
|
-
{ 6 => '1', 7 => '1', 8 => '0', 9 => '0'}
|
88
|
-
end
|
89
70
|
end
|
data/lib/iching.rb
CHANGED
@@ -2,32 +2,52 @@
|
|
2
2
|
require 'dictionaries.rb'
|
3
3
|
|
4
4
|
class Iching
|
5
|
-
|
5
|
+
def hex
|
6
|
+
@hex ||= 6.times.map{ Random.new.rand(6..9) }.reverse
|
7
|
+
end
|
6
8
|
|
7
9
|
def display
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
10
|
+
# puts "A suffusion of yellow." && return if Random.new.rand(1..20) <= 1
|
11
|
+
hex1 = Hex1.new(hex)
|
12
|
+
hex2 = Hex2.new(hex)
|
13
|
+
puts hex1.hex_symbol, hex1.hex_name, hex2.hex_symbol, hex2.hex_name
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Hex1
|
19
|
+
include ::Dictionaries
|
20
|
+
|
21
|
+
attr_reader :hex
|
22
|
+
|
23
|
+
def initialize(hex)
|
24
|
+
@hex = hex
|
25
|
+
end
|
26
|
+
|
27
|
+
def bin_hex_key
|
28
|
+
{ 6 => '0', 7 => '1', 8 => '0', 9 => '1'}
|
29
|
+
end
|
30
|
+
|
31
|
+
def hexagram_key
|
32
|
+
{ 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'}
|
33
|
+
end
|
34
|
+
|
35
|
+
def hex_symbol
|
36
|
+
hex.map{|n| hexagram_key[n] }.join("\n")
|
37
|
+
end
|
38
|
+
|
39
|
+
def hex_name
|
40
|
+
hex_binary = hex.map{|n| bin_hex_key[n]}.join("").reverse()
|
41
|
+
return list[hex_binary]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Hex2 < Hex1
|
46
|
+
def bin_hex_key
|
47
|
+
{ 6 => '1', 7 => '1', 8 => '0', 9 => '0'}
|
48
|
+
end
|
49
|
+
|
50
|
+
def hexagram_key
|
51
|
+
{ 6 => '-----', 7 => '-----', 8 => '-- --', 9 => '-- --'}
|
32
52
|
end
|
33
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Mills
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generate an Iching hexagram and access various things about it.
|
14
14
|
email:
|
@@ -29,7 +29,7 @@ homepage: http://github.com/mattmills/iching
|
|
29
29
|
licenses:
|
30
30
|
- MIT
|
31
31
|
metadata: {}
|
32
|
-
post_install_message:
|
32
|
+
post_install_message:
|
33
33
|
rdoc_options: []
|
34
34
|
require_paths:
|
35
35
|
- lib
|
@@ -44,8 +44,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
|
-
rubygems_version: 3.
|
48
|
-
signing_key:
|
47
|
+
rubygems_version: 3.2.3
|
48
|
+
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: tell the future (but not really)
|
51
51
|
test_files: []
|