八字易經演算法之用JAVA實現最簡單的稱骨算命法

來源:互聯網
上載者:User

   算命法介紹:稱骨算命是算命方法的一種,和生辰八字算命、紫微鬥數算命異曲同工,略有不同,雖然都是用出生的時間算命,但比較而言,稱骨算命將命運分的比較粗略,只是把命運分為五十一種,故對命運的考察不細緻,不太準確,可以供求測者參考。

  演算法baidu上有不細說了http://baike.baidu.com/view/3205806.htm

  上代碼:

 

/* * To change this template, choose Tools | Templates * and open the template in the editor. */package javachenggu;/**稱骨算命演算法 * * @author luozhuang 大師♂羅莊 */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, 8, 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("你的命有" + zong2 + "兩" + zong1 + "錢!\n\n");        return "你的命有" + zong2 + "兩" + zong1 + "錢!\n\n";    }    /**     * @param args the command line arguments     */    public static void main(String[] args) {        LuozhuangChenggu my = new LuozhuangChenggu();        my.Chenggu(1846, 2, 14, 2);    }}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.