Skip to content

Instantly share code, notes, and snippets.

@alexkuang0
Last active April 22, 2020 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexkuang0/1e911682f9554ab224b433ad9874c1a9 to your computer and use it in GitHub Desktop.
Save alexkuang0/1e911682f9554ab224b433ad9874c1a9 to your computer and use it in GitHub Desktop.
Calculate Hexagram for Ancient Chinese divination. (易经六十四卦)
from random import randint
results = []
for i in range(0,6):
sum = 0
for i in range(0,3):
sum += randint(2, 3)
results.append(sum)
for res in reversed(results):
if res % 2 == 0:
print("- -") # Yin
if res % 2 == 1:
print("---") # Yang
@alexkuang0
Copy link
Author

alexkuang0 commented Apr 22, 2020

Please use python3 to run this code.

# To see your python version:
python -V
# To run this program:
python calc_hexagram.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment