The Oracle of Change on your WAP phone!
Full text with instructions, and free PHP script on the WEB:
© 2008-02-03

<?php // --- cut above this line --- NOTHING above it!---

/*** The Oracle of Change on your WAP phone! **********************************
 * Full text with instructions, and latest free PHP script on the WEB:
 *  http://www.vidwest.net/iching.php
 * (c) Copyright 2002 d(@)vidwest.net - see timestamp of above URL for version
 *** INSTALLATION *************************************************************
 * You are welcome to install this script on YOUR web server if it runs PHP4.
 * Simply COPY AND PASTE this script into a text editor and save it locally as
 * say, 'iching.php', then FTP the file to your web space IN ASCII MODE.
 * Any problems, please let me know how come. Otherwise, if it works for you,
 * it should work for everyone else. Enjoy!

// Change MYURL to something other than the url above, if your want...
define('MYURL', 'http://www.zenas.org/iching/iching.php');

// Colour scheme, etc. -- customize to your tastes...
//define('FGCOLOR1', '#000066'); define('BGCOLOR1', '#666699');
//define('BGCOLOR2', '#ccccff'); define('BGCOLOR3', '#9999cc');
define('FGCOLOR1', '#000000'); define('BGCOLOR1', '#006699');
define('BGCOLOR2', '#ffffff'); define('BGCOLOR3', '#999999');
//define('IMG_R', 0x99); define('IMG_G', 0x66); define('IMG_B', 0x00);
define('IMG_R', 0x66); define('IMG_G', 0x66); define('IMG_B', 0x66);
define('IMGSCALE', 2); define('METHOD', 'yarrow'); // 'yarrow' or 'coins'

/// TOP LEVEL: WHAT TO DO...? ////////////////////////////////////////////////

//define('SCRIPT',   basename($GLOBALS['PHP_SELF']));
define('SCRIPT', basename($_SERVER['PHP_SELF']));
define('MODIFIED', date('Y-m-d', getlastmod()));
define('IS_WAP',   stristr($GLOBALS['HTTP_ACCEPT'], 'wml'));
define('GD_OK',    imagetypes() & (IMG_GIF | IMG_PNG));

if (!$x) $x = $HTTP_GET_VARS["x"];
if (!$x) $x = $_GET["x"];

if     (validscore($x))        sendmarkup(consult($x)); // ignore invalid score
elseif (validlines($x))        sendgraphic($x);
elseif ($x == 'yya')           yinyangwbmp(); // late add-in - see graphics
elseif ($x == 'con' || IS_WAP) sendmarkup(consult(randomscore(METHOD)));
elseif ($x == 'txt')           sendmarkup(fulltext());
elseif ($x == 'scr')           sendmarkup(script());
else                           sendmarkup(welcome());


/// CALLED BY TOP LEVEL ///////////////////////////////////////////////////////

function validscore($score) { return preg_match("/[6-9]{6}/", $score); }

function validlines($lines) { return preg_match("/[0-3]{6}/", $lines); }

function sendmarkup($buf) { // bufsize: ~2k (con); ~63k (txt); ~72k (scr)
 if (IS_WAP) { sendheaders("text/vnd.wap.wml"); echo sendwml ($buf); }
 else        { sendheaders("text/html");        echo sendhtml($buf); }

function sendgraphic($lines) {
 if (IS_WAP) { streamwbmp($lines); } else { streamgifpng($lines); }

/// SEND RESPONSE /////////////////////////////////////////////////////////////

function sendheaders($type) { // @ 10p/minute these should be the default!
 header("Content-type: $type");
 header("Expires: Fri, 31 Dec 2010 00:00:00 GMT"); // expires in ~10 years
 header("Cache-Control: max-age=315360000");	 // Encourage caching, HTTP/1.1

function sendwml($buf) {
 echo '<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
?><wml><head><!-- cache for ~10 years -->
<meta forua="true" http-equiv="Cache-Control" content="max-age=315360000"/>
</head><template><do type="help" label="About I Ching"><go href="#a"/></do>
<do type="prev" label="Back"><prev/></do></template>
<card id="q" title="I Ching"><p align="center">
<img src="<?php echo SCRIPT; ?>?x=yya" alt="Yin-Yang" width="47" height="18"/>
<br/><a href="#m">Consult Now</a>
<br/><a href="#s">Enter Score</a></p></card>
<card id="m" title="I Ching"><?php echo $buf; ?></card>
<card id="s" title="I Ching"><do type="accept" label="Send Score">
<go href="<?php echo SCRIPT; ?>#m" method="get">
<postfield name="x" value="$(x:escape)"/></go></do>
<p align="center">Enter Score: <input name="x" format="6N" value=""/><br/>
Eg.'797688', top line right.<br/>How? Toss 3 coins H=3 T=2:<br/>6=- x -
7=-----<br/>8=-- -- 9=--o--<br/>Draw 6 lines, top last.</p></card>
<card id="a" title="About I Ching"><do type="help" label="About I Ching">
<noop/></do><?php echo about(1); ?></card></wml>
<?php } // note: anchors stripped from ABOUT

function sendhtml($buf) {
 echo "<html><head><title>I Ching</title>
<link rel=\"stylesheet\" href=\"../stile.css\" type=\"text/css\">

</head><body bgcolor=".BGCOLOR1." text=".FGCOLOR1."
link=".FGCOLOR1." vlink=".FGCOLOR1." alink=".FGCOLOR1.">
<a name=top></a><center>
<div style=text-align:center;>".about()."</div>
<div style=text-align:center;padding:16;background-color:".BGCOLOR2.";>

function about($nolinks = 0) { // wml/xhtml - common to all text output
 $u = SCRIPT; $m = MODIFIED;
 $s = " <div id=\"contents\">
   <div align=\"center\"> <h1>Zenas.org</h1></div>
    <div id=\"main\">

<script type=\"text/javascript\"><!--
google_ad_client = \"pub-3578398603009061\";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = \"728x15_0ads_al\";
google_ad_channel = \"\";
google_color_border = \"ffffff\";
google_color_bg = \"ffffff\";
google_color_link = \"CC0033\";
google_color_url = \"008000\";
google_color_text = \"000000\";
<script type=\"text/javascript\"

    <p align=\"center\"><b>The Oracle of Change on your WAP phone!</b><br/>
<a href=\"$u?x=txt\">Full text</a> with instructions, and free
<a href=\"$u?x=scr\">PHP script</a> on the WEB:<br/>
<a href=\"$u\">".MYURL."</a><br/>
&#xA9; $m <br/><a href=\"mailto:d(@)vidwest.net\">d(@)vidwest.net</a></p>

 if ($nolinks) $s = preg_replace("'<a [^>]*>|</a>'i", '', $s);
 return $s;

/// GRAPHICS //////////////////////////////////////////////////////////////////

function yinyangwbmp() { // ~ generalizable wireless bitmap generator...
 $a = explode("
", /* start 1-bit graphic on line below... (using ONLY '#' and ' ') */ "
        # # #     ##    #####     # # #
   # #  # # #    #       #####    # #    # #
   # #  # # #   #         #####   # # #  # #
   # #          #    ##   #####          #
#  # #  # # #  #     ##   ######  # # #  # #  #
#  # #    # #  #          ######    #    # #  #
#       # # #  #         #######  # # #       #
#              #        ########
#       # # #  #       #########  # # #       #
#  # #  #   #  #      ##########  #      # #  #
#  # #  # # #  #      ###  #####  # # #  # #  #
     #          #     ###  ####
   # #  # # #   #     #########   # # #  # #
   # #      #    #     #######           # #
        # # #     ##    #####     # # #

"); /* ...end 1-bit graphic on line above - MAX 127*127 chars */
 array_shift($a); array_pop($a); // discard 1st and last elements
 $h = count($a);
 for ($i = $w = 0; $i < $h; $i++) // find max line width...
  if (($l = strlen($a[$i])) > $w) $w = $l;
 $data = "0, 0, $w, $h"; // NOTE: <img... width and height MUST MATCH!!!
 for ($i = 0; $i < $h; $i++) {
  $s = strtr(str_pad($a[$i], $w), ' #', '10').'0000000';
  for ($j = 0; $j < $w; $j += 8)
   $data .= ', '.bindec(substr($s, $j, 8));
 eval("echo pack('C*', $data);");

function streamwbmp($lines) { // requested from <img src=...
 $a = array( // 24 * 24
  ',255,255,255,0,60,0,0,60,0,0,60,0',      // -- --
  ',255,255,255,0,0,0,0,0,0,0,0,0',         // -----
  ',255,255,255,0,60,0,127,189,254,0,60,0', // - x -
  ',255,255,255,0,0,0,127,255,254,0,0,0');  // --o--
 eval('echo pack("C*",0,0,24,24'.strtr(strrev($lines), $a).');');
} // here, we bypassed the possibly absent gd library

function streamgifpng($lines) { // only if GD_OK, requested from <img src=...
 // if (!$lines) $lines = $HTTP_GET_VARS["lines"];
 $a = array(
  'ImageFilledRectangle($im,0,(5-$i)*5,9,(5-$i)*5+3,$fg);     // -- --
  'ImageFilledRectangle($im,0,(5-$i)*5,23,(5-$i)*5+3,$fg);',  // -----
  'ImageRectangle($im,0,(5-$i)*5,9,(5-$i)*5+3,$fg);           // - x -
  'ImageRectangle($im,0,(5-$i)*5,23,(5-$i)*5+3,$fg);'         // --o--
 $im = ImageCreate(24, 30);
 $bg = ImageColorAllocate($im, 0xff, 0xff, 0xff);
 $fg = ImageColorAllocate($im, IMG_R, IMG_G, IMG_B);
 ImageColorTransparent($im, $bg);
 for ($i = 0; $i < 6; $i++) eval($a[substr($lines, $i, 1)]);
 if (ImageTypes() & IMG_GIF) { sendheaders("image/gif"); ImageGIF($im); }
 else                        { sendheaders("image/png"); ImagePNG($im); }
} // these would be better as a separate <2k script, changing <img src=...

/// CONSULT ///////////////////////////////////////////////////////////////////

/* From a big enough range, only ONE random value is needed to consult the
 * I Ching. $random is a hexadecimal string ('000000'..'ffffff'), each digit
 * representing the number of heads in six tosses of four coins (24 bits). Eg.
 * 'b' (1011 binary)... COINS method: discard the MSB = (011) = 2 heads, scores
 * '8'. YARROW/4-coins method: the two MSBs (10) are 'silver' coins (see end of
 * full text) scoring 3 + the two LSBs (11) are 'copper', each scoring 3 = '9'.
function randomscore($method) {
 $random = substr(md5(uniqid(@microtime(),1)), 0, 6);
 $translate = $method == 'yarrow' ?
                       '6778788978897889' :
                       '6778788967787889'; // else use coins
 return strtr($random, '0123456789abcdef', $translate);
} // return score '666666'..'999999' bottom line 1st;

function consult($score) {
 $hexagrams = hexagrams(); // the BIG array
 $hex = array();
 $l = strtr($score, '6789', '2103');
 $v = strtr($score, '6789', '0101');
 $m = strtr($score, '6789', '1100');
 $hex['ograph'] = imagemarkup($l, 'Main');
 sethextext($hexagrams, $hex, bindec($v), strtr($l,'0123','0011'), 'o');
 if ($v != $m) { // there are moving lines...
  $hex['cgraph'] = imagemarkup($m, 'Changed');
  sethextext($hexagrams, $hex, bindec($m), '000000', 'c');
 return resultsmarkup($hex, $score);

function sethextext(&$hexagrams, &$hex, $value, $moving, $prefix) {
 $t = trigrams();
 $h = $hexagrams[$value];
 $hex["{$prefix}title"] = "$h[0] - $h[1]";
 $hex["{$prefix}trigs"] = "({$t[$value & 7]} - {$t[$value >> 3]})";
 $hex["{$prefix}decis"] = "DECISION: $h[2]";
 $hex["{$prefix}image"] = "IMAGE: $h[3]";
 if ((int) $moving) {
  for ($i = 0, $s = 'LINES:', $a = array('1st','2nd','3rd','4th','5th','Top');
       $i < 6; $i++)
   if (substr($moving, $i, 1))
    $s .= " ({$a[$i]}=".($value & (1 << (5 - $i)) ? 9 : 6).") {$h[4][$i]}";
  if ($h[0] < 3 && $moving == '111111')
   $s .= " (All=".($value ? 9 : 6).") {$h[4][6]}";
  $hex['olines'] = $s;
} // note: $hex arg gets changed; also called by fulltext()

function resultsmarkup($hex, $score) { // wml/xhtml
 $s = "<p align=\"center\">{$hex['ograph']}<br/>[Score: $score]<br/>".
 if (isset($hex['olines'])) {
  $s .= "{$hex['olines']}<br/><br/>{$hex['cgraph']}<br/>".
 return $s."</p>";

function imagemarkup($lines, $title) {
 if (!IS_WAP && !GD_OK) {
  $a = array("-- --\n", "-----\n", "- x -\n", "--o--\n");
  return '<pre>'.strtr(strrev($lines), $a).'</pre>'; // strtr() :-)
 $s = SCRIPT."?x=$lines";
 if (IS_WAP) { $w = $h = 24; } else { $w = 24*IMGSCALE; $h = 30*IMGSCALE; }
 return "<img src=\"$s\" alt=\"$title Hexagram\" width=\"$w\" height=\"$h\"/>";

/// OTHER USER REQUESTS ///////////////////////////////////////////////////////

function fulltext() {
 $buf = '<div style=text-align:left;><pre>'.ichingheader();
 $hexagrams = hexagrams(); $hex = array();
 asort($hexagrams); // order BIG array numerically (not binary)
 foreach ($hexagrams as $k=>$v) {
  sethextext($hexagrams, $hex, $k, '111111', 'o');
  $s = strtr(str_replace("
", " ", "{$hex['odecis']}~~{$hex['oimage']}~~{$hex['olines']}"), '~', "\n");
  $s = wordwrap($s, 72, "\n", 1);
  $a = explode("\n", $s);
  for ($j = 0; $j < sizeof($a)-1; $j++) {
   $p = ($j<6 ? ($k&(1<<$j)?"-----":"-- --"):"     ");
   $a[$j] = "$p  {$a[$j]}";
  $a[$j] = "<a href=#top>Top</a>    {$a[$j]}";
  $s = implode("\n", $a);
  $buf .= "<a href=#i name=h{$v[0]}>{$hex['otitle']}</a>".
   " {$hex['otrigs']}\n\n$s\n\n";
 return $buf.ichingfooter().'</pre></div>';

function script() {
 return "<div style=text-align:left;><pre>\n". // show_source() > 200k!

function welcome() {
 return "<script type=text/javascript>
function validate(s) { for (i = 0; i < 6; i++)
if (s.charAt(i) < '6' || s.charAt(i) > '9') break; if (i < 6) {
alert('Please enter SIX digits with values 6, 7, 8 or 9.'); return(false); } }
</script><b>Welcome to the I Ching</b><p>Do you have a question?
<p><a href=".SCRIPT."?x=con>Consult now</a>
<p><form action=".SCRIPT." onsubmit=return(validate(x.value))>
<p>Or, type your score here, and hit return:
<p><input size=6 maxlength=6 name=x>
<p>For example, if you manually generated a hexagram looking like this:
<pre>-- -- = 8\n-- -- = 8\n- x - = 6\n----- = 7\n--o-- = 9\n----- = 7\n</pre>
<p>Enter 797688&#151;bottom line first (see <a href=".SCRIPT.

/// DATA ///////////////////////////////////////////////////////////////////////

// always parsed, but conditionally assigned...

function trigrams() {
 return array("K'UN: Earth, receptive", "KEN: Mountain, still",
"K'AN: Water, dangerous", "SUN: Wind, gentle", "CHEN: Thunder, arousing",
"LI: Fire, clinging", "TUI: Lake, joyful", "CH'IEN: Heaven, active");

function hexagrams() {
 return array( // primary index is binary value of hexagram (LSB = top line)

077 => array( 1, "CH'IEN / CREATIVITY", "Sublime success in firm correctness.",
"Heaven's powerful movement. The superior one forever strives.", array("Hidden
dragon. Inaction.", "Dragon appears in the field. Advantage to see the great
one.", "All day, the superior one acts creatively. At dusk the mind is still
restless. Peril yet no error.", "Dragon flies uncertainly over the deep. No
error.", "Flying dragon. Advantage to see the great one.", "Arrogant dragon
will need to repent.", "Flying headless dragons. Good fortune.")),

000 => array( 2, "K'UN / RECEPTIVENESS", "Supreme success in the firm
correctness of a mare. The superior one trying to lead goes astray, but in
following, finds guidance. Friends are in the west and south, not in the east
and north. Good fortune in quiet persistence.", "The receptive nature of the
earth. The superior one builds virtues to endure all things.", array("With
hoarfrost underfoot, solid ice is near.", "Straight, square, great. Effortless
advantage.", "If serving the ruler, bring to completion, seeking no praise.",
"A tied sack. No blame, no praise.", "Yellow undergarment. Supreme good
fortune.", "Dragons fight in the wilderness. Their blood is blue and yellow.",
"Advantage in firm correctness.")),

042 => array( 3, "CHUN / INITIAL DIFFICULTY", "Great success in firm
correctness. Act only when progress is possible. Seek helpers.", "Clouds and
thunder. The superior one brings order to matters.", array("Hesitation. Be firm
and correct. Seek helpers.", "Wagon loses its horse. A suitor arrives, not a
robber. Offer chastely declined. In ten years they will marry.", "Whoever hunts
deer without a forester only gets lost. The superior one seeing the signs,
desists. To go on brings regret.", "Wagon loses its horse. She seeks a suitor's
help. Advantage in every move.", "Difficulty in giving favours. Persist firmly
only in small matters.", "Wagon loses its horse, blood and tears flow.")),

021 => array( 4, "MENG / INEXPERIENCE", "Success. I do not seek young folly,
but it seeks me. The first time, I offer guidance. But asking too often is
irreverent, and I say nothing. Advantage in firm correctness.", "A spring at
the foot of a mountain. The superior one fosters virtue with resolve.",
array("Punishment dispels ignorance and frees the mind. But too much or too
little brings regret.", "Good fortune to suffer fools. Likewise to take a wife.
The son can support the family.", "Do not marry a woman who cannot control
herself when she sees a wealthy one. No advantage.", "Young folly brings
regret.", "Innocent youth brings good fortune.", "Advantage only by keeping
harm from the young fool.")),

072 => array( 5, "HSU / WAITING", "Sincerity brings brilliant success. Good
fortune in firm correctness. Advantage to cross the great water.", "High
clouds. The superior one likes to eat, drink and be merry.", array("Waiting in
the fields. Maintaining purpose. No error.", "Waiting on the sand. There is
gossip, but eventual good fortune.", "Waiting in the mud. Inviting robbers.",
"Waiting in blood. Coming out of the pit.", "Waiting before a feast. Good
fortune in firm correctness.", "Falling into the pit. Three uninvited guests.
If treated with respect, they bring good fortune.")),

027 => array( 6, "SUNG / CONFLICT", "Though sincere, you are obstructed. Acting
cautiously brings good fortune. Persistence brings misfortune. Advantage to see
the great one, but not to cross the great water.", "Heaven and water go their
opposite ways. The superior one carefully considers the first move before
commencing any venture.", array("Not proceeding. There is gossip. Good fortune
in the end.", "Retreating to one's home town of 300 families. Free from
incident.", "Living by old virtues brings firm correctness. Peril, but eventual
good fortune. If serving the ruler, seek no praise.", "Retreating to study the
Way. A change of mind staying firmly correct. Good fortune.", "Conflict brings
good fortune.", "The ruler awards a leather belt, yet before noon, it is taken
three times.")),

020 => array( 7, "SHIH / THE ARMY", "Firm correctness. A seasoned leader: good
fortune, no blame.", "Underground water. The superior one gathers an army by
kindness.", array("The army marches with discipline. Without this, disaster.",
"Amidst the army, its leader. Good fortune, no blame. The ruler bestows honour
three times.", "A badly led army meets with evil.", "The army retreats. No
error.", "There is game in the field. Seize it without blame. While the elder
son leads, and the younger is fit only to carry corpses, misfortune.", "The
great ruler appoints heads of states and of families. Low people should not be

002 => array( 8, "PI / ASSOCIATION", "Good fortune. Consult the oracle once
again. If you are virtuous, correct and firm, there will be no error. Those who
are troubled will join you, latecomers meeting misfortune.", "Water on the
earth. Rulers of old set up states, maintaining good relations with their
feudal chiefs.", array("Sincere associations. No error. With a true heart, like
water in a jug, good fortune.", "Unity from the heart. Good fortune in firm
correctness.", "Association with the wrong people.", "Association with an
outsider. Good fortune in firm correctness.", "Great unity. The ruler hunts on
three sides only, allowing game to escape at the front. The people unprepared.
Good fortune.", "No initiative in seeking unity. Misfortune.")),

073 => array( 9, "HSIAO CH'U / MILD RESTRAINT", "Success. Dense clouds, no rain
from the western borders.", "Wind in the sky. The superior one seeks to
beautify virtue.", array("Returning to the Way. What error? Good fortune.",
"Returning to the Way by persuasion.", "The spokes are gone from the wagon
wheel. Man and wife are not in harmony.", "Inner sincerity averts bloodshed and
fear goes. No error.", "Inner sincerity draws others near, enriched by
neighbours.", "Rain comes. Virtue grows. A firm and persistent woman meets
peril. The moon is nearly full. The superior one will meet evil in

067 => array(10, "LU / TREADING", "Treading on a tiger's tail. It does not
bite. Success.", "Heaven above the lake. The superior one, discriminating
between high and low, calms the people.", array("Progress along the proper Way
without error.", "A smooth, easy Way. The firm correctness of a hermit. Good
fortune.", "A one-eyed man can see. A lame man can walk. Treading on a tiger's
tail, he gets bitten. Misfortune. A daring one serves a great ruler.",
"Treading on the tiger's tail with caution and apprehension. Eventual good
fortune.", "Treading with firm correctness and resolve. Peril.", "Examine the
steps you take, looking for signs. Supreme good fortune if all is in order.")),

070 => array(11, "T'AI / PEACE", "The small goes, the great comes. Good fortune
and prosperity.", "Heaven and earth united. The ruler comprehending their
courses, helps regulate their gifts, benefitting the people.", array("Pulling
up grass, other stalks come with it. Ventures bring good fortune.", "Tolerant
of others, willing to swim rivers, mindful of what is distant, fair with
friends. The Middle Way.", "No plain not turning to slope. No going without
return. Resolve in peril is without error. Not sad at certain change. Sincerity
brings happiness.", "A fluttering bird, riches ignored, calls on its
neighbours. Sincere.", "The ruler's daughter given in marriage. Happiness and
supreme good fortune.", "The city wall falls into the moat. Use no armed force.
Warn the people. Persistence brings regret.")),

007 => array(12, "P'I / STAGNATION", "Bad people do not further the firm and
correct Path of the superior one. The great go out. The small come in.",
"Heaven and earth in disunion. The superior one is frugal to avoid hardship.
Not tempted by wealth or glory.", array("Pulling up grass, other stalks come
with it. Firm correctness brings good fortune and success.", "Patience and
endurance. Good fortune for low people. Success for the great one.", "Enduring
shame.", "Acting at the command of Heaven without blame. Friends will share the
happiness.", "Stagnation ends. Good fortune for the great one, who exclaims:
What if it fail, what if it fail? Let it be tied to the mulberry trees.",
"Stagnation ends. First stagnation, then good fortune.")),

057 => array(13, "T'UNG JEN / FELLOWSHIP", "In the open. Success. Advantage to
cross the great water. Advantage in the firm correctness of the superior one.",
"Heaven with fire. The superior one distinguishes between things.",
array("Comrades at the gate. No blame.", "Comrades among the clan. Regret.",
"He hides weapons in the bushes, climbs a hill, For three years he makes no
attack.", "He climbs the city wall. He Does not attack. Good fortune.",
"Comrades weep and then laugh. They gain victory and unite.", "Comrades in the
field. No regret.")),

075 => array(14, "TA YU / WEALTH", "Prosperity and success.", "Fire in heaven.
The superior one fights evil and exalts good, according to heavenly virtue.",
array("Regret comes from lack of comrades, not from error. Fortitude avoids
error.", "A big wagon. Any direction. No Error.", "A chief's gift. A petty man
is unequal to this.", "Using resources with restraint. No Error.", "Others show
equal sincerity. Dignity brings good fortune.", "Blessed by heaven. Good
fortune in all things.")),

010 => array(15, "CH'IEN / MODESTY", "Success. The superior one cultivates
modesty. Good fortune.", "Underground mountain. The superior one balances
excess and need.", array("The superior one augments modesty. Crossing the great
water brings good fortune.", "Modesty revealed. Firm correctness brings good
fortune.", "The superior one, modesty known, enjoys continued success. Good
fortune.", "Advantage in all ventures. Modesty sways action.", "Humbly
employing neighbours. Favourable to use force. Advantage.", "Modesty known.
Favourable to use armies to punish the towns.")),

004 => array(16, "YU / ENTHUSIASM", "Advantage to install chiefs and to set
armies marching.", "Thunder crashing from the earth. Rulers of old made music
and exalted virtue, offering them to Heaven. Their ancestors present.",
array("Satisfaction publicly expressed. Misfortune.", "Firm as a rock. A
decision before nightfall. Resolve brings good fortune.", "Self-satisfied,
aiming high. Hesitation. Regret.", "The source of enthusiasm brings great
success. Doubt not, and friends will gather as hair in a clasp.", "Persistently
ill, yet not dying.", "The pleasure seeker should change course to avoid

046 => array(17, "SUI / FOLLOWING", "Prosperity. Advantage in firm correctness.
No error.", "Thunder below the lake. The superior one rests indoors at dusk.",
array("Changing course. Good fortune in firm correctness. Going outdoors to
seek company brings merit.", "Choose the young person, lose the mature.",
"Choose the mature person, lose the young. Find what you seek. Stay firm and
correct.", "A following gains reward, but persistence brings evil. With
sincerity, how is there error?", "Sincerity in the good. Good fortune.",
"Sincerity gets loyalty. The ruler offers sacrifices on the western

031 => array(18, "KU / DECAY", "Progress and success. Advantage to cross the
great water. Deliberate three days before, and three days after.", "Wind below
the mountain. The superior one stirs people's virtue.", array("Setting right
the father's errors. If the child is capable, the father will escape blame.
Peril, but eventual good fortune.", "Setting right the mother's errors. Not too
persistently.", "Setting right the father's errors. Small regret. No great
error.", "Compounding the father's errors. Persistence brings regret.",
"Setting right the father's errors. Gains praise.", "Serving neither ruler nor
chief, setting one's own high goals.")),

060 => array(19, "LIN / ADVANCE", "Prosperity. Firm correctness brings
advantage. In the eighth month, evil.", "Earth above the lake. The superior one
tirelessly teaches and protects the people.", array("Advancing with another.
Firm correctness brings good fortune.", "Advancing with another. Good fortune.
No disadvantage", "Happy advance, but no gain. Anxiety brings no error.",
"Correct descent. No error.", "Wise advance, as befits a great ruler. Good
fortune.", "Generous advance. Good fortune. No error.")),

003 => array(20, "KUAN / CONTEMPLATION", "Washed but offering not yet made.
Sincerity brings sincerity.", "Wind across the earth. Rulers of old visited the
regions, observing the people, to plan their instruction.", array("Childish
views. In the low, no blame. In the superior one, regret.", "Peeping from
behind a door. Advantageous in a woman.", "Self-contemplation. Whether to
advance or retreat.", "Contemplating the country's glory. Advantage as the
ruler's guest.", "Self-contemplation. The superior one has no regret.",
"Self-contemplation from above. The superior one has no regret.")),

045 => array(21, "SHIH HO / BITING THROUGH", "Success. Advantage in the law
courts.", "Thunder and lightning. Rulers of old defined laws and penalties.",
array("Feet in the stocks, toes hidden. No error.", "Biting through skin until
the nose is bitten off. No error.", "Chewing old dry meat, reaching poison.
Mild regret. No error.", "Gnawing at a bone's dried meat, a verdict must be
reached. Advantage in strength and firm correctness. Good fortune.", "Gnawing
at a bone's dried meat, a difficult verdict must be reached. Peril. If firm and
correct, no error.", "Wearing a wooden yoke, hiding the ears. Regret.")),

051 => array(22, "PI / GRACE", "Success in small matters.", "Fire under the
mountain. The superior one is audacious in daily affairs, cautious in legal
matters.", array("Dressing the feet, leaving the carriage, and walking.",
"Dressing the hair.", "Dressed up and glistening. Firm correctness brings good
fortune.", "Dressed in white, as a winged white horse. Not a robber, but a
suitor.", "Walking in hills and gardens, dressed in coarse cloth. A small gift,
but eventual good fortune.", "Plain white clothes. No error.")),

001 => array(23, "PO / DIVISION", "No advantage in any move.", "Mountain on the
earth. Those above strengthen those below, building stable foundations.",
array("Taking the legs off the bed. Misfortune.", "Taking the sides off the
bed. Misfortune.", "Meeting the destructive process. Yet without error.",
"Taking the mattress from the bed. Evil.", "Courtesans follow their leader,
like a shoal of fish, seeking favour. No disadvantage.", "A large fruit yet
uneaten. The superior one gets a carriage. The mean topple their houses.")),

040 => array(24, "FU / RETURNING", "Success. Coming or going without harm.
Friends come without regret. The Way repeats itself on the seventh day. Any
direction gains.", "Thunder within the earth. Rulers of old closed the passes
on the winter solstice. Merchants and travellers would break their journeys.
The ruler did not visit the regions.", array("Early return. No regret. Great
fortune.", "Happy return. Good fortune.", "Repeated return. Though peril, no
blame.", "Going with others, returning alone.", "Sincere return. No regret.",
"Confused return. Evil, even disaster. If armies are sent, defeat. The ruler
cannot conquer even in ten years.")),

047 => array(25, "WU WANG / INNOCENCE", "Prosperity. Advantage in firmness.
Incorrectness leads to disadvantage and error in any direction.", "Thunder
under heaven. All things acting by their true nature, without error. Rulers of
old, in accordance with the seasons, nourished all things.", array("Sincerity.
Advance brings good fortune.", "With no thought of harvest or fertility,
ploughing and cultivating. Advantage in any direction.", "Undeserved calamity.
The tethered cow stolen. The people's loss.", "Remaining firm and correct. No
error.", "Undeserved illness. Take no medicine and rejoice.", "Though sincere,
any advance leads to error.")),

071 => array(26, "TA CH'U / STRONG RESTRAINT", "Advantage in firm correctness.
Not eating at home brings good fortune. Advantage to cross the great water.",
"Heaven within the mountain. The superior one learns the ancient words and
deeds, increasing virtue.", array("Peril. Advance no further.", "The axle has
fallen from the wagon.", "Horses chase each other. Strong resolve brings
progress. Daily practice of self-defence and chariot driving. Proceeding with
plans brings advantage.", "A young bull wears a headboard. Great good
fortune.", "Tusks of a gelded boar. Good fortune.", "Attaining the Way of
Heaven. Prosperity.")),

041 => array(27, "I / NOURISHMENT", "Good fortune in firm correctness. Consider
how the people seek their own nourishment.", "Thunder below the mountain. The
superior one watches words, and regulates eating and drinking.",
array("Releasing your magic tortoise, you look at me, slack jawed.
Misfortune.", "Seeking food from those below or above. Misfortune to persist.",
"Incorrect nourishment. For ten years, no advantage in any direction.",
"Seeking food from those below. Good fortune. Staring, unblinking as a tiger.
No error.", "Abnormal action. Remaining firm brings good fortune. Do not cross
the great water.", "The source of nourishment. Sensing peril brings good
fortune. Advantage to cross the great water.")),

036 => array(28, "TA KUO / EXCESS", "The beam sags to breaking point. Advantage
in any direction. Success.", "Trees below the lake. The superior one stands
alone without fear, retires from the world without regret.", array("White rush
mats spread out. No error.", "An old willow sprouts green shoots. An old man
takes a young wife. Advantage in any direction.", "The beam sags to breaking
point. Misfortune.", "The beam is strong, but regret in reliance on weak
support. Good fortune.", "An old willows flowers. An old woman takes a husband.
No blame, no praise.", "Fording the stream, water covers the head. Misfortune.
No blame.")),

022 => array(29, "K'AN / THE DEEP", "Perilous chasm. Calm sincerity brings
success.", "Flowing water. The superior one practises virtuous conduct and
teaches others.", array("In the chasm, falling into a pit. Misfortune.",
"Perilous chasm. Advantage only in small things.", "Inward and outward peril.
In the chasm, falling into a pit. Do not act.", "Jar of wine, bowl of rice and
earthen pots. Simply offered through the window. Eventually no error.", "Chasm
not full. No error.", "Tied up in a thorny thicket for three years.

055 => array(30, "LI / BRILLIANCE", "Success in firm correctness. Good fortune
in rearing cows.", "Brilliance repeated. The great one brightens virtue,
illuminating the four quarters of the world.", array("Confused steps. Reverence
brings no error.", "Yellow light. Great good fortune.", "In the setting sun,
they beat pots and sing, or bemoan the onset of old age. Misfortune.", "It
comes suddenly. It flares up, dies down, is discarded.", "Floods of tears and
groans. Good fortune.", "The ruler's army is sent to punish the rebellion. To
crush the leaders, sparing their followers. No Error.")),

016 => array(31, "HSIEN / MUTUAL INFLUENCE", "Firm correctness furthers. Good
fortune to take a young bride.", "Lake on the mountain. The superior one
receives others with humility.", array("Toes wriggling.", "Flexing the calf
muscles. Peril. Refrain brings good fortune.", "Thighs move. Clutching at those
who follow. Regret.", "Good fortune in firm correctness without regret.
Hesitation, but friends follow.", "Moving the neck. No Regret.", "Moving the
tongue and jaws.")),

034 => array(32, "HENG / DURATION", "Success. No regret. Advantage in firm and
correct plans.", "Thunder and wind. The superior one stands firm and
unchanging.", array("Seeking endurance. Persistence brings regret.", "Remorse
disappears.", "Unsteady virtue. Persistence brings regret.", "A field with no
game.", "Chastity and steady virtue. Good fortune in women, evil in men.",
"Misfortune in trying too much.")),

017 => array(33, "TUN / WITHDRAWAL", "Success. Advantage to persist in small
matters.", "Mountain under heaven. The superior one keeps distant from the
inferior, with calm reserve.", array("Withdrawn to the tail. Peril. Do not
advance.", "Holding fast to purpose, as bound to it by thongs of yellow
oxhide.", "Withdrawn as if tied to a post. Worry and peril. Advantage in caring
for servants.", "Glad withdrawal brings good fortune to the superior one, not
to the inferior.", "Graceful withdrawal. Good fortune in firm correctness.",
"Affluent withdrawal. Advantage.")),

074 => array(34, "TA CHUANG / STRENGTH", "Advantage in firm correctness.",
"Thunder in heaven. The superior one takes no improper step.", array("Strong
toes. Persistence brings misfortune.", "Good fortune in firm correctness.",
"The mean use strong force, the superior one does not. Persistence brings
regret. A goat butts a fence, getting its horns tangled.", "Good fortune in
firm correctness, regret disappears. The goat's horns are freed. Strong as the
axle of a big wagon.", "The goat strays. No regret.", "A goat butts a fence,
getting stuck. No advantage. Good fortune in strength.")),

005 => array(35, "CHIN / PROGRESS", "The chief, honoured with many horses,
received by the ruler, three times in one day.", "Sun over the earth. The
superior one brightens virtue.", array("Frustrated progress. Good fortune in
firm correctness. Virtue not yet recognised, openness avoids error.",
"Sorrowful progress. Good fortune in firm correctness. A grandmother's
favour.", "Trusted. No regret.", "Progress like a rodent. Persistence brings
peril.", "Regret disappears. No concern with loss or gain. Advantage.",
"Advancing with horns to punish the rebels. Sensing peril brings good fortune
and no blame. Persistence brings regret.")),

050 => array(36, "MING I / DIMMED LIGHT", "In adversity, advantage in firm
correctness.", "The light sunk into the earth. The superior one's hidden
wisdom.", array("Lowered wings as the light dims. Determined to follow the Way,
fasting for three days. Derided.", "Wounded in the left thigh, meeting good
fortune in a strong horse.", "Hunting in the south, the enemy leader is
captured. Do not act too soon.", "Penetrating the left belly, finding the heart
of the darkness, and exiting through the courtyard.", "As with Prince Chi,
advantage in firm correctness.", "Not light, but dark. Ascending to heaven,
then falling to earth.")),

053 => array(37, "CHIA JEN / THE FAMILY", "Advantage in the firm correctness of
a woman.", "Wind from fire. The superior one's speech is true, actions
consistent.", array("Regulation within the family. No Regret.", "She selflessly
prepares the family's food. Good fortune in firm correctness.", "Sternness
within the family. Regret and sensing peril, bring good fortune. Frivolity of
wife and children brings regret.", "She enriches the family. Great good
fortune.", "The ruler's influence in shaping the family. Do not worry. Good
fortune.", "Virtuous as a ruler. Eventual good fortune.")),

065 => array(38, "K'UEI / OPPOSITION", "Good fortune in small matters.", "Fire
above the lake. The superior one retains individuality.", array("Regret
disappears. Do not chase a lost horse. It will return of its own accord. Among
bad men, no error.", "Meeting one's master in a lane. No error.", "A wagon
pulled back, its oxen tied up. Hair and nose cut off. Not a good beginning, but
a good end.", "Alienated, a sincere ally is found. Peril, but no error.",
"Regret disappears. So close, they seem to bite each other. How can going
forward be an error?", "Alienated, seeing a dirty pig, and a wagon full of
demons. Bow and arrow raised, then lowered. This is not a robber, but kin.
Forward in gentle rain. Good fortune.")),

012 => array(39, "CHIEN / OBSTRUCTION", "Advantage in the southwest, not in the
northeast. Advantage to see the great one. Good fortune in firm correctness.",
"Water on the mountain. The superior one in self-examination, nurturing
virtue.", array("Going meets obstruction. Returning brings praise.", "The
ruler's minister suffers many obstructions, without thought of personal gain.",
"Going meets obstruction. Return.", "Going meets obstruction. Return.", "Going
meets obstruction. Friends come.", "Going meets obstruction. Return brings good
fortune. Advantage to see the great one.")),

024 => array(40, "HSIEH / ESCAPE", "Advantage in the southwest. If no tasks
remain, good fortune in returning. If tasks remain, good fortune in urgency.",
"Thunder and rain. The superior one pardons mistakes.", array("No Error.",
"Catching three foxes and receiving a yellow arrow. Good fortune in firm
correctness.", "Carrying a load, yet riding in a carriage. Inviting robbers.
Persistence brings regret.", "Massage your toes. Sincere friends will come.",
"The superior one seeks escape. Good fortune. Low people notice sincerity.",
"The chief shoots a hawk on a high wall. Advantage.")),

061 => array(41, "SUN / DECREASE", "Decreasing the excess with sincerity, good
fortune. No error. Firm correctness in advancing. Offer two baskets of food in
sacrifice.", "Lake below the mountain. The superior one controls anger and
desires.", array("Stopping work and hurrying away. No error, but consider the
decreased wealth.", "Advantage in firm correctness. New ventures bring
misfortune. Increase others without decreasing oneself.", "Three walk together.
One must leave, and finds a friend.", "Decreasing one's faults, friends are
happy to help. No error.", "A gift of ten tortoise shells, with no refusal.
Great good fortune.", "Gain without loss to others. No error. Good fortune in
firm correctness. Advantage in somewhere to go. Help received benefits all.")),

043 => array(42, "I / INCREASE", "Advantage in undertakings, and to cross the
great water.", "Wind and thunder. The superior one sees good and turns towards
it. Seeing bad, turns away from it.", array("Advantage in great undertakings.
Great good fortune. No error.", "A gift of ten tortoise shells, with no
refusal. Good fortune in firm correctness. The ruler makes lavish offerings to
Heaven. Good fortune.", "Enriched by unfortunate circumstance. No error.
Sincerely walking the Middle Way, as one wearing the jade emblem of rank.",
"Following the Middle Way, entrusted with such important tasks as moving the
capital.", "With sincere heart, helping all below. Supreme good fortune. Such
virtue acknowledged.", "Attacked for enriching no one. Following no steady way.

076 => array(43, "KUAI / BREAKTHROUGH", "Exposing evil at the ruler's court,
with sincere appeal to remedy the peril. Warn the people not to use arms.
Advantage to proceed.", "Lake rising to heaven. The superior one dispenses all
wealth, keeping none unused.", array("Advance with strong toes meets error.",
"Alarm sounded, arms in the night. No fear.", "Advance with a determined look
brings misfortune. The superior one is resolute, walks alone in the rain.
Malicious gossip. No error.", "The thighs have no skin. No regret to be led
like a lamb, but advice is ignored.", "Weeds must be uprooted with firm
resolve. Walking the Middle Way without error.", "No one to call for help.

037 => array(44, "KOU / MEETING", "A strong maiden appears. Best not to marry
her.", "Wind under heaven. The ruler's decrees made known to the people.",
array("Apply a metal brake. Good fortune in firm correctness, while advance
brings misfortune. A lean pig leaps about.", "Fish are in the bag. No blame.
They are not for the guests.", "The thighs have no skin. Peril, but no error.",
"No fish in the bag. Misfortune.", "Leaves hide the melon. It drops down as
from heaven.", "Meeting in a horny place. Regret, but no blame.")),

006 => array(45, "TS'UI / ASSEMBLY", "Success. The ruler goes to the ancestral
temple. Advantage to see the great one, in firm correctness, and to proceed.
Offering great sacrifices brings good fortune.", "Lake above the earth. The
superior one keeps weapons sharp, ready for the unforeseen.", array("Sincere
desire for unity confuses those around. Cry out, and smiles will return. No
Regret. Proceed with no error.", "Being led brings good fortune and no error.
With sincerity, advantage in even a small offering at spring worship.",
"Seeking unity without error, but with small regret.", "Great good fortune, and
no blame.", "Promoting unity. No error. Persistent virtuous conduct brings
eventual trust.", "Sighing and weeping. No error.")),

030 => array(46, "SHENG / RISING", "Prosperity. See the great one without
worry. Good fortune in going south.", "Trees growing from the earth. The
superior one cultivates virtue, accumulating the small, to achieve the high and
great.", array("Rising to the welcome of those above. Great good fortune.",
"Sincerity makes even a small spring offering acceptable. No error.", "Rising
into an empty city.", "Making the ruler's offerings on Mount Chi. Good fortune.
No error.", "Good fortune in firm correctness. Rising step by step.", "Blindly
rising. Advantage in tireless firm correctness.")),

026 => array(47, "K'UN / EXHAUSTION", "Success. Good fortune for the great one
with firm correctness. No error. Speeches will not impress.", "No water in the
lake. The superior one's life is the Way.", array("Tangled in a barren tree.
Into a dark valley, seeing no light for three years.", "Troubled by food and
drink, red official robes approach. Advantage to offer sacrifices. Misfortune
in action. No error.", "Overhanging rocks with only thorns to grasp. Coming
home, spouse not there. Misfortune.", "Proceeding slowly, halted by a golden
carriage. Regret, but a good ending.", "With nose and feet cut off, yet with a
serene look, hindered by an official with purple knee bands. Advantage to make
offerings.", "Bound by creeping vines, moving unsteadily saying: this will
bring regret. Remorse opens the Way to good fortune.")),

032 => array(48, "CHING / THE WELL", "The town may move, but the well cannot.
Its level is constant, though they come to draw water. Misfortune if the rope
be too short or the jug broken.", "Water over wood. The superior one inspires
the people to work and help each other.", array("An old muddy well with
undrinkable water. No animals visit.", "A hole in the well where water and fish
escape. Water leaks from the cracked jug.", "The well is clean, but sadly
unused. With an enlightened ruler, the people would benefit.", "A well lined
with bricks. No error.", "A well with cool clear drinking water.", "An open
well, like the sincerity that brings good fortune.")),

056 => array(49, "KO / REFORM", "Once achieved, reform is believed. Progress
and success. Advantage in firm correctness. No regret.", "Fire in the lake. The
superior one regulates the calendar and defines the seasons.", array("Bound by
thongs of yellow oxhide.", "Reform at the right time. Good fortune in new
ventures. No error.", "Misfortune in new ventures. Peril in Persistence.
Discuss reform three times before acting.", "Regret disappears. Sincere reform
brings good fortune.", "The great one reforms as a tiger changes its stripes.
Believed, even before consulting the oracle.", "The superior one reforms as a
leopard changes its spots, while the low change their faces. Misfortune in new
ventures. Good fortune in firm correctness.")),

035 => array(50, "TING / THE COOKING POT", "Supreme good fortune. Success.",
"Fire over wood. The superior one attends to the Way of Heaven.", array("A pot
upturned to empty the decay. No error to take the concubine for the son she
bears.", "A pot filled with food. My envious company cannot harm me. Good
fortune.", "A pot with no handles that cannot be moved. The fine pheasant meat
is uneaten. Rain coming ends regret. Eventual good fortune.", "The pot's legs
broken, the chief's meal spills. Regret and misfortune.", "A pot with yellow
handles and golden rings. Advantage in firm correctness.", "The pot with jade
rings. Great good fortune. No disadvantage.")),

044 => array(51, "CHEN / THUNDER", "Success. Crash of thunder. Horror, then
excitement. Terrifying for thirty miles, though steady hands carry the
sacrificial wine.", "Thunder repeated. The superior one fearfully works on
virtue.", array("Crash of thunder. Horror, then excitement. Good fortune.",
"Thunder brings peril. Treasure abandoned to climb the high hills. No need to
search for what is lost. After seven days it will be returned.", "Thunder
terrifies. Misfortune avoided if the shock stimulates action.", "Thunder
absorbed by mud.", "Coming and going amid the thunder. Peril, with tasks to
perform.", "Terrified gazes in the thunder. Misfortune in any venture. Caution
when it reaches your neighbour. No error, but some gossip.")),

011 => array(52, "KEN / STILLNESS", "Back still, unaware of the body. Noticing
no one in the courtyard. No blame.", "Mountain upon mountain. The superior one
dwells in the present.", array("Toes still. No error. Advantage in firm
correctness.", "Resting calves and legs. Unable to help the one who leads.
Unhappy heart.", "Keeping the hips still, ribs showing. Peril. The heart
burns.", "Body at rest. No error.", "Stilling the jaws, words have order.
Regret disappears.", "Solemn stillness. Good fortune.")),

013 => array(53, "CHIEN / GRADUAL PROGRESS", "A maiden given in marriage. Good
fortune. Advantage in firm correctness.", "Tree on a mountain. The superior one
by exemplary dignity and virtue, guides the people.", array("The wild geese
draw near the shore. Young one faces peril and gossip. No error.", "The wild
geese draw near the cliffs, eating and drinking in happy harmony. Good
fortune.", "The wild geese draw near to land. A man sets out, not to return. A
woman bears a dead child. Misfortune. Advantage to resist robbers.", "The wild
geese draw near the tree, seeking flat branches. No error.", "The wild geese
reach the hill. The woman bears no child for three years, then gives birth.
Good fortune.", "The wild geese reach the mountain. Their feathers can be used
for ceremony. Good fortune.")),

064 => array(54, "KUEI MEI / THE YOUNG BRIDE", "Misfortune in any venture. No
advantage.", "Thunder over the lake. The superior one, while looking to the
future, attends to present mistakes.", array("She marries as a secondary wife,
lame but able to progress. Good fortune in any venture.", "Blind in one eye yet
able to see. Advantage in the resolve of a hermit.", "She marries as a
concubine. Returning home, she remarries as a secondary wife.", "Postponed
marriage, happens at a later date.", "The Emperor I gave his daughter in
marriage. Her dress less ornate than her attendant's. The moon, almost full,
brings good fortune.", "Her basket is nearly empty. The slaughtered lamb is
bloodless. No advantage.")),

054 => array(55, "FENG / ABUNDANCE", "Prosperity. The ruler attaining abundance
should not be sad, but like the sun at midday.", "Thunder and lightning. The
superior one decides lawsuits and proper punishments.", array("Two rulers meet
for ten days. No regret. Advantage in a shared venture.", "So many curtains,
the pole star is visible at midday. Advancement arouses suspicion. Good fortune
in sincere persistence.", "The banner so large, a star is visible at midday.
Broken right arm. No Error.", "So many curtains, the pole star is visible at
midday. The two rulers meet. They are of like mind. Good fortune.", "Great ones
arrive. Rejoicing and good fortune.", "The house is large with curtains and
banners. Peeping through the door, the house is empty. For three years no one
is seen. Misfortune.")),

015 => array(56, "LU / THE WANDERER", "Success in small things. Firm
correctness brings good fortune to the wanderer.", "Fire on the mountain. The
superior one uses cautious wisdom when imposing penalties, ensuring no lawsuits
drag on.", array("The mean wanderer, busy with trivial things, earns
misfortune.", "The wanderer stays at an inn, with some possessions and a
trusted servant.", "The inn burns down. The servant is lost. Peril.", "The
wanderer is sheltering with an axe for protecting possessions. But no peace of
mind.", "Shooting a pheasant, losing an arrow. Eventual praise and
responsibility.", "A bird's nest on fire. First laughter, then weeping. An ox
is lost. Misfortune.")),

033 => array(57, "SUN / GENTLE PENETRATION", "Success in small things.
Advantage in any direction, and to see the great one.", "One wind follows
another. The superior one commands those below, and attends to affairs.",
array("Advancing or retreating, advantage in the discipline of a warrior.",
"Cowering under the bed, priests and exorcists are called for. Good fortune. No
Error.", "Repeated penetration. Regret.", "Regret vanishes. When hunting, three
kinds of game.", "Good fortune in firm correctness. Regret vanishes. No
Disadvantage. Not a good beginning, but a good ending. Deliberation three days
before and three days after brings good fortune.", "Cowering under the bed,
protection lost. Misfortune in persistence.")),

066 => array(58, "TUI / JOY", "Success. Advantage in firm correctness.", "Two
lakes together. The superior one with friends for discussion and activities.",
array("Joy of harmony. Good fortune.", "Joy in sincerity. Good fortune. Regret
disappears.", "Pleasure seeking. Misfortune.", "Choosing pleasures bring
unrest. After nearly meeting harm, joy.", "Trusting an enemy. Peril.", "Joy in
attracting others to pleasure.")),

023 => array(59, "HUAN / DISPERSION", "Prosperity. The ruler visits the temple.
Advantage to cross the great water, and in firm correctness.", "Wind over
water. Rulers of old built temples and made offerings to Heaven.",
array("Rescue with a strong horse. Good fortune.", "An opportunity seized at
the time of dispersion. Regret disappears.", "Selfish thoughts dispelled. No
regret.", "Dispersing those who have gathered around. Great good fortune.
Ordinary people do not understand that dispersion brings renewed gathering.",
"The ruler dispenses the royal granaries, body sweating. No error.", "Turning
away from bloodshed, retiring to a distant land. No Error.")),

062 => array(60, "CHIEH / LIMITATION", "Success. Do not persist with harsh
rules.", "Water over lake. The superior one creates number and measure,
debating virtue and correct conduct.", array("Not leaving the courtyard. No
error.", "Not leaving the courtyard. Misfortune.", "Ignoring the rules brings
regret. No blame.", "Observing the rules brings success.", "Sweetly observing
the rules brings good fortune. Going brings praise.", "Harsh rules bring
misfortune. Regret disappears.")),

063 => array(61, "CHUNG FU / INNER TRUTH", "Good fortune, even for pigs and
fish. Advantage to cross the great water, and in firm correctness.", "Wind
over lake. The superior one, slow to judge, delays execution.", array("Good
fortune in self-repose. Avoid distractions.", "A crane in the shade, says to
its young: I have good wine to share with you.", "Meeting another. Now beating
a drum, stopping, weeping, singing.", "The moon is nearly full. A team horse
strays. No error.", "Sincerity bring followers. No error.", "A cock's crowing
reaches heaven. Misfortune in persistence.")),

014 => array(62, "HSIAO KUO / SMALL GAINS", "Advantage in firm correctness.
Success in small things, not great. Only when a bird flies low is its song
heard. Great good fortune.", "Thunder over the mountain. The superior one shows
extreme humility in conduct, grief in mourning, and thrift in spending.",
array("A bird flies high, meeting misfortune.", "Passing a grandfather, meeting
a grandmother. Not seeing the ruler, meeting a minister. No error.", "Harm and
misfortune without extra defences.", "No error. Meeting peril with caution. Do
not persist with force.", "Dense clouds, no rain from the western borders. The
chief shoots and hits a bird in the cave.", "Overreaching, a bird flying too
high brings misfortune.")),

052 => array(63, "CHI CHI / COMPLETION", "Success in small matters. Advantage
in firm correctness. Initial good fortune. Eventual confusion.", "Water over
fire. The superior one protects against misfortune.", array("Applying the
brakes. A fox's tail gets wet in the stream. No error.", "She loses the curtain
on her carriage. No need to look for it. It will return on the seventh day.",
"Illustrious Ancestor conquered the barbarian after three year's campaigning.
Low people not to be used.", "Seeking rags to plug leaks. Alert all day.", "The
eastern neighbour slaughters an ox, while the western neighbour's small
offering receives its blessing.", "Head under water. Peril.")),

025 => array(64, "WEI CHI / BEFORE COMPLETION", "Success. A fox's tail gets wet
in the stream. No advantage.", "Fire over water. The superior one discriminates
between things, each in their proper place.", array("The fox's tail gets wet.
Regret.", "Applying the brakes. Good fortune in firm correctness.", "Unfinished
matters. Misfortune in persistence. Advantage to cross the great water.", "Good
fortune in firm correctness. Regret disappears. Roused to punish the barbarian.
In three years, great reward.", "Good fortune in firm correctness. No Regret.
The light of inner sincerity. Good fortune.", "Drinking wine within one's
limits. No blame. Excess wets the head. Sincerity compromised.")));

function ichingheader() {
 return "
=== I CHING = THE ORACLE OF CHANGE ============================================

<i>\"What you bring is the measure of what you get...\"</i>

<a href=#howto>Instructions</a> are included at the end of this text, which ".
"is best viewed/printed
in a monospace font (Courier, Lucida Console, etc.). <a href=#text>The ".
"text</a> includes the
imprisoned King Wen's DECISION, the later IMAGE attributed to Confucius, and
the LINES as explained by King Wen's son, the Duke of Chou. Confucian
commentaries on the decision, and any other commentaries are omitted for
brevity. The text can be further neutered by globally replacing 'superior man'
with 'superior one' (should you want to), without causing syntactic problems.

This page can be saved (as HTML or plain text) for OFFLINE VIEWING. You can
find an ONLINE VERSION, featuring WAP/WEB consultation and free PHP script at:


Any comments/suggestions/corrections will be gratefully received.

Copyright (c) ".MODIFIED." <a href=mailto:d(@)vidwest.net>d(@)vidwest.net</a>

<a name=text></a>--- THE SIXTY-FOUR HEXAGRAMS ".


function ichingfooter() {
 return "<a name=howto></a>
--- HOW TO CONSULT THE ORACLE USING THREE COINS -------------------------------

(See also the <a href=#yarrow>traditional yarrow</a> and <a href=#coin4>four".
" coins</a> methods below).

First, think of your question, phrasing it as best you can.

Toss THREE COINS, scoring 3 for a head (H), 2 for a tail (T). From the table
below, draw a line depending on the total. Toss the coins five more times,
drawing each new line above the last, giving a HEXAGRAM made from two TRIGRAMS.

 Total Line  Meaning     Coins       (Probability)

 6     - x - moving Yin  TTT         (1/8)
 7     ----- Yang        HTT+THT+TTH (3/8)
 8     -- -- Yin         HHT+HTH+THH (3/8)
 9     --o-- moving Yang HHH         (1/8)

Any moving lines in the resulting MAIN hexagram have special significance, with
explanations in the text. Also, a CHANGED hexagram should be drawn by
converting moving Yin lines to Yang, moving Yang lines to Yin, and leaving the
others unchanged. The changed hexagram offers clues to the future.
<a name=i></a>
Use the following table to read off the number matching your hexagram(s), and
see the main text above for the meanings of the hexagrams and any moving lines.

 TRIGRAMS     -- -- ----- -- -- ----- -- -- ----- -- -- -----
 Above:       -- -- -- -- ----- ----- -- -- -- -- ----- -----
              -- -- -- -- -- -- -- -- ----- ----- ----- -----
 Below:       K'UN  KEN   K'AN  SUN   CHEN  LI    TUI  CH'IEN
 -- -- K'UN
 -- -- Earth  <a href=#h2 name=i2>2</a>     <a href=#h23 name=i23>23</a>".
"    <a href=#h8 name=i8>8</a>     <a href=#h20 name=i20>20</a>".
"    <a href=#h16 name=i16>16</a>    <a href=#h35 name=i35>35</a>".
"    <a href=#h45 name=i45>45</a>    <a href=#h12 name=i12>12</a>
 -- --

 ----- KEN
 -- -- Mount  <a href=#h15 name=i15>15</a>    <a href=#h52 name=i52>52</a>".
"    <a href=#h39 name=i39>39</a>    <a href=#h53 name=i53>53</a>".
"    <a href=#h62 name=i62>62</a>    <a href=#h56 name=i56>56</a>".
"    <a href=#h31 name=i31>31</a>    <a href=#h33 name=i33>33</a>
 -- -- -ain

 -- -- K'AN
 ----- Water  <a href=#h7 name=i7>7</a>     <a href=#h4 name=i4>4</a> ".
"    <a href=#h29 name=i29>29</a>    <a href=#h59 name=i59>59</a>".
"    <a href=#h40 name=i40>40</a>    <a href=#h64 name=i64>64</a>".
"    <a href=#h47 name=i47>47</a>    <a href=#h6 name=i6>6</a>
 -- --

 ----- SUN
 ----- Wind   <a href=#h46 name=i46>46</a>    <a href=#h18 name=i18>18</a>".
"    <a href=#h48 name=i48>48</a>    <a href=#h57 name=i57>57</a>".
"    <a href=#h32 name=i32>32</a>    <a href=#h50 name=i50>50</a>".
"    <a href=#h28 name=i28>28</a>    <a href=#h44 name=i44>44</a>
 -- --

 -- -- CHEN
 -- -- Thund  <a href=#h24 name=i24>24</a>    <a href=#h27 name=i27>27</a>".
"    <a href=#h3 name=i3>3</a>     <a href=#h42 name=i42>42</a>".
"    <a href=#h51 name=i51>51</a>    <a href=#h21 name=i21>21</a>".
"    <a href=#h17 name=i17>17</a>    <a href=#h25 name=i25>25</a>
 ----- -er

 ----- LI
 -- -- Fire   <a href=#h36 name=i36>36</a>    <a href=#h22 name=i22>22</a>".
"    <a href=#h63 name=i63>63</a>    <a href=#h37 name=i37>37</a>".
"    <a href=#h55 name=i55>55</a>    <a href=#h30 name=i30>30</a>".
"    <a href=#h49 name=i49>49</a>    <a href=#h13 name=i13>13</a>

 -- -- TUI
 ----- Lake   <a href=#h19 name=i19>19</a>    <a href=#h41 name=i41>41</a>".
"    <a href=#h60 name=i60>60</a>    <a href=#h61 name=i61>61</a>".
"    <a href=#h54 name=i54>54</a>    <a href=#h38 name=i38>38</a>".
"    <a href=#h58 name=i58>58</a>    <a href=#h10 name=i10>10</a>

 ----- CH'IEN
 ----- Heaven <a href=#h11 name=i11>11</a>    <a href=#h26 name=i26>26</a>".
"    <a href=#h5 name=i5>5</a>     <a href=#h9 name=i9>9</a> ".
"    <a href=#h34 name=i34>34</a>    <a href=#h14 name=i14>14</a>".
"    <a href=#h43 name=i43>43</a>    <a href=#h1 name=i1>1</a>

EXAMPLE: 'Am I explaining this clearly...?'
I toss TTH=7, HHH=9, HHH=9, THT=7, HHT=8 and HHH=9, giving:

 --o-- as my main hexagram, and -- -- as my changed hexagram.
 -- --                          -- --
 ----- (trigram = LI)           ----- (trigram = CHEN)
 --o--                          -- --
 --o--                          -- --
 ----- (trigram = CH'IEN)       ----- (trigram = CHEN)

I search for '14' in the main text above and find TA YU / WEALTH. I read the
decision (success!), image, and explanations for the 2nd, 3rd and top lines,
seeing these as a progression. I then search for '51', find CHEN / THUNDER, and
glean the outcome from the judgement and image of that hexagram.

<a href=#top>Top</a>
<a name=yarrow></a>
--- HOW TO GENERATE A HEXAGRAM USING YARROW STALKS ----------------------------

This method is quite an involved ritual that gets easier with practice.
Meditate on your question throughout...

1. Take 50 yarrow stalks (long match sticks will do), and put one aside which
   will be the unused 'observer'.
    /    /////////////////////////////////////////////////
2. DIVIDE those stalks not set aside INTO TWO BUNDLES, side by side.
    /    ///////////////////////////     //////////////////////
3. Take ONE STALK FROM THE RIGHT hand bundle, and put this between the little
   and ring fingers of your left hand. Take the left bundle in the left hand.
    /  | |||||||||||||||||||||||||||      /////////////////////
4. REMOVE GROUPS OF FOUR stalks from the bundle you hold, returning them to
   where they were taken, UNTIL FOUR OR FEWER remain. Place these between the
   ring and middle fingers of your left hand.
    /  | |||  //// //// //// //// ////    /////////////////////
5. Take the RIGHT HAND BUNDLE in your left hand, and repeat step 4, but placing
   the remainder between the middle and index fingers of the left hand.
    /  | ||| |  ////////////////////////  //// //// //// //// ////
6. Counting the stalks between the left hand fingers, SCORE '2' if there are
   NINE, '3' if there are FIVE (any other number indicates an error: repeat
   steps 2 to 6). Lay these stalks aside, and reassemble the two bundles.
    /  /////=3  ////////////////////////////////////////////
7. Repeat steps 2 to 6, but SCORE '2' if EIGHT stalks are held between your
   fingers, '3' if there are FOUR.
    /  /////=3 + ////////=2  ////////////////////////////////////
8. Repeat step 7, and TOTAL YOUR SCORE: this gives you your FIRST LINE, as per
   the table below.
    /  /////=3 + ////////=2 + ////=3  ////////////////////////////////
9. Reassemble the 49 stalks. Repeat steps 2 to 8 FIVE MORE TIMES, recording
   each new line above the last.

 Total Line  Meaning     Stalks(Probability/4)                  (Probability)

 6     - x - moving Yin  9(1)8(2)8(2)                           ( 4/64)
 7     ----- Yang        9(1)8(2)4(2)+9(1)4(2)8(2)+5(3)4(2)4(2) (20/64)
 8     -- -- Yin         9(1)4(2)4(2)+5(3)8(2)4(2)+5(3)4(2)8(2) (28/64)
 9     --o-- moving Yang 5(3)4(2)4(2)                           (12/64)

Note that the probabilities are different from the coin method. Also note that
the totals can be derived by summing the stalks between the left hand fingers
(25, 21, 17 or 13), subtracting this form 49, and dividing by 4. For example,
(49-17)/4 = 8.

<a href=#top>Top</a>
<a name=coin4></a>
--- HOW SIMULATE THE YARROW METHOD WITH FOUR COINS ----------------------------

Calculate the scores for each line as follows: toss TWO SILVER coins and TWO
COPPER coins together. If the BOTH SILVER coins are tails, score 2, otherwise
score 3. EACH COPPER coin scores 2 for a tail, 3 for a head. The resulting
total scores have the same probabilities as the yarrow method (see table
above). The silver coins correspond to the first division of the 49 stalks,
while the copper coins correspond to the subsequent divisions.

This method is mathematically equivalent only!

<a href=#top>Top</a>


// --- cut below this line --- ?>