8-character Yijing algorithm: using Java to implement the simplest naming and fortune-telling Method

Source: Internet
Author: User

Fortune-based fortune-telling, fortune-telling refers to the rough classification of fate, but divides fate into fifty-one categories. Therefore, the investigation of fate is not meticulous and inaccurate, which can be referenced by supply and demand testers.

The algorithm Baidu does not elaborate on the http://baike.baidu.com/view/3205806.htm

Code:

/** To change this template, choose tools | templates * and open the template in the editor. */package javachenggu;/** bone fortune computing algorithm ** @ author luozhuang master♂Luo yun*/public class luozhuangchenggu {int YY [] = {0, 6, 8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9, 7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6, 19, 6, 8, 16, 10, 6, 12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12}; int mm [] = {0, 6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5}; int dd [] = {0, 5, 10, 8, 15, 16, 15, 8, 16, 16, 16, 16, 19, 17, 8, 17, 10, 8, 9, 18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6}; int HH [] = {0, 0, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6, 16 }; /***** @ Param year * @ Param month * @ Param day * @ Param hour * @ return */Public String chenggu (INT year, int month, int day, int hour) {int Zong, zong1, zong2, N; If (hour % 2 = 0) {n = (hour + 2)/2 ;} else {n = (hour + 3)/2;} Zong = YY [(year-1821) % 60 + 1] + mm [month] + dd [Day] + HH [N]; Zong1 = Zong % 10; zong2 = Zong/10; system. Out. Print ("your life has" + zong2 + "two" + zong1 + "money! \ N "); Return" your life is "+ zong2 +" two "+ zong1 +" money! \ N ";}/*** @ Param ARGs the command line arguments */public static void main (string [] ARGs) {luozhuangchenggu my = new luozhuangchenggu (); my. chenggu (1846, 2, 14, 2 );}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.