Fun fact: archaeological evidence on I Ching divinatory records shows an hexagram distribution different from the one produced by the yarrow stalk method. Meaning that, while it is now considered the traditional method, it was likely not the original approach.
To be honest, my reason for picking this method was simple: I was reading a book about the I Ching that described the different ways to cast hexagrams.
The Yarrow Stalk method stood out to me because it felt more mysterious—in the past, it seemed like a secret method known only by a few experts.
Also, from a coding perspective, this algorithm was just much more interesting to build than a simple coin toss!
I doubt it. The I Ching does not really have bad / low interest hexagrams. Also historians who studied the topic seem pretty sure that the yarrow stalk method is a recent introduction (by I Ching standards, we are talking about a bronze age divination tool...).
I spent the last 24 hours implementing the feedback from this thread. Thank you all for the harsh (but fair) critique.
1. Ditched AI for the Classics Many of you pointed out that AI interpretations felt "soulless" or risky. I agreed.
Now: The app directly displays the canonical Richard Wilhelm / Cary Baynes translation (Foreword by Carl Jung) for the Primary Hexagram, Moving Lines, and the Relating Hexagram. It's mathematically precise and respects the source material.
2. No More Lost Readings (Persistence) @jmkd mentioned losing a reading on refresh.
Fix: The latest reading is now auto-saved to Local Storage.
Privacy: Still no login required. Your data stays in your browser.
3. Shareable "Result Cards" Since the hexagrams look so cool, I added a feature to generate a downloadable image card. It captures the visual pattern and the key judgment text.
Give it another spin and let me know if the "Moving Lines" logic feels right to you now!
Some kind of text on what the resulting hexagrams mean along with their names would be nice for those of us who haven't memorized the meaning of all sixty-four.
I'm curious, and I figure you would know more about this than I do: when using real yarrow stalks for the I Ching, how do you split them into groups? I mean like, roughly equal? Don't think about it too much and just split? Just separating them into, say, groups where one group is just a single stalk doesn't seem random.
I guess it's a question of philosophy, either split into groups based off of your intuition, or aim for a truly random split in the pile.
Anyway, I wasn't sure if this is something that's a settled matter or what.
OP here. This discussion is exactly why I implemented the Box-Muller transform!
You are right that humans don't split perfectly randomly (Uniform Distribution). We tend to aim for the middle but miss slightly.
In my code, I modeled this 'human splitting action' using a Gaussian (Normal) distribution centered at 50% of the pile, with a standard deviation. This simulates the user trying to split the stalks roughly in half, rather than just picking a random number from 0 to 49.
Interestingly, my Monte Carlo simulations showed that even with this human bias (splitting near the middle), the final modulo-4 probabilities remain stable. So the algorithm is robust even against our 'imperfect' hands.
Functionally it makes no difference whether you split near the middle or not -- a truly random selection would sometimes end up with a pile of one, and that's totally fine. As long as you're not trying to game the system by, say, specifically counting out the sticks to get the outcome you want, it makes no difference. (and if you're doing that, then what's the point?)
Splitting closer to the middle does make it easier to avoid unintentionally counting though. If you make the same splits every time, you'll get the same outcome of course.
Philosophically / spiritually speaking, "don't think about it too much and just split wherever feels right" is the simple answer. Keep in mind the question you want to ask when you make the split and let whatever happens happen. Close your eyes if it helps you focus.
> Functionally it makes no difference whether you split near the middle or not -- a truly random selection would sometimes end up with a pile of one, and that's totally fine.
Yeah I just mean I would be very conscious of splitting with a single stalk in one group and would wonder if that was really a 'fair' selection or something I did intentionally since I know the exact number of the yarrow in one hand. In practice, I can't imagine anyone would make a selection like that, even though in a truly random system it would happen not infrequently.
Having a certain number in one hand is still a couple steps removed from getting a specific outcome, so there isn't anything inherently 'unfair' about it. My point was more that it's the intention that matters. If you make a split because it feels right, with your question in mind, then it's fine if it's totally uneven and/or you're aware of how many there are. Splits like that do happen from time to time, it's all part of it.
Any sites that give nice barebones explanation of the results? I imagine filling more of the blanks myself instead of AI is part of the exercise, but a nice starting point can help.
The canonical western text is Richard Wilhelm's german interpretation, translated to english by Cary Baynes. This site has the hexagram descriptions from that translation: https://www.iching.online/wilhelm.php
I recommend buying the book though. It is fascinating whether or not you buy into it.
I got a result using coins but could find no link to the hexagram so had to look it up on another site. While I was clicking around your site trying to find the hexagram then I lost my reading and back button didn't work, so changing lines etc were lost. I would love to use this more but not in current state.
You are raising a critical UX issue. Currently, I haven't implemented user accounts or a database because I wanted to keep the app simple and login-free.
However, that shouldn't mean losing your data on a refresh! I will prioritize a fix using Local Storage so your current reading persists even if you hit the back button.
I'll also make the result link much more obvious so you don't have to hunt for it. Really appreciate you trying it out despite the rough edges!
I probably stared at it for too long on my own monitor and got used to it. I will bump up the contrast in the next update to ensure it's readable for everyone.
The hexagrams can be modeled with only 6-bits, but this does not contains enough information for a proper reading of I Ching which also need to account for line changes. So there are really 4 lines: young yin, old yin, young yang, old yang.
A fundamental part of I Ching reading is the implication that each present state is in the process of transforming to another.
Spot on! This is exactly why a simple Math.random() > 0.5 binary flip isn't enough for a proper simulation.You are right that we are mathematically dealing with base-4 logic (6, 7, 8, 9), not just base-2.While there are only 64 hexagrams ($2^6$), there are actually 4,096 possible casting results ($4^6$) when you account for the moving lines. My algorithm is designed specifically to capture the distinct probabilities for all 4 states.
This is a great project btw! I've long been fascinated by the 易经 especially the different probability distributions associated with the different methods of generating the lines. It's been a while but I used to have an actual set of yarrow stalks!
Thank you! That means a lot coming from someone who appreciates the probability mechanics behind it.
Since you have experience with the actual stalks, I think you'll like the update I just pushed: I’ve fully integrated the classic Wilhelm/Baynes text to ensure the reading has that authentic, traditional grounding you mentioned.
I also added a way to generate a visual card of the result—trying to bring back a bit of that 'tangible artifact' feel of the physical ritual. :)
I can’t get this to work on iOS at all - question - coin or yarrow choice - then what? No links seem to be hot/working. A little tutorial would be great. Fun project!
Hi Dan, thanks for the heads up. I have fixed the mobile bug and deployed the update. It should be working for everyone now. I've also replied to the users above.
Thanks for flagging the Firefox Focus issue. I've just pushed a fix for mobile browsers. It should be loading correctly now. Let me know if it works for you!
To be honest, my reason for picking this method was simple: I was reading a book about the I Ching that described the different ways to cast hexagrams.
The Yarrow Stalk method stood out to me because it felt more mysterious—in the past, it seemed like a secret method known only by a few experts.
Also, from a coding perspective, this algorithm was just much more interesting to build than a simple coin toss!
I spent the last 24 hours implementing the feedback from this thread. Thank you all for the harsh (but fair) critique.
1. Ditched AI for the Classics Many of you pointed out that AI interpretations felt "soulless" or risky. I agreed.
Now: The app directly displays the canonical Richard Wilhelm / Cary Baynes translation (Foreword by Carl Jung) for the Primary Hexagram, Moving Lines, and the Relating Hexagram. It's mathematically precise and respects the source material.
2. No More Lost Readings (Persistence) @jmkd mentioned losing a reading on refresh.
Fix: The latest reading is now auto-saved to Local Storage.
Privacy: Still no login required. Your data stays in your browser.
3. Shareable "Result Cards" Since the hexagrams look so cool, I added a feature to generate a downloadable image card. It captures the visual pattern and the key judgment text.
Give it another spin and let me know if the "Moving Lines" logic feels right to you now!
To be honest, I haven't added it because I'm hesitating. I planned to use AI to generate the interpretations, but I'm not sure if that's a good idea.
I feel like letting AI explain the I Ching might kill the 'traditional vibe'.
I'm still deciding: should I use AI, or just use the classic book text? What do you think?
_____ (black bar, 7)
_____ (black bar, 7)
__.__ (grey bar, marked by green dot in the middle, 9)
__ __ (two short black bars with gap in the middle, 8)
__.__ (grey bar, marked by green dot in the middle, 9)
__ __ (two short black bars with gap in the middle, 8)
Primary Hexagram 6. CONFLICT (Sung)
Relating Hexagram 20. CONTEMPLATION (Kuan)
Reverse engineer the question :->
I guess it's a question of philosophy, either split into groups based off of your intuition, or aim for a truly random split in the pile.
Anyway, I wasn't sure if this is something that's a settled matter or what.
You are right that humans don't split perfectly randomly (Uniform Distribution). We tend to aim for the middle but miss slightly.
In my code, I modeled this 'human splitting action' using a Gaussian (Normal) distribution centered at 50% of the pile, with a standard deviation. This simulates the user trying to split the stalks roughly in half, rather than just picking a random number from 0 to 49.
Interestingly, my Monte Carlo simulations showed that even with this human bias (splitting near the middle), the final modulo-4 probabilities remain stable. So the algorithm is robust even against our 'imperfect' hands.
Speaking of 'neatness', I just pushed an update that lets you generate a visual Result Card of your reading.
So now you can get a nice downloadable souvenir of that Gaussian-distributed hexagram. :D
Splitting closer to the middle does make it easier to avoid unintentionally counting though. If you make the same splits every time, you'll get the same outcome of course.
Philosophically / spiritually speaking, "don't think about it too much and just split wherever feels right" is the simple answer. Keep in mind the question you want to ask when you make the split and let whatever happens happen. Close your eyes if it helps you focus.
Yeah I just mean I would be very conscious of splitting with a single stalk in one group and would wonder if that was really a 'fair' selection or something I did intentionally since I know the exact number of the yarrow in one hand. In practice, I can't imagine anyone would make a selection like that, even though in a truly random system it would happen not infrequently.
It got tiring and boring to click and click and click with the mouse with no explanation for how it works
I recommend buying the book though. It is fascinating whether or not you buy into it.
Have you built a web app or a mobile app? I'd love to check out your work if you have a link!
You are raising a critical UX issue. Currently, I haven't implemented user accounts or a database because I wanted to keep the app simple and login-free.
However, that shouldn't mean losing your data on a refresh! I will prioritize a fix using Local Storage so your current reading persists even if you hit the back button.
I'll also make the result link much more obvious so you don't have to hunt for it. Really appreciate you trying it out despite the rough edges!
Original Hexagram 45. GATHERING TOGETHER (MASSING) (Ts'ui)
Transformed Hexagram 17. FOLLOWING (Sui)
Ok.
My interpretation for your power supply:
Gathering (45): You need to gather some capacitors? (or maybe a heat sink for the 'massing'?)
Following (17): Clearly it's telling you to use a Voltage Follower. :D
I probably stared at it for too long on my own monitor and got used to it. I will bump up the contrast in the next update to ensure it's readable for everyone.
https://www.urbandictionary.com/define.php?term=A+Suffusion+...
A fundamental part of I Ching reading is the implication that each present state is in the process of transforming to another.
Since you have experience with the actual stalks, I think you'll like the update I just pushed: I’ve fully integrated the classic Wilhelm/Baynes text to ensure the reading has that authentic, traditional grounding you mentioned.
I also added a way to generate a visual card of the result—trying to bring back a bit of that 'tangible artifact' feel of the physical ritual. :)
I just identified the issue (it was a specific mobile browser compatibility bug). I have deployed a hotfix and it should be working now on iOS.
Could you please give it another try? Sorry for the trouble!