Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 3 / MARCH 1983 / PAGE 188

Predicting the future. Michael Crichton.

Predicting the Future

Although it is at least 3000 years old, the I Ching, a Chinese method of divination, employs what we would now call a binary techinque. In its simplest form, three coins are tossed six times to create a six-line figure of broken and unbroken lines. This so-called hexagram is then interpreted by consulting the I Ching, or Book of Changes.

This Book is older than the Bible; tradition dates its origin to 1120 B.C., five hundred years before Confucius added his commentaries. Over the centries the I Ching has been studied as a religious text and a philosophical masterpiece. But the I Ching is also unquestionably a method for predicting the future, and this aspect has received much attention during the twentieth century.

It is fundamental to the I Ching that the future can be understood in perpetually changing patterns of off/on, yes/no, heads/tails, broken/unbroken. This binary aspect suggests the ancient technique is highly appropriate for adaptation to a computer. One might say that the I Ching treats reality the same way a computer does.

This idea may horrify purists. Those who consider the methods of the I Ching sacred--properly conducted only with ritual, incense, meditation and the complex tossing of yarrow sticks--may find a computer a chilling perversion of ancient beliefs.

But in fact there is no agreement on what makes the system work. On modern expert, John Blofeld, while testifying to the power of I Ching, denies any comprehension of how it works. Thus it is perfectly possible that a computer could cast the I Ching effectively.

For instance, one idea of the way the I Ching works is that your unconscious knows, through psi phenomena, how the coins will turn up even before you throw them, although your conscious mind remains convinced the coin toss is "random.' From this perspective, the I Ching can be seen as a method of making you aware of what your unconscious is doing.

If this is true, your unconscious is also aware of multiple states of electronic interaction within the Apple computer as it cycles rapidly from one memory location to the next. You touch the keyboard according to some understanding your subconscious has of the state of the machine at that moment.

A more radical statement argues that your unconsious actually controls the outcome of the coin toss, or the state of the electrons within the computer. According to this idea, you touch the keyboard once you have made the state of the computer fit your subconscious wishes and desires.

These speculations are fun and intriguing. It was in the spirit of experimentation that the following program was written--and also in the spirit of laziness. For however one casts the I Ching, a good deal of bookwork is required. Line numbers for individual casts must be noted down; trigrams and hexagrams looked up in tables; derivative hexagrams generated. I find all this tedious, and I am prone to error in carrying it out.

How To Use The Program

The program allows the user to cast the I Ching with coins or with the random number generator of the computer itself.

If done with coins, three similar coins are selected. Heads are given a value of 2, and tails, 3. The coins are thrown and each throw is summed. If the throw is all heads, the sum is 2 + 2 + 2 = 6. If the throw is two heads, one tails, it is 7; if two tails, one head, it is 8. If it is all tails, the sum is 3 + 3 + 3 = 9. After each throw, the sum is entered into the computer, which checks to make sure the value is between 6 and 9. After six entries, imput stops.

The keyboard is used to cast by computer. Any key or keys can be pressed, at any time or in any order. After six key presses, input stops.

From this point the program proceeds quietly, without beeps or blinks, to generate the hexagrams and their titles. The primary hexagon is drawn, based on the numerical values of the six lines, reading from bottom to top. Pressing any key will add the hexagram unmber and name, as well as the line values from bottom to top.

An additional keypress creates all possible derivative hexagrams, and prints their hexagram numbers. One should note here that while all authorities agree on the validity of the secondary hexagram, and some agree on the validity of the first nuclear hexagram, the value of the second unclear hexagram is controversial. Nevertheless, since some users of the I Ching employ it, I have included it.

A final keypress summarizes the information for the casting, provides a printout option, and ends the program. There is no loop back to run the program again--most users believe that the I Ching should not be thrown too often!

The program does not provide interpretation. To interpret the figures one must consult the Book of Changes itself. The most widely accepted reference is the Richard Wilhelm translation, published in the Bollingen Series by the Princeton University Press. (This program uses the hexagram names of the Wilhelm translation.)

A more modern, and excellent, text is I Ching, translated and edited by John Blofeld, available in Dutton paperback. Blofeld's test concentrates on divination, and is lively and interesting.

The oldest translation of the I Ching is by James Legge, a nineteenth century scholar. Re-issued in Bantam paperback, it is considered less satisfactory by many scholars and is sertainly more difficult to use.

Each text devotes several pages of discussion to each hexagram. The text also provides a detailed interpretation of each line of the hexagram. (Users should note that derived hexagrams are interpreted without reference to specific line numbers. One reads the line number notations for the primary hexagram only. )

How The Program Works

Initially, the program loads an array of 64 hexagrams and a lookup array to determine the hexagram number from the individual trigram pairs.

Lines 100-560 accept input from either coins or machine. Individual values are POKED into specific memory locations.

Evaluation begins on line 600. A background is drawn in low-res graphics, and the lines are created by the subroutine at 2000.

To this point, the program is straightforward. But to look up the hexagram numbers, some intricacies must occur. By convention, each hexagram is divided into lower and upper three-line trigrams. Before defining the hexagram, these trigrams must be standardized with string subroutines. (For example, a trigram of three solid bars might represent numerical values of 999, 997, 977, 777, 779, 797, or 979. These seven possibilities must be set to a single standard value before looking the hexagram up in the table. ) This standardization occurs in subroutines 2200 and 3000, which convert any three-line trigram to a single number from 1 to 8.

The standardized numerical values are then related to a look-up data table starting on line 3500 and the hexagram number obtained. Next, the corresponding response string is obtained from the data listing in lines 4000-4660, and the result sent to the screen. For the primary hexagram, this occurs on line 790.

Secondary and nuclear hexagrams are then generated according to accepted rules of transposition. These figures in turn are broken into their component trigrams, submitted to the standardizing string subroutines, and then read from the lookup and response tables.

Modifications To The Program

This program is long, and deletions are certainly possible. The instructions, which begin at line 6000, comprise roughly one fifth of the code. I wrote them elaborately to assist friends unfamiliar with the I Ching, but sophisticated users can shorten this section or eliminate it entirely.

If you want immediate identification of the original hexagram, delete line 690. If you agree with those scholars who consider the second unclear hexagram a worthless artifact, make the following changes:

Delete 920-950

Delete 1170-1200

Change 1230 to HTAB 10: PRINT N1

Delete 1340-1350

And if you agree with the strict authorities who reject the notion of nuclear hexagrams altogether, made the following additional changes:

Delete 870-910

Delete 1110-1150

Delete 1230

Delete 1320-1330

The most obvious limitation of the program is that is does not provide interpretation beyond hexagram name and number. The program can, of course, be modified to provide interpretation, though this strikes me as unwise. In the Wilhelm I Ching, each hexagram is given roughly 2700 words of interpretation, nearly 173,000 words for all 64 hexagrams. Even if one compressed this material--a step I would hesitate to undertake--one would still face a massive typing job. It makes more sense to refer to a book than to enter even a summary of the text.

However, for those who want the program to go further, the additions in Listing 1 will allow up to 510 characters of interpretation for each hexagram.

In addition, between lines 4700 and 6000, 128 DATA statements must be entered, summarizing the text for each hexagram in order, allowing two statements per hexagram, as the user sees fit.

It is, of course, possible to take the interpretation further, to provide a reading of individual lines; I leave consideration of such changes to whoever is motivated to do them.

An easier modification enables the program to give a sense of time, for questions having to the form "When will such-and-such happen?' The I Ching is often not satisfying in dealing with time questions, but the hexagrams do have seasonal associations, and a table of timing is found on page 225 of the Blofeld translation. It can be easily entered into the program with the following changes shown in Listing 2.

These changes sumply increase the number of rows in the response table. Now, referring to the Blofeld table, the response data from 4020 to 4650 must be modified by adding the appropriate month to each hexagram, thus:

4020 DATA THE CREATIVE, MAY down to:


Finally, one can tighten the code. I have not bothered to do so. When, during debugging, I got the hexagram #63 AFTER COMPLETION, I cheerfully quit.

In summary, I have found the I Ching a powerful tool for understanding any question it is posed. I hope this program will stimulate other users to explore the deeper connections between ancient thought, apparently "chance' events, and microchip technology.

Acknowledgements: As a frequent journal reader, I'm sure that bits of previously published techniques have crept into this program; I am grateful to those contributors who have helped me. I would also like to thank Brugh Joy, M.D. for first introducing me to the I Ching.


1. The I Ching or Book of Changes. The Richard Wilhelm Translation rendered into English by Cary F. Baynes, Bollingen Series XIX, 1977, Princeton University Press.

2. I Ching (The Book of Change). Translated and Edited by John Blofeld, 1968, E.P. Dutton.

3. I Ching or Book of Changes. Translated by James Legge, 1969, Bantam Books.

Table: Listing 1.

Table: Listing 2.