## Chinese Iching Hexagrams on Chou Bronzes: TCL Example

### Introduction

gold Here is some eTCL starter code for Chinese Iching Hexagrams on Chou Bronzes. The Iching is the ancient fortune telling book of China. The Iching literature mentions various methods for casting fortune patterns.

The canvas and buttons presented here are largely based on the Simple Canvas Demo by HJG. The random pick algorithm was posted by Suchenworth RS on Horseracing in Tcl. Other dice pages are Throwing Two Dice GWM andDice by Keith Vetter. Several Dr. Math emails are in the references, which reduce some dice issues to simple paths.

In the West, Leibniz recognized that the whole and broken lines in the hexagram patterns could be counted as ones and zeros, respectively in a binary number system. For example, a cast or list of { 6,7,8,9,6,7 } could be expressed as a binary number, 010101. For computer procedures, the patterns are effectively a horizontal bar code of 6 lines. The probability of each line by the yarrow stick method or coin casting method is different.

• The probability of the yarrow stick method is 1,3,5,7 over 16.
• The number 6 or old yin is 1/16 or 0.0625
• The number 7 or young yang is 3/16 or 0.1875.
• The number 8 or young yin is 5/16 or 0.3125.
• The number 9 or old yang is 7/16 or .4375.
• For the yarrow sticks, the combined probability of any throw is .0625 + .1875 + .3125 + .4375 = 1

For the iching dice pictured below, the three sticks read 2,3,and 3 which totals 8. The combined probability of casting 2,3, and 3 is 0.3125 (with the sticks).

For the coins,the probability of the coin casting method is 2,2,6,6 over 16. The number 6 or old yin is 2/6 or 0.125.

• The number 7 or young yang is 2/16 or 0.125.
• The number 8 or young yin is 6/16 or 0.375.
• The number 9 or old yang is 6/16 or .375.
• For the coins, the combined probability of any throw is .125 + .125 + .375 + .375 = 1

On about 28 pieces of Chou bronzes, there were several series of numbers possibly representing divinatory numbers. These series were described in a thesis by Chang Cheng Land, called Interpretation of Divinatory Inscriptions on Early Chou Bronzes.The numbers in ancient Chou script are not completely understood, but have the following number space { 1:36,2:0,3:0,4:0,5:11,6:64,7:33,8:24}. The puzzle is that ones and fives are not normally generated in the modern I Ching practice, meaning after 1100 AD. Part of the problem is that the Chinese scripts for one, two,three, and four were normally horizontal slashes in those times. So numbers 2,3,and 4 could be confused with marks for the number one. Also some of the numbers seem to be archaic or oracle bone script versions of modern chinese numbers, like X for 5.

It seems reasonable that an eTCL procedure might be able to reproduce the same generating odds with dice or coins, even though the Chou generating procedures are lost but for a few peg points.

## Pseudocode preparations for generating comparable sequences to Chou bronzes

Here are the peg points.

1. One generating method involves 36 counters, lacking four. Apparently the counters are taken/divided away by four and the remainders laid in three piles, upper on side, middle upright, and lower on side.
2. The Chou regarded the odd numbers as "lucky" yang and the even numbers as "unlucky" yin.

From the probability of 6-sided double dice, the number space of the bronze method guesstimates at 23. The bronze method sample space is likely between the sample space of 4 coins (sp16) and 5 coins (sp32).

The probabilities from 4 2-sided sticks are a 40 to 60 percent off the estimated bronze figures. But the number 6 has highest frequency in both sticks and bronzes. In the 5 2-sided sticks, its number 7 with the highest frequency.

Kind of hokey math, but if you assess 6 has 6 combos, then x= 6/.264 or 22.72 eg. nearest whole number space is 23.

```    Pseudocode.  llength { 6 6 6 6 6 6 etc } = 23
1's =    0.1487   * 23  =3.42   > 4
5's = .0454 *23 or 1.04  > 2
6's  =.264*23 or 6.02  > 6
7's  = .136*23 or 3.128 > 4
8's = .0625 *23 or  1.43    > 2
Pseudocode.  llength { 5 5 6 6 6 6 6 6 7 7 7 7 8 8 etc } = 23

Pseudocode.  llength { 5 5 6 6 6 6 6 6 7 7 7 7 8 8 1 1 1 1 etc. } = 23 ```

Since 1's in bronzes are poorly understood, don't mind filling up rest ( to 23) with ones. So now the Suchenworth random pick procedure lpick will deliever the same frequency of characters on the bronzes.

`    Pseudocode.  lpick { 5 5 6 6 6 6 6 6 7 7 7 7 8 8 1 1 1 1 1 1 1 1 1  } `

With a text translation scheme and suitable unicode, the TCL procedure can mimic the appearence of Chou horizontal script on the bronzes. With lpick generation, an eTCL program can throw a sequence on a graphics screen and even swap from Chou-like script in unicode to Arabic numbers.

## Probability Calculations table

space of 4 2-sided sticks marked 1 and 2

space was { 4 5 5 6 5 6 5 7 5 6 6 7 6 7 7 8},size of 16

sticks prob. prob. est. bronze prob. 5 sticks prob.
4 1/16 0.04625 unk
5 5/16 0.3125 0.0454545454545
6 5/16 0.3125 0.264462809 .1875
7 4/16 0.250 0.13636363636 .3125
8 1/16 0.0625 0.0991735537 .2815

5 stick prob's are multiples/fractions of bronze values

## Conclusions

After checking, an lpick(sequence2) was found that better matched the reported bronze values. Here, we are at most 10 to 15 percent off. lpick { 5 6 6 6 6 6 6 7 7 7 8 8 1 1 1 1 1 1 1 1 1 1} #s2 The extra program at the bottom of the page will solve for the probabilities in the bronze sequence (or any sequence loaded in the \$lister).

est. bronze prob. lpick(sequence2)
1 .4347 0.45454545454545453
2 n/a 0.0
3 n/a 0.0
4 n/a 0.0
5 0.0454545454545 0.045454545454545456
6 0.264462809 0.2727272727272727
7 0.13636363636 0.13636363636363635
8 0.0991735537 0.09090909090909091

## appendix TCL programs

### Pretty Print VERSION

```        # test of autoindent from ased editor
# written on Windows XP on eTCL
# Graphics program to mimic Iching numbers on Chou bronzes
# working under TCL version 8.5.6 and eTCL 1.0.1
# gold on TCL WIKI , 17Jul2010
package require Tk
proc lpick L {lindex \$L [expr int(rand()*[llength \$L])];}
set lister { 5  6 6 6 6 6 6 7 7 7  8 8 1 1 1 1 1 1 1 1 1 1 1}
proc transnumber {lister} {
set choutext [list ]
foreach item \$lister {
if { \$item == 1 } {lappend choutext \u4E00}
if { \$item == 5 } {lappend choutext \u3024}
if { \$item == 6 } {lappend choutext \u516D}
if { \$item == 7 } {lappend choutext \u4E03}
if { \$item == 8 } {lappend choutext \u516B}
if { \$item >= 9 } {lappend choutext ? }
}
return \$choutext}
proc transarabic {lister} {
set choutext [list ]
foreach item \$lister {
if { \$item == 1 } {lappend choutext 1}
if { \$item == 5 } {lappend choutext 5}
if { \$item == 6 } {lappend choutext 6}
if { \$item == 7 } {lappend choutext 7}
if { \$item == 8 } {lappend choutext 8}
if { \$item >= 9 } {lappend choutext ? }
}
return \$choutext}
proc transodd {lister} {
set choutext [list ]
foreach item \$lister {
if { \$item == 1 } {lappend choutext \u4e00 }
if { \$item == 5 } {lappend choutext \u4e00 }
if { \$item == 6 } {lappend choutext "- -"}
if { \$item == 7 } {lappend choutext \u4e00 }
if { \$item == 8 } {lappend choutext "- -"}
if { \$item >= 9 } {lappend choutext ? }
}
return \$choutext}
set listx [ transnumber \$lister ]
proc chou_bronzes  {w state3} {
global listx lister
if { \$state3 == 1 } {set listx [ transnumber \$lister ]}
if { \$state3 == 2 } {set listx [ transarabic \$lister ]}
if { \$state3 == 3 } {set listx [ transodd \$lister ]}
set yy 100
set font3 {Hevetica 35}
set font5 {Hevetica 150}
set lister { 5 5 6 6 6 6 6 6 7 7 7 7 8 8 1 1 1 1 1 1 1 1 1 }
\$w create rect 150 50 250 400 -fill gold
\$w create poly 445 60 475 65 475 100 445 120 -fill tan
# \$w create text 200 400 -text u2617  -tags "text" -fill tan -font \$font5
foreach i {1 2 3 4 5 6 } {
\$w create text 200 \$yy -text [lpick \$listx ]  -tags "text"  -font \$font3
incr yy 50
}
}
proc clrcanvas {w} {
\$w delete  "all"
}
proc leave {w} {
exit
}
proc board {w} {
#set state3 1
#set state2 1
clrcanvas \$w
. configure -background orange -highlightcolor brown -relief raised -border 30
\$w configure -bg tan
}
#: Main :
frame .f1
frame .f2
pack  .f1 .f2
set maxX 400
set maxY 450
set y      0
set x1 120
set x2 150
set y1  50
set y2  80
canvas  .cv -width \$maxX -height \$maxY  -bg tan
pack    .cv -in .f1
button  .b0 -text "clear" -command { clrcanvas .cv }
button  .b5 -text "chou_bronzes"   -command {clrcanvas .cv; chou_bronzes   .cv 1 }
button  .b6 -text "arabic"   -command { clrcanvas .cv; chou_bronzes   .cv 2 }
button  .b7 -text "regular"   -command { clrcanvas .cv; chou_bronzes   .cv 3}
button  .b8 -text "exit"   -command {leave   .cv }
pack .b0  .b5  .b6 .b7 .b7 .b8 -in .f2  -side left -padx 2
board   .cv
#catch {console show}
wm title . " Chinese Iching Hexagrams on Chou Bronzes "```

### Extra Program for console

```        # written on Windows XP on eTCL
# working under TCL version 8.5.6 and eTCL 1.0.1
# program for eTCL console
# examine sequences, prob. subroutines for mimic sequence of bronze
# gold on TCL WIKI , 17Jul2010
console show
proc calculation {  facen }  {
# prob. subroutines for mimic sequence of bronze
# prob. is throw combos of eg. "7" over all possible throws
set lister  {5  6 6 6 6 6 6 7 7 7  8 8 1 1 1 1 1 1 1 1 1 1}
set ee [llength  \$lister ]
set kk [ llength [ lsearch -all \$lister \$facen ] ]
set prob [ expr { (\$kk*1.) / \$ee  } ]
return \$prob
}
set limit 12
for { set i 1 } { \$i <= \$limit }  { incr i } {
lappend listxxx \$i
lappend listxxx [ calculation  \$i ]
puts " \$i [ calculation  \$i ] "
}
#end
output.
1 0.45454545454545453
2 0.0
3 0.0
4 0.0
5 0.045454545454545456
6 0.2727272727272727
7 0.13636363636363635
8 0.09090909090909091
9 0.0
10 0.0
11 0.0
12 0.0
#end```

Aside from the hexagram analysis, this TCL script can be a workhorse for all kinds of problems just by loading a different list of numbers to examine. Suppose you were given a loaded dice and loaded about 30 throws in the list. For an honest 6-sided die, the probability of each throw { sequence 1 2 3 4 5 6} should be equal over a large enough set of tests. The exact probability for each throw would be 1/6 or 1.6666 . A loaded die will give percentages that are not equal for all numbers or different probabilities than the honest die.

Another problem type is the continued mantissas like pi. Are the numbers that show up in the pi mantissa equally probable? If the mantissa of pi was split by TCL into a list of 0-9 integers, this theorm could be checked by our script. Lets try the handy AMG pi procedure from One Liners

```  1% proc pi {} {expr acos(-1)}
2% proc mac {aa} { regexp {.(\d+)} \$aa -> bb;return \$bb }
3% mac [pi]
141592653589793

Now we have a short mantissa for testing and there are websites that will give pi with more digits.

set sequence3 [ split {14159265358979323846264338327950288419716939937} "" ]

2% split {14159265358979323846264338327950288419716939937} ""
1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7
# Sequence for combos of 2 6-sided dice. sample space is 36.
{3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12}
sequence of one 6-sided dice, turned in numberic order.
{ 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6}
honest die
{2 5 1 6 4 3 5 3 2 1 5 2 1 3 6 1 6 1 3 1 4 1 4 3 5 2 4 1 6 6}
loaded die in favor of 5
{5 6 1 6 3 5 5 4 6 2 5 4 6 6 4 3 4 3 1 1 2 5 2 1 2 5 1 4 3 5}

sequence for 2-sided coin, ready for shuffle.1 for  head, 2 for tail

{1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1}
honest coin , 1 head, 2 for tail
{1 2 2 2 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2}
2 1 2 1 1 1 2 2 2 1 2 2 1 1 1 1 2 2 1 2 1 1 2 1 1 2 1 1 1 1 1 2 1
another dishonest coin , loaded for 2 (tails),
1 for  heads, 2 for tails
{1 2 2 1 2 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 1 2 1 1 2 2 2 2 1 1 2 2 2}
combos for three  2-sided stick dice, marked 1 and 2
sample space is 8.
{3 4 4 5 4 5 5 6}
combos for four 2-sided stick dice, marked 1 and 2
sample space is 16.
{4 5 5 6  5 6 6 5 7 5 6 6 7 6 7 7 8}
combos for five 2-sided stick dice, marked 1 and 2
sample space is 32.(use split here)
{ 56676768677877889677878797889899 10}```