Skip to content

Procedural generation of I Ching hexagrams and trigrams using PIL and NumPy

License

Notifications You must be signed in to change notification settings

urschrei/hexagrams

Repository files navigation

b d e r

Description

Procedural generation of I Ching hexagrams using PIL and NumPy.

Hexagrams as a Service (HaaS)

Trigrams, too.

Usage

First, install requirements (PIL and NumPy).

A Hexagram is composed from two of the eight trigrams. Its bars are encoded as binary numbers, from bottom to top, using the digits from left to right.
1 encodes a solid bar, 0 encodes a broken bar.
Pass a 6-digit iterable of 1/0 or True/False to generate the hexagram.

Call dump() to dump it to hexagram_output/hexagram.png. Pass an optional string to dump() to control the output filename.
Call dump_json() to dump it to hexagram.json. Pass an optional string to dump_json() to control the output filename.

Trigrams can be constructed and dumped in the same way; pass a 3-digit iterable.

from hexagram import Hexagram, Trigram
from hexagrams import hexagrams, trigrams

for k, v in hexagrams.items():
    h = Hexagram(v)
    h.dump(k)

for k, v in trigrams.items():
    t = Trigram(v)
    t.dump(k)

The Trigrams and Hexagrams

Can be found here.

License

MIT

Why

The Lottery in Babylon is a very good story. You should read it.

About

Procedural generation of I Ching hexagrams and trigrams using PIL and NumPy

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published