
Photo by Дмитрий Хрусталев-Григорьев on Unsplash
I-Ching
Consult an ancient oracle on a modern webpage.
May 12, 2023 at 8:53 pm
It's difficult to live a spiritual life in Southern California. Here toxic body images and inflated egos are unavoidable, but a Taoist outlook keeps me humble. How can you be upset or self-conscious when you realize nothing lasts forever? To the Taoist, life is nothing more than a rhythmic tidal current of lows and highs, yin and yang.
Yet one of the few things to remain constant over the past three millennia is the I-Ching. It is a divinatory reference for China's ancient oracles and one of the most famous texts of Taoism. Personally, I find it to be a bit too esoteric (and that's saying a lot!), but I'm interested in the parts of the I-Ching that are related to computer science, mainly binary code.
The old text combines the binary of yin and yang in triplicate to form eight classical elements (2^3=8), then joins these elements into 64 different pairs (8^2=64) called hexagrams. I found it mathematically fascinating and decided to write my own JavaScript program for telling fortunes with the I-Ching.
The divination method and logic were pretty straightforward and therefore easy to implement as JavaScript, but making it all look realistic was a different story. Modern I-Ching readings involve flipping three coins six times to get a hexagram, and I had a vision of three virtual coins flipping and falling on the screen before the user sees a reading. It was an enjoyable design challenge that combined separate CSS animations at random intervals set with JavaScript. I wrote a post about the flip animations here.
What was once a single boring click is now a dynamic experience. The user feels even more actively involved in their reading by watching the coin flips that will determine their fate. I highly encourage you to check it out here. Who knows? You might end up with some good advice.