搜索
系统检测到您的用户名不符合规范:

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

浏览:2685 发布日期: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

@c = 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

@h = IChing::Hexagram.new()

setup_lines()

end

def setup_line( moving = true, type = IChing::YIN )

@h << { :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

@h.moving_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

@t = IChing::Trigram.new()

setup_lines()

end

def setup_line( moving = true, type = IChing::YIN )

@t << { :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

最佳答案
评论() 相关
后面还有条评论,
评论支持使用[code][/code]标签添加代码
您需要登录后才可以评论 登录 | 立即注册
收藏
dizhen
积分:35 等级:LV0
热点推荐
(追記) (追記ここまで)
最新更新

我们

合作

网站

信息

ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。

AltStyle によって変換されたページ (->オリジナル) /