Comment by jackzhuo
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!