算命源码(算命小程序源码)PHP

浏览:138 发布日期:2022/11/08 分类:ThinkPHP6专区 关键字: PHP
  对易经论者而言,八卦和六十四卦生动地描绘了宇宙的展开。例如,他们将 8 个三元组视为阴阳宇宙力量混合的图形表示。用直线(—)代表阳宇宙力和虚线(--)代表阴的不同组合宇宙力,三卦象征着宇宙的不断更新和万物的创造。同样,六角星也是宇宙展开的象征。
  
  源码:m.appwin.top
  
  算命源码功能:
  
  所有生成的卦的名称和基本描述。
  
  轻松确定给定卦的核卦。
  
  轻松确定一个卦是否在移动,获得移动的线条,或生成变化的卦。
  
  将一个六角形渲染为一个字符串。
  
  待办事项:
  
  进一步测试、优化、美化。
  
  算命源码简介:
  
  铸造卦象很容易:
  
  require 'iching'
  
  cast = IChing::Cast.new
  
  cast.hexagrams.each do | hexagram |
  
  puts
  
  puts hexagram.to_s
  
  puts hexagram.description[:name]
  
  hexagram.moving_lines.each { | line | puts "Lines #{ line }" }
  
  End
  
  输出示例:
  
  -------
  
  -------
  
  --- ---
  
  -------
  
  ---x---
  
  --- ---
  
  Chien
  
  Lines 2
  
  -------
  
  -------
  
  --- ---
  
  -------
  
  -------
  
  --- ---
  
  Sun
  
  施卦后,您可以查询卦以了解详细信息:
  
  cast = IChing::Cast.new
  
  hexagram = cast.hexagrams.first
  
  puts hexagram.to_s
  
  -------
  
  -------
  
  --- ---
  
  -------
  
  ---x---
  
  --- ---
  
  puts hexagram.description[:name]
  
  Chien
  
  puts hexagram.moving_lines
  
  2
  
  puts hexagram.signature.to_s
  
  001011
  
  puts hexagram.top_trigram.to_s
  
  -------
  
  -------
  
  --- ---
  
  puts hexagram.top_trigram.description[:name]
  
  Sun
  
  puts hexagram.top_trigram.signature.to_s
  
  001
  
  puts hexagram.bottom_trigram.to_s
  
  -------
  
  --- ---
  
  --- ---
  
  puts hexagram.bottom_trigram.description[:name]
  
  Ken
  
  puts hexagram.bottom_trigram.signature.to_s
  
  011
  
  test.rb
  
  # Code Generated by ZenTest v. 3.10.0
  
  # classname: asrt / meth = ratio%
  
  # IChing::Hexagram: 0 / 10 = 0.00%
  
  # IChing::Trigram: 0 / 4 = 0.00%
  
  # IChing::Cast: 0 / 5 = 0.00%
  
  require 'test/unit' unless defined? $ZENTEST and $ZENTEST
  
  require 'iching'
  
  module TestIChing
  
  class TestCast < Test::Unit::TestCase
  
  def setup
  
[email protected] = IChing::Cast.new
  
  end
  
  def test_cast
  
  temp = @c.cast
  
  assert_equal( IChing::Hexagram, temp[0].class )
  
  end
  
  def test_cast_line
  
  temp = @c.cast_line
  
  assert [ 9, 7, 6, 8 ].include?( temp )
  
  end
  
  def test_divide
  
  temp = @c.divide( 49 )
  
  assert [ 2, 3 ].include?( temp[1] )
  
  end
  
  def test_hexagrams
  
  assert @c.respond_to? :hexagrams
  
  end
  
  def test_remainder
  
  (41 .. 44).each do | i |
  
  difference = i - 40
  
  assert_equal( difference, @c.remainder( i ) )
  
  end
  
  end
  
  end
  
  end
  
  module TestIChing
  
  class TestHexagram < Test::Unit::TestCase
  
  def setup
  
[email protected] = IChing::Hexagram.new()
  
  setup_lines()
  
  end
  
  def setup_line( moving = true, type = IChing::YIN )
  
[email protected] << { :moving => moving, :type => type }
  
  end
  
  def setup_lines
  
  setup_line( true )
  
  setup_line( false )
  
  setup_line( true )
  
  setup_line( false, IChing::YANG )
  
  setup_line( false, IChing::YANG )
  
  setup_line( false, IChing::YANG )
  
  end
  
  def test_bottom_trigram
  
  assert_equal( [0, 0, 0], @h.bottom_trigram.signature )
  
  end
  
  def test_change
  
  temp = @h.change
  
  assert_equal( false, temp.moving? )
  
  end
  
  def test_description
  
  assert @h.respond_to? :description
  
  end
  
  def test_moving_eh
  
  assert_equal( true, @h.moving? )
  
  end
  
  def test_moving_lines
  
  assert_equal( [6, 4], @h.moving_lines )
  
  end
  
  def test_moving_lines_equals
  
[email protected]_lines = [ 1, 2 ]
  
  assert_equal( [6, 5, 4], @h.moving_lines )
  
  end
  
  def test_signature
  
  assert_equal( [1, 1, 1, 0, 0, 0], @h.signature )
  
  end
  
  def test_top_trigram
  
  assert_equal( [1, 1, 1], @h.top_trigram.signature )
  
  end
  
  end
  
  end
  
  module TestIChing
  
  class TestTrigram < Test::Unit::TestCase
  
  def setup
  
[email protected] = IChing::Trigram.new()
  
  setup_lines()
  
  end
  
  def setup_line( moving = true, type = IChing::YIN )
  
[email protected] << { :moving => moving, :type => type }
  
  end
  
  def setup_lines
  
  setup_line( true )
  
  setup_line( false, IChing::YANG )
  
  setup_line( false )
  
  end
  
  def test_change
  
  temp = @t.change
  
  assert_equal( false, temp.moving? )
  
  end
  
  def test_moving_lines
  
  assert_equal( [3], @t.moving_lines )
  
  end
  
  def test_signature
  
  assert_equal( [1, 0, 1], @t.signature )
  
  end
  
  end
  
  end
  
  
最佳答案
评论( 相关
后面还有条评论,点击查看>>