iching 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/iching.gemspec +10 -28
- data/lib/dictionaries.rb +24 -0
- data/lib/iching.rb +12 -14
- metadata +25 -30
- data/Manifest +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f9a82f761e76081b0956689942a5f39ac038b11
|
4
|
+
data.tar.gz: 9ed06448fb9f9451de1251006dc2d0139786b0ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a7be777ab09c1edccea54366f8823fe0a58cfd3d8e45572ccf1813d22b28c19b2c5f3c82319916098f75dbd0ede467a444a957a3640aea6d46c2cccc0717e3b
|
7
|
+
data.tar.gz: 2aac42a7e49b475204ba8f6d65e45e9f92a5a057c7b29003df924c57d488d6adf696d6dfa185582fec10272f930763871c58dbef0c08f4a4d5ff4ea5209028db
|
data/.gitignore
ADDED
data/iching.gemspec
CHANGED
@@ -1,33 +1,15 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
2
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
6
|
-
|
7
|
-
s.
|
8
|
-
s.
|
9
|
-
s.
|
3
|
+
s.name = "iching"
|
4
|
+
s.version = "0.1.1"
|
5
|
+
s.platform = Gem::Platform::RUBY
|
6
|
+
s.authors = ["Matt Mills"]
|
7
|
+
s.email = ["sunrisetimes@gmail.com"]
|
8
|
+
s.homepage = "http://github.com/mattmills/iching"
|
9
|
+
s.summary = "tell the future (but not really)"
|
10
10
|
s.description = "Generate an Iching hexagram and access various things about it."
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.files = ["Rakefile", "bin/iching", "lib/iching.rb", "readme.markdown", "Manifest", "iching.gemspec"]
|
15
|
-
s.homepage = "https://github.com/mattmills/iching"
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Iching", "--main", "readme.markdown"]
|
11
|
+
s.add_runtime_dependency "backports"
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
14
|
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = "iching"
|
19
|
-
s.rubygems_version = "1.8.10"
|
20
|
-
s.summary = "Generate an Iching hexagram and access various things about it."
|
21
|
-
|
22
|
-
if s.respond_to? :specification_version then
|
23
|
-
s.specification_version = 3
|
24
|
-
|
25
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<backports>, [">= 0"])
|
27
|
-
else
|
28
|
-
s.add_dependency(%q<backports>, [">= 0"])
|
29
|
-
end
|
30
|
-
else
|
31
|
-
s.add_dependency(%q<backports>, [">= 0"])
|
32
|
-
end
|
33
15
|
end
|
data/lib/dictionaries.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Dictionaries
|
2
|
+
|
3
|
+
def hex
|
4
|
+
6.times.map{ Random.new.rand(6..9) }.reverse
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
{'111111'=> '1. Force (乾 qián); The Creative; Possessing Creative Power & Skill','000000'=> '2. Field (坤 kūn); The Receptive; Needing Knowledge & Skill; Do not force matters and go with the flow','100010'=> '3. Sprouting (屯 zhūn); Difficulty at the Beginning,; Sprouting ','010001'=> '4. Enveloping (蒙 méng); Youthful Folly; Detained,Enveloped and Inexperienced','111010'=> '5. Attending (需 xū); Waiting; Uninvolvement (Wait for now),Nourishment ','010111'=> '6. Arguing (訟 sòng); Conflict; Engagement in Conflict ','010000'=> '7. Leading (師 shī); The Army; Bringing Together,Teamwork ','000010'=> '8. Grouping (比 bǐ); Holding Together; Union ','111011'=> '9. Small Accumulating (小畜 xiǎo chù); Small Taming; Accumulating Resources','110111'=> '10. Treading (履 lǚ); Treading (Conduct); Continuing with Alertness','111000'=> '11. Pervading (泰 tài); Peace; Pervading','000111'=> '12. Obstruction (否 pǐ); Standstill; Stagnation','101111'=> '13. Concording People (同人 tóng rén); Fellowship; Fellowship,Partnership','111101'=> '14. Great Possessing (大有 dà yǒu); Great Possession; Independence,Freedom','001000'=> '15. Humbling (謙 qiān); Modesty; Being Reserved,Refraining','000100'=> '16. Providing-For (豫 yù); Enthusiasm; Inducement,New Stimulus','100110'=> '17. Following (隨 suí); Following; Following','011001'=> '18. Corrupting (蠱 gǔ); Work on the Decayed; Repairing','110000'=> '19. Nearing (臨 lín); Approach; Approaching Goal,Arriving ','000011'=> '20. Viewing (觀 guān); Contemplation; The Withholding','100101'=> '21. Gnawing Bite (噬嗑 shì kè); Biting Through; Deciding','101001'=> '22. Adorning (賁 bì); Grace; Embellishing','000001'=> '23. Stripping (剝 bō); Splitting Apart; Stripping,Flaying','100000'=> '24. Returning (復 fù); Return; Returning','100111'=> '25. Without Embroiling (無妄 wú wàng); Innocence; Without Rashness','111001'=> '26. Great Accumulating (大畜 dà chù); Great Taming; Accumulating Wisdom','100001'=> '27. Swallowing (頤 yí); Mouth Corners; Seeking Nourishment','011110'=> '28. Great Exceeding (大過 dà guò); Great Preponderance; Great Surpassing','010010'=> '29. Gorge (坎 kǎn); The Abysmal Water; Darkness,Gorge','101101'=> '30. Radiance (離 lí); The Clinging; Clinging,Attachment','001110'=> '31. Conjoining (咸 xián); Influence; Attraction','011100'=> '32. Persevering (恆 héng); Duration; Perseverance','001111'=> '33. Retiring (遯 dùn); Retreat; Withdrawing','111100'=> '34. Great Invigorating (大壯 dà zhuàng); Great Power; Great Boldness','000101'=> '35. Prospering (晉 jìn); Progress; Expansion,Promotion','101000'=> '36. Brightness Hiding (明夷 míng yí); Darkening of the Light; Brilliance Injured','101011'=> '37. Dwelling People (家人 jiā rén); The Family; Family','110101'=> '38. Polarising (睽 kuí); Opposition; Division,Divergence','001010'=> '39. Limping (蹇 jiǎn); Obstruction; Halting,Hardship','010100'=> '40. Taking-Apart (解 xiè); Deliverance; Liberation,Solution','110001'=> '41. Diminishing (損 sǔn); Decrease; Decrease','100011'=> '42. Augmenting (益 yì); Increase; Increase','111110'=> '43. Parting (夬 guài); Breakthrough; Separation','011111'=> '44. Coupling (姤 gòu); Coming to Meet; Encountering','000110'=> '45. Clustering (萃 cuì); Gathering Together; Association,Companionship','011000'=> '46. Ascending (升 shēng); Pushing Upward; Growing Upward','010110'=> '47. Confining (困 kùn); Oppression; Exhaustion','011010'=> '48. Welling (井 jǐng); The Well; Replenishing,Renewal','101110'=> '49. Skinning (革 gé); Revolution; Abolishing the Old','011101'=> '50. Holding (鼎 dǐng); The Cauldron; Establishing the New','100100'=> '51. Shake (震 zhèn); Arousing; Mobilizing','001001'=> '52. Bound (艮 gèn); The Keeping Still; Immobility','001011'=> '53. Infiltrating (漸 jiàn); Development; Auspicious Outlook,Infiltration','110100'=> '54. Converting The Maiden (歸妹 guī mèi); The Marrying Maiden; Marrying','101100'=> '55. Abounding (豐 fēng); Abundance; Goal Reached,Ambition Achieved','001101'=> '56. Sojourning (旅 lǚ); The Wanderer; Travel','011011'=> '57. Ground (巽 xùn); The Gentle; Subtle Influence','110110'=> '58. Open (兌 duì); The Joyous; Overt Influence','010011'=> '59. Dispersing (渙 huàn); Dispersion; Dispersal','110010'=> '60. Articulating (節 jié); Limitation; Discipline','110011'=> '61. Centre Confirming (中孚 zhōng fú); Inner Truth; Staying Focused,Avoid Misrepresentation','001100'=> '62. Small Exceeding (小過 xiǎo guò); Small Preponderance; Small Surpassing','101010'=> '63. Already_Fording (既濟 jì jì); After Completion; Completion','010101'=> '64. Not-Yet Fording (未濟 wèi jì); Before Completion; Incompletion'}
|
9
|
+
end
|
10
|
+
def hexagram1_key
|
11
|
+
{ 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'}
|
12
|
+
end
|
13
|
+
|
14
|
+
def hexagram2_key
|
15
|
+
{ 6 => '-----', 7 => '-----', 8 => '-- --', 9 => '-- --'}
|
16
|
+
end
|
17
|
+
|
18
|
+
def binhex1_key
|
19
|
+
{ 6 => '0', 7 => '1', 8 => '0', 9 => '1'}
|
20
|
+
end
|
21
|
+
|
22
|
+
def binhex2_key
|
23
|
+
{ 6 => '1', 7 => '1', 8 => '0', 9 => '0'}
|
24
|
+
end
|
data/lib/iching.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
require 'rubygems'
|
4
|
+
require 'dictionaries.rb'
|
4
5
|
|
5
6
|
#ruby version compatibility hax
|
6
7
|
unless RUBY_VERSION.gsub(".","").to_i > 190
|
@@ -9,14 +10,8 @@ end
|
|
9
10
|
|
10
11
|
|
11
12
|
class Iching
|
12
|
-
|
13
|
-
|
14
|
-
@list = {'111111'=> '1. Force (乾 qián); The Creative; Possessing Creative Power & Skill','000000'=> '2. Field (坤 kūn); The Receptive; Needing Knowledge & Skill; Do not force matters and go with the flow','100010'=> '3. Sprouting (屯 zhūn); Difficulty at the Beginning,; Sprouting ','010001'=> '4. Enveloping (蒙 méng); Youthful Folly; Detained,Enveloped and Inexperienced','111010'=> '5. Attending (需 xū); Waiting; Uninvolvement (Wait for now),Nourishment ','010111'=> '6. Arguing (訟 sòng); Conflict; Engagement in Conflict ','010000'=> '7. Leading (師 shī); The Army; Bringing Together,Teamwork ','000010'=> '8. Grouping (比 bǐ); Holding Together; Union ','111011'=> '9. Small Accumulating (小畜 xiǎo chù); Small Taming; Accumulating Resources','110111'=> '10. Treading (履 lǚ); Treading (Conduct); Continuing with Alertness','111000'=> '11. Pervading (泰 tài); Peace; Pervading','000111'=> '12. Obstruction (否 pǐ); Standstill; Stagnation','101111'=> '13. Concording People (同人 tóng rén); Fellowship; Fellowship,Partnership','111101'=> '14. Great Possessing (大有 dà yǒu); Great Possession; Independence,Freedom','001000'=> '15. Humbling (謙 qiān); Modesty; Being Reserved,Refraining','000100'=> '16. Providing-For (豫 yù); Enthusiasm; Inducement,New Stimulus','100110'=> '17. Following (隨 suí); Following; Following','011001'=> '18. Corrupting (蠱 gǔ); Work on the Decayed; Repairing','110000'=> '19. Nearing (臨 lín); Approach; Approaching Goal,Arriving ','000011'=> '20. Viewing (觀 guān); Contemplation; The Withholding','100101'=> '21. Gnawing Bite (噬嗑 shì kè); Biting Through; Deciding','101001'=> '22. Adorning (賁 bì); Grace; Embellishing','000001'=> '23. Stripping (剝 bō); Splitting Apart; Stripping,Flaying','100000'=> '24. Returning (復 fù); Return; Returning','100111'=> '25. Without Embroiling (無妄 wú wàng); Innocence; Without Rashness','111001'=> '26. Great Accumulating (大畜 dà chù); Great Taming; Accumulating Wisdom','100001'=> '27. Swallowing (頤 yí); Mouth Corners; Seeking Nourishment','011110'=> '28. Great Exceeding (大過 dà guò); Great Preponderance; Great Surpassing','010010'=> '29. Gorge (坎 kǎn); The Abysmal Water; Darkness,Gorge','101101'=> '30. Radiance (離 lí); The Clinging; Clinging,Attachment','001110'=> '31. Conjoining (咸 xián); Influence; Attraction','011100'=> '32. Persevering (恆 héng); Duration; Perseverance','001111'=> '33. Retiring (遯 dùn); Retreat; Withdrawing','111100'=> '34. Great Invigorating (大壯 dà zhuàng); Great Power; Great Boldness','000101'=> '35. Prospering (晉 jìn); Progress; Expansion,Promotion','101000'=> '36. Brightness Hiding (明夷 míng yí); Darkening of the Light; Brilliance Injured','101011'=> '37. Dwelling People (家人 jiā rén); The Family; Family','110101'=> '38. Polarising (睽 kuí); Opposition; Division,Divergence','001010'=> '39. Limping (蹇 jiǎn); Obstruction; Halting,Hardship','010100'=> '40. Taking-Apart (解 xiè); Deliverance; Liberation,Solution','110001'=> '41. Diminishing (損 sǔn); Decrease; Decrease','100011'=> '42. Augmenting (益 yì); Increase; Increase','111110'=> '43. Parting (夬 guài); Breakthrough; Separation','011111'=> '44. Coupling (姤 gòu); Coming to Meet; Encountering','000110'=> '45. Clustering (萃 cuì); Gathering Together; Association,Companionship','011000'=> '46. Ascending (升 shēng); Pushing Upward; Growing Upward','010110'=> '47. Confining (困 kùn); Oppression; Exhaustion','011010'=> '48. Welling (井 jǐng); The Well; Replenishing,Renewal','101110'=> '49. Skinning (革 gé); Revolution; Abolishing the Old','011101'=> '50. Holding (鼎 dǐng); The Cauldron; Establishing the New','100100'=> '51. Shake (震 zhèn); Arousing; Mobilizing','001001'=> '52. Bound (艮 gèn); The Keeping Still; Immobility','001011'=> '53. Infiltrating (漸 jiàn); Development; Auspicious Outlook,Infiltration','110100'=> '54. Converting The Maiden (歸妹 guī mèi); The Marrying Maiden; Marrying','101100'=> '55. Abounding (豐 fēng); Abundance; Goal Reached,Ambition Achieved','001101'=> '56. Sojourning (旅 lǚ); The Wanderer; Travel','011011'=> '57. Ground (巽 xùn); The Gentle; Subtle Influence','110110'=> '58. Open (兌 duì); The Joyous; Overt Influence','010011'=> '59. Dispersing (渙 huàn); Dispersion; Dispersal','110010'=> '60. Articulating (節 jié); Limitation; Discipline','110011'=> '61. Centre Confirming (中孚 zhōng fú); Inner Truth; Staying Focused,Avoid Misrepresentation','001100'=> '62. Small Exceeding (小過 xiǎo guò); Small Preponderance; Small Surpassing','101010'=> '63. Already_Fording (既濟 jì jì); After Completion; Completion','010101'=> '64. Not-Yet Fording (未濟 wèi jì); Before Completion; Incompletion'}
|
15
|
-
@hexagram1_key = { 6 => '-- --', 7 => '-----', 8 => '-- --', 9 => '-----'}
|
16
|
-
@hexagram2_key = { 6 => '-----', 7 => '-----', 8 => '-- --', 9 => '-- --'}
|
17
|
-
@binhex1_key = { 6 => '0', 7 => '1', 8 => '0', 9 => '1'}
|
18
|
-
@binhex2_key = { 6 => '1', 7 => '1', 8 => '0', 9 => '0'}
|
19
|
-
end
|
13
|
+
include Dictionaries
|
14
|
+
|
20
15
|
def display
|
21
16
|
if Random.new.rand(1..20) > 1
|
22
17
|
puts hex_symbol, hex_name, hex_symbol(1), hex_name(1)
|
@@ -24,25 +19,28 @@ class Iching
|
|
24
19
|
puts "A suffusion of yellow."
|
25
20
|
end
|
26
21
|
end
|
22
|
+
|
27
23
|
def hex_name(hex = 0)
|
28
24
|
bin_hex = ''
|
29
25
|
if hex == 0
|
30
|
-
|
26
|
+
hex.each {|stick| bin_hex << binhex1_key[stick]}
|
31
27
|
end
|
32
28
|
if hex == 1
|
33
|
-
|
29
|
+
hex.each {|stick| bin_hex << binhex2_key[stick]}
|
34
30
|
end
|
35
31
|
bin_hex.reverse!
|
36
|
-
return
|
32
|
+
return list[bin_hex]
|
37
33
|
end
|
34
|
+
|
38
35
|
def hex_symbol(hex = 0)
|
39
36
|
symbol = ''
|
40
37
|
if hex == 0
|
41
|
-
|
38
|
+
hex.each {|stick| symbol << hexagram1_key[stick] + "\n"}
|
42
39
|
end
|
43
40
|
if hex == 1
|
44
|
-
|
41
|
+
hex.each {|stick| symbol << hexagram2_key[stick] + "\n"}
|
45
42
|
end
|
46
43
|
return symbol
|
47
44
|
end
|
48
|
-
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,70 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Matt Mills
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: backports
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
description: Generate an Iching hexagram and access various things about it.
|
26
|
-
email:
|
28
|
+
email:
|
29
|
+
- sunrisetimes@gmail.com
|
27
30
|
executables:
|
28
31
|
- iching
|
29
32
|
extensions: []
|
30
|
-
extra_rdoc_files:
|
31
|
-
- bin/iching
|
32
|
-
- lib/iching.rb
|
33
|
+
extra_rdoc_files: []
|
33
34
|
files:
|
35
|
+
- .gitignore
|
34
36
|
- Rakefile
|
35
37
|
- bin/iching
|
38
|
+
- iching.gemspec
|
39
|
+
- lib/dictionaries.rb
|
36
40
|
- lib/iching.rb
|
37
41
|
- readme.markdown
|
38
|
-
|
39
|
-
- iching.gemspec
|
40
|
-
homepage: https://github.com/mattmills/iching
|
42
|
+
homepage: http://github.com/mattmills/iching
|
41
43
|
licenses: []
|
44
|
+
metadata: {}
|
42
45
|
post_install_message:
|
43
|
-
rdoc_options:
|
44
|
-
- --line-numbers
|
45
|
-
- --inline-source
|
46
|
-
- --title
|
47
|
-
- Iching
|
48
|
-
- --main
|
49
|
-
- readme.markdown
|
46
|
+
rdoc_options: []
|
50
47
|
require_paths:
|
51
48
|
- lib
|
52
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
50
|
requirements:
|
55
|
-
- -
|
51
|
+
- - '>='
|
56
52
|
- !ruby/object:Gem::Version
|
57
53
|
version: '0'
|
58
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
55
|
requirements:
|
61
|
-
- -
|
56
|
+
- - '>='
|
62
57
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
58
|
+
version: '0'
|
64
59
|
requirements: []
|
65
|
-
rubyforge_project:
|
66
|
-
rubygems_version:
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.0.3
|
67
62
|
signing_key:
|
68
|
-
specification_version:
|
69
|
-
summary:
|
63
|
+
specification_version: 4
|
64
|
+
summary: tell the future (but not really)
|
70
65
|
test_files: []
|