{{ message }}

# Brianfit / I-Ching

A programmatic replication of the Yarrow Stalk Method of I-Ching Divination

## Files

Failed to load latest commit information.
Type
Name
Commit time

# I-Ching

A programmatic replication of the Yarrow Stalk Method of I-Ching Divination

This code is free to use. If you like it, you can buy me a coffee! (I really like coffee)

The javascript here is the core of a fairly popular app I've written to consult the I-Ching. This code randomly generates a hexagram of six lines according to a bronze-age methodology of sorting Yarrow Stalks. Here's an overly long explanation of that method and why it's statistically different from the three-coin method of generating hexagrams that most of us learned in the west.

Take 50 stalks. Remove one, set it aside. Randomly separate the remaining 49 stalks into two piles, East and West. Take one stalk from the West heap and hold it between thumb and forefinger of your left hand. Take stalks in groups of four from the East pile, until four or fewer stalks remain. Keep this remainder, place it between the ring and middle finger of the left hand. Take stalks in groups of four from the West pile until four or fewer stalks remain. Keep this remainder, and place it between the middle and forefingers of the left hand.

Your left hand now holds a sum of stalks equal to 9 or 5, being made up of one of the following possibilities:

1+1+3=5

1+2+2=5

1+3+1=5

1+4+4=9

If the number of stalks is nine, a value of 2 is assigned to this counting. If it was five, the number three is assigned. The 9 or 5 stalks are put aside.

The rest of the stalks (40 or 44 by now) are again divided into two piles and counted off as above. The possible outcomes this time are:

1+1+2=4

1+2+1=4

1+3+4=8

1+4+3=8

This time, an 8 stalk remainder is assigned the number

A 4 stalk remainder receives a 3. The four or eight stalks are set aside, and the remaining 36, 40, 32, or 38 stalks are again divided in two and counted off. The possibilities are again:

1+1+2=4

1+2+1=4

1+3+4=8

1+4+3=8

And again a remainder of 8 is valued at 2, a remainder of 4 at 3.

From these three operations result the following possibilities:

2+2+3=7

2+3+3=8

2+3+2=7

2+2+2=6

3+2+2=7

3+3+2=8

3+2+3=8

3+3+3=9

It is these results which determine whether a line is solid or broken. A 7 meant a strong, solid line. An 8 meant a yielding, broken line. A 9 was considered a strong moving toward yielding line. A 6 was a yielding moving toward strong line.

By repeating the above process six times, a hexagram was built up from the bottom.

Like most westerners exposed to the I-Ching, I was taught the coin method of generating a line, which is far easier than the method above. By this method, three coins are tossed. Heads are worth 2, tails 3. The possibilities were thus:

Tail+Tail+Tail=9

This means, however, a slight difference in probabilities from the yarrow stalk method. The chance of any one coin being head or tail is ALWAYS 50/50. However, the chance of a "Tail" on the first "Toss" in the yarrow stalk method is almost 3 to 1. Recall, the possible results for the first division of 49 stalks was this:

1+1+3=5 (Value 3)

1+2+2=5 (Value 3)

1+3+1=5 (Value 3)

1+4+4=9 (Value 2)

Of four possible outcomes, three of them result in a 5, only one in a 9. This means, in effect, that when we look to the lines, those generated by a 2 in the first place are less likely to occur than those that start with a 3:

Less likely:

2+2+3=7 (Strong)

2+3+3=8 (Yielding)

2+3+2=7 (Strong)

2+2+2=6 (Yielding Changing)

More likely:

3+2+2=7 (Strong)

3+3+2=8 (Yielding)

3+2+3=8 (Yielding)

3+3+3=9 (Strong Changing)

It therefore makes sense that unchanging Yielding lines are slightly more likely to show up than unchanging Strong lines, and that a yielding changing line is the least likely all possible combinations to turn up. This is because unlike the regular yielding and strong lines, the changing lines are each generated by only one possible combination of stalks. The yielding, changing combination, because it begins with 2, is therefore heavily disfavored over the strong changing line.

Which is all just to say that the coin method does not hold the same built-in bias that the yarrow stalk method has. Surely note must have been made by the ancients that a 6 was a relatively rare occurrence indeed. Certainly, anyone in frequent consultation with the book by the yarrow stalk method would have noted the anomaly. I noticed the reticence of 6 after many many runs of the developing program and thought my coding was somehow flawed. But no! Perseverance furthers. No Blame.

Update: Wikipedia sums up all that blather very succinctly:

Number Yarrow stick probability Three coin probability YinYang Signification Symbol
6 1/16 8/16 2/16 8/16 old yin yin changing into yang ---x---
8 7/16 6/16 young yin yin unchanging ---  ---
9 3/16 8/16 2/16 8/16 old yang yang changing into yin ---o---
7 5/16 6/16 young yang yang unchanging --------

If you enjoyed this, you can buy me a coffee! (Did I mention I really like coffee)

A programmatic replication of the Yarrow Stalk Method of I-Ching Divination