https://github.com/urschrei/hexagrams
Procedural generation of I Ching hexagrams and trigrams using PIL and NumPy
https://github.com/urschrei/hexagrams
cleromancy hexagram i-ching pil trigrams
Last synced: about 1 month ago
JSON representation
Procedural generation of I Ching hexagrams and trigrams using PIL and NumPy
- Host: GitHub
- URL: https://github.com/urschrei/hexagrams
- Owner: urschrei
- License: mit
- Created: 2016-02-14T22:08:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-01T15:27:41.000Z (almost 5 years ago)
- Last Synced: 2025-03-27T12:23:41.442Z (about 2 months ago)
- Topics: cleromancy, hexagram, i-ching, pil, trigrams
- Language: Python
- Homepage: http://cleromancer.herokuapp.com
- Size: 50.8 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://cleromancer.herokuapp.com/hexagram/100010.png)
[](http://cleromancer.herokuapp.com/trigram/100.png)
[](http://cleromancer.herokuapp.com/trigram/010.png)
[](http://cleromancer.herokuapp.com/hexagram/random)# Description
Procedural generation of I Ching hexagrams using PIL and NumPy.# Hexagrams as a Service (HaaS)
[Trigrams, too](http://cleromancer.herokuapp.com).# Usage
First, install [`requirements`](requirements.txt) (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.
``` python
from hexagram import Hexagram, Trigram
from hexagrams import hexagrams, trigramsfor 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](hexagrams.py).# License
[MIT](LICENSE)# Why
[The Lottery in Babylon](https://en.wikipedia.org/wiki/The_Lottery_in_Babylon) is a very good story. You should [read](http://web.itu.edu.tr/~inceogl4/modernism/lotteryofbabylon.pdf) it.