The Back Story
I originally wrote this software as a piece of PC DOS shareware, distributed via floppy disk and CompuServe, in 1989. It became an app for iPhone, Android, iPad, and Apple Watch in 2015, after a couple loyal users asked me to bring it out of the stone age and one extremely loyal user helped me unlock it from its floppy-disk carbon-freeze. Here's the story of the software's beginning, from the original 1989 release of what was then called I-Ching.exe. The full documentation of that project is available here.
The I-Ching found me through a girl, Maggie Condron, whom I was dating in college. She had an absolutely gorgeous hard-cover copy of the book, three real Chinese coins, and made quite an elaborate ceremony of consulting it. The book had a special pillow set up like an altar. There were candles, incense. I was skeptical about the whole thing, and raised a few Spockish Eyebrows, but the whole production was bewitching, and there was undeniable magic, even if the magic was nothing more than the good old alchemy of words.
I had rummaged around bookstores for a couple months trying to find my own copy, to no avail.
One day, Maggie and I were selling a bunch of used books at Second Story books in Washington, DC. Someone had just brought in a box before me which was still on the counter, unsorted. Lying on top was a mint condition copy of the Wilhelm-Baynes translation. Maggie looked at me with a cynicism-challenging smirk. I looked at my shoebox full of rat-eared paperbacks, picked up the beautiful hardbound I-ching and said "Trade?" It was one of synchronicity's finest hours.
When I started messing around with computers in the mid 80s, the parallels between the I-ching and software kept jumping out at me. Both are binary systems, built of ones and zeros and yesses and nos. 64 hexagrams, 64k memory, 512 texts etc etc -- it seemed the I-ching and computers were made for each other.
What I didn't know at the time was there's actually a direct connection between the binary math that computers use and the book:
The modern binary number system, the basis for binary code, was invented by Gottfried Leibniz in 1679 and appears in his article Explication de l'Arithmétique Binaire. The full title is translated into English as the "Explanation of the binary arithmetic", which uses only the characters 1 and 0, with some remarks on its usefulness, and on the light it throws on the ancient Chinese figures of Fu Xi." (1703). Leibniz's system uses 0 and 1, like the modern binary numeral system. Leibniz encountered the I Ching through French Jesuit Joachim Bouvet and noted with fascination how its hexagrams correspond to the binary numbers from 0 to 111111, and concluded that this mapping was evidence of major Chinese accomplishments in the sort of philosophical mathematics he admired. Leibniz saw the hexagrams as an affirmation of the universality of his own religious belief. —Wikipedia
I was living in Italy when I found myself with a pirate version of Turbo Pascal (purchased from the Porta Portese market for the cost of the floppy), a 64K Compaq luggable, and time on my hands. I wrote my first tentative little bit of code to randomly generate six numbers, so I could cast the I-ching on the computer and look up the results in my book.
Pretty soon I had a plan to create a full-blown program complete with my own interpretations, a journal for storing answers to questions, a lookup table for finding texts by hexagram, a user-definable colour scheme, a graphical menu system, and all the bells and whistles you could ever want from a piece of mid-80s software.
I'd usually start coding around 7pm and hack away until well past midnight. Sometimes I'd spend the evening writing interpretations, sometimes it would be writing or debugging code.
As I got deeper into the code engine, I discovered things such as the anomaly of the coin flip. At first, I started coding three variables to behave just like a toss of three coins, which is one method of generating a hexagram. But then I realised that statistically, this really wasn't even a close apporximation of the more ancient "Yarrow Stalk" method. The coin method biased slightly away from changing lines (all heads or all tails on the three coins). So I wrote a procedure that took variables separated into two random counts equalling the "East" and "West" piles of the 49 stalks, and sorted them back and forth in exactly the way an ancient chinese sage would have done.
The code
This little baby was a true 80s hepcat in usability terms. It used a clone of the VERY cutting edge Lotus 1-2-3 menu system which I had to constantly recode because I kept forgetting to count from 0 instead of 1. Learned a lot about arrays from that menu system.
My biggest constraint was it had to deliver on the media of the day, which meant I needed to cram more than 500 pages of text, plus far too many thousands of lines of code, onto a single 160k floppy disk. I brought it in at 155 zipped, a feat which still amazes me given some of the filesizes I was originally working with. The answer was my own compression engine. It became clear after I was about a quarter way through writing texts that I would never get all 512 pages down to size. Each of the hexagrams required the Judgment text, the Image text, and six pages of changing line text. Each page of text was around 125 words.
But I could store some of those words as abbreviations, and by storing such strings as "ing" and "ch" and "the" as single-byte tokens using the extended ASCII set, I could reduce thousands of instances of those strings from several letters to a single byte. I became a compression maniac, trying to find sources for whether the word "that" or "which" was more frequent in the English language to know which I should encode into my precious but limited trove of 128 ASCII "Tokens." Then one day I realized that I was missing massive savings by looking at the English language and not looking at my source material. The I-Ching holds a litany of repeating phrases such as "It furthers one to cross the great water," and "Good fortune without blame." I could collapse those entire phrases into a single byte token. I ran the new code over the text and Whoompf! down came the filesize like a flatulent balloon. I remember doing a little Eureka dance on the empty Via Marmarata as I walked home at 3am, my head still reeling with code.
The Program
I published the final version in 1989 via one of the shareware forums on Compuserve. In those days, that was pretty good distribution. I also sent copies high and wide to friends and threw a few into the market at Porta Portese. It never earned me more than a few hundred bucks, but I had lots of emails of appreciation and enjoyed seeing it get mentioned in various news groups and forums over the years. There were a couple requests and offers to help update it to a windows version, but I never got around to it. I wrote in a post:
"I still have most of the original source code, but one library got corrupted a couple decades ago, and the thing won't recompile anymore (which is why my address still reads as Italy in the closing panel.) Tauntingly, I have the full backup of the original work on a hard disk that came out of that old Compaq Sewing Machine it was written on, but in those days Compaq hard disks bore a proprietary BIOS wake-up routine, and the disk can't be accessed by slotting it into any other PC. So until I dig up a working Compaq Portable II on Ebay and can resurrect the disk, the oracle is locked against revisions."
That last bit prompted an email, out of the blue one day in 2013, from Gary McCaskill, a former PC technician who told me he'd installed my programme on hundreds of computers he'd set up and made attractive with his own menus of shareware. He had a specialty in data recovery, and could he be of help recovering the data? He'd hoped I'd put the I-Ching into an IOS format. I shipped the disk off to him and he put in Herculean effort, even buying an old Portable Compaq II. He rescued enough of the code to get me moving on the project. And when at one point I got stuck, unable to recover a swath of texts, he did a rather extraordinary thing. He reminded me that I'd built a backdoor into the programme,-- one that I'd long forgotten, that would allow me to extract every text in the programme. I could run compiled versions of the programme in a DOS emulator, and there was an option to "Print to Disk!" Boom! I could output the complete text of every hexagram I was missing. I had all the material I'd written, and while it wasn't quite as structured as it would have been in code format, a few BBedit macros and a few late nights, and I had a complete XML file of text that had taken months of typing and creative hours. So a huge thanks to Gary for prompting me to move ahead, and for using a rare set of skills in obscure 1980s hardware to help chisel this fossil out of solid rock and breathe new life into it.
Here's something Gary wrote me about participating in this project that made my heart brim:
Now for a bit of synchronicity.
I'm 65 now, and I was talking to a friend less than a week ago about how much knowledge is lost to the world everytime a person dies. Then think about a generation passing, and so much of the knowledge that was needed in their time just isn't needed. I watched my grandfather cast a babbit bearing with crumbled asbestos fibers and grease for a mold. Steam engine mechanics are gone forever. But that knowledge isn't required, and so it has to be dropped by each generation to make room for the knowledge of the times.
And then I thought of the knowledge that I have that was essential for my profession 30 years ago, it's always the stuff that was inside a wide, flat, gray computer case. How to install a socketed memory chip, how to orient a flat ribbon cable connector, the difference between the floppy cable and the HDD cable, and commands like "debug g=c800:5" to access to the low level format routine on a WD controller card.
Anyway, because of our little project, I get to utilize skills that I've gained over several decades-- And it feels good. Thanks for letting me participate. Gary






