Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Chinese+Iching+Random+Weather+Predictions?V=127
QUERY_STRINGV=127
CONTENT_TYPE
DOCUMENT_URI/revision/Chinese+Iching+Random+Weather+Predictions
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.100.90
REMOTE_PORT11974
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.145.66.67
HTTP_CF_RAY8868454e7c3d8f49-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.145.66.67
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Chinese Iching Random Weather Predictions} \ \n**Chinese\ Iching\ Random\ Weather\ Predictions**\n\n----\ \ \ \nThis\ page\ is\ under\ development.\ Comments\ are\ welcome,\nbut\ please\ load\ any\ comments\ in\ the\ comments\ section\nat\ the\ middle\ of\ the\ page.\ Thanks,\ \[gold\]\n\n----\nHere\ is\ some\ starter\ code\ for\nChinese\ Iching\ Random\ Weather\ Predictions.\ \nThe\ Iching\ is\ the\ ancient\ fortune\ telling\nbook\ of\ China.\ The\ Iching\ literature\ mentions\nvarious\ methods\ for\ casting\ fortune\ patterns.\nIn\ researching\ for\ the\ Iching\ Fortunes\ \npage\ on\ this\ wiki,\nI\ ran\ into\ several\ mentions\ of\ \nusing\ the\ Iching\ to\ predict\nthe\ weather.\ \ In\ the\ iching\ itself,\nthere\ are\ at\ least\ some\ninferences\ on\ weather.\nOn\ the\ public\ wall\ in\ beijing,\ the\ iching\ \ntrigrams\ were\ generally\ posted\ \ \nas\ a\ daily\ weather\ prediction\ in\ Ming\ times.\ \nThis\ page\ is\ more\ an\ investigation\ into\nthe\ mindset\ of\ the\ Chinese\ sages,\nusing\ TCL\ visual\ and\ random\ subroutines\ \ \n\n----\nThe\ Iching\ is\ the\ ancient\ fortune\ telling\nbook\ of\ China.\ The\ Iching\ literature\ mentions\nvarious\ methods\ for\ casting\ fortune\ patterns\nof\ Iching.\ The\ various\ methods\ include\ \nhot\ ironing\ of\ turtle\ shells\ (-t.),\nmanipulations\ of\ yarrow\ sticks,\ flipping\ coins,\nthrowing\ shaman\ bones,\ and\ dice.\nOne\ analogy\ from\ North\ America\nis\ a\ shaman\ throwing\ or\nshuffling\ stick\ dice.\n----\nI\ made\ three\ stick\ dice\ for\nIching\ by\ cutting\ a\ dowel\ of\ square\ cross\ section\ninto\ three\ sticks.\nFor\ the\ three\ stick\ dice,\ the\ flat\ sides\ are\ marked\ or\nburned\ with\ 2\ or\ 3\ holes\ alternately.\nTwo\ sticks\ are\ marked\nwith\ \{3\ 2\ 3\ 2\}\ dots\ on\ the\ sides.\ One\ stick\ is\ marked\nwith\ \{3\ 3\ 3\ 2\}\ dots\ on\ the\ sides.\nIn\ casting\ such\ three\ dice,\nthe\ possible\ sums\ are\ 6,7,8,\ or\ 9.\ Further,\ the\nstick\ dice\ are\ cast\ six\ times\ to\ obtain\ whole\ lines\nor\ broken\ lines\ in\ a\ pattern\ or\ set\ of\ six\ lines.\nA\ set\ of\ six\ Iching\ lines\ is\ called\ a\ gua\nin\ the\ orient\ or\ a\ hexagram\ in\ some\ translations\nof\ the\ Chinese.\n----\nIn\ the\ Iching\ interpretations,\ casts\ of\n6\ and\ 8\ are\ broken\ or\ yin\ (female)\ lines,\nwhile\ casts\ of\ 7\ and\ 9\ are\ whole\ or\ yang\ (male)\ lines.\nThe\ yin\ numbers\ of\ 6\ and\ 8\ are\ even\ numbers.\nThe\ yang\ numbers\ of\ 7\ and\ 9\ are\ odd\ numbers.\nThe\ casts\ are\ recorded\ by\npencil\ with\ the\ first\ line\nat\ bottom\ and\ marking\ up\ the\ column.\nIt\ is\ possible\ to\ record\ the\ numbers\ from\ the\ \ncasts\ with\ tally\ sticks\ \ or\ Chinese\ counting\ rods,\nwhich\ are\ somewhat\ reminiscent\ of\nthe\ Iching\ patterns\ themselves.\nAfter\ marking\ the\ original\ pattern\ or\ \ \nhexagram,\ sometimes\ a\ second\ follow-up\ hexagram\nis\ developed\ by\ swapping\ throws\ of\ 6\ for\ a\ 7\nand\ throws\ of\ 9\ for\ a\ 6.\ These\ swaps\ \ effectively\ntrade\ a\ broken\ \ line(6)\ for\ a\ whole\ line(7)\nand\ a\ whole\ line(9)\ for\ a\ broken\ line(6).\ \nThe\ throws\ for\ the\ changing\nlines\ (6&9)\ may\ not\ always\ \nbe\ come\ out\ in\ the\ first\ hexagram\ or\ \nits\ component\ lines,\ so\ the\ followup\ hexagram\nmay\ not\ exist\ \{under\ consistent\ rules\}.\nIf\ the\ first\ hexagram\ is\ interpreted\ on\ a\ line\nby\ line\ basis,\ any\ changing\ lines(6&9)\ or\ second\nhexagram\ offers\ some\ modification\ or\ discount\ on\nthe\ interpretation\ of\ the\ first\ hexagram.\ \ \n\n----\nContinuing\ with\ the\ development\ of\ hexagrams,\ there\nwould\ be\ 2**6\ or\ 64\ hexagrams.\nAnd\ the\ ancient\ chinese\nwere\ not\ finished\ with\ 64\ hexagrams.\nAt\ least\ one\ western\ Han\ text\n(Chiao\ shih\ Yi\ Lin\ )\ gives\ consideration\ to\ transforms\nof\ 64*64\ dimensions\ or\ 4096.\ So\ the\nchinese\ busted\ into\nthe\ barrier,\ \ 2\ **\ 12\ =\ 4096.\ \ \n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n----\nIn\ developing\ a\ computer\ program\ or\ application,\nit\ is\ helpful\ to\ develop\ analogs\ \nfor\ the\ individual\ tasks\ of\ the\ application.\nAn\ Iching\ application\ would\ have\ to\ compose,\ \nbeg,\ or\ borrow\ TCL\ procedures\ for\ random\ casts,\ntallies\ of\ scores,\ accounting\ files,\ndisplay\ hexagram\ lines\ on\ a\ screen,\ \nswapping\ changing\ lines,\ hexagram\ pattern\ \nrecognition\ and\ ranking\ interpretations.\n\ \ \ \ \ \ \ \nFor\ computer\ procedures,\ the\ patterns\ are\ effectively\ a\ \nhorizontal\ bar\ code\ of\ 6\ lines.\n\n----\nIn\ the\ process\ of\ designing\ the\ basic\nsubroutine\ tasks,\ we\ could\ throw\ in\ some\nswitches,\ logic\ chains,\ or\ daisy\ chains\nthat\ break\ the\ outset\ rules\ given\ above.\nFor\ example,\ TCL\ is\ so\ good\ at\ swapping\ lines\ (6&9)\nfor\ the\ second\ hexagram,\ that\ it\ would\ \nbe\ easy\ to\ put\ a\ switch\ that\ generates\ or\nswaps\ all\ hexagram\ lines\ (6,7,8,&9)\nfor\ their\ opposites.\nAlso\ from\ some\ scripts\ of\nthe\ Chinese\ Chou\ dynasty,\ndifferent\ Iching\ fortune\ methods\ of\nyarrow\ sticks\ or\ coins\ would\ generate\ndifferent\ probabilities\ of\ obtaining\neach\ hexagram\ line.\ Might\ be\ interesting\ to\nhave\ a\ back\ door\ in\ the\ program\nto\ check\ (or\ adapt\}\ the\ different\ probabilities\nof\ stick\ or\ coin\ throws.\ Several\ authors\nhave\ pointed\ out\ that\ a\ few\ of\ the\ hexagrams\nlook\ similar\ to\ Chinese\ characters\ or\ even\nMayan\ calendar\ notation.\ Without\ wading\ too\ \ndeep\ into\ alternate\ realities,\ the\ Iching\nhexagrams\ could\ be\ used\ as\ numerals,\nscript\ alphabet,\ game\ tokens,\ symbol\ recognition\ code,\nor\ maybe\ a\ programming\ language\ (like\ Greek\nletters\ for\ APL\ operators).\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \nSuch\ rule\ breaking\ helps\ keep\ the\ finished\nprogram\ more\ flexible.\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\n\nIn\ the\ West,\nLeibniz\ recognized\ that\nthe\ whole\ and\ broken\ lines\nin\ the\ hexagram\ patterns\ could\nbe\ counted\ as\ ones\ and\ zeros,\ respectively\ in\na\ binary\ number\ system.\ For\ example,\ a\ cast\ or\ \ \ list\nof\ \{\ 6,7,8,9,6,7\ \}\ could\ be\ expressed\ as\ a\ binary\nnumber,\ 010101.\ For\ computer\ procedures,\nthe\ patterns\ are\ effectively\ a\nhorizontal\ bar\ code\ of\ 6\ lines.\nThe\ probability\ of\ each\ line\ by\ \nthe\ yarrow\ stick\ method\ or\ coin\ casting\ method\ is\ndifferent.\ \n\n\n\nThe\ probability\ of\ the\ yarrow\ stick\ method\ is\ 1,3,5,7\ over\ 16.\nThe\ number\ 6\ or\ old\ yin\ is\ 1/16\ or\ 0.0625\nThe\ number\ 7\ or\ young\ yang\ is\ 3/16\ or\ 0.1875.\nThe\ number\ 8\ or\ young\ yin\ is\ 5/16\ or\ 0.3125.\nThe\ number\ 9\ or\ old\ yang\ is\ 7/16\ or\ .4375.\nFor\ the\ yarrow\ sticks,\ the\ combined\ probability\ of\ any\ throw\ is\n.0625\ +\ .1875\ +\ .3125\ +\ .4375\ =\ 1\n\nFor\ the\ iching\ dice\ pictured\ below,\ the\ three\ sticks\ read\n2,3,and\ 3\ which\ totals\ 8.\ The\ combined\ probability\ of\ncasting\ 2,3,\ and\ 3\ is\ 0.3125\ (with\ the\ sticks).\ \n\nFor\ the\ coins,the\ probability\ of\ the\ coin\ casting\ method\ is\ 2,2,6,6\ over\n16.\nThe\ number\ 6\ or\ old\ yin\ is\ 2/6\ or\ 0.125.\ \n\nThe\ number\ 7\ or\ young\ yang\ is\ 2/16\ or\ 0.125.\nThe\ number\ 8\ or\ young\ yin\ is\ 6/16\ or\ 0.375.\nThe\ number\ 9\ or\ old\ yang\ is\ 6/16\ or\ .375.\nFor\ the\ coins,\ the\ combined\ probability\ of\ any\ throw\ is\n.125\ +\ .125\ +\ .375\ +\ .375\ =\ 1\n\nFor\ a\ system\ of\ 2\ sided\ sticks\ or\ coins\ of\ the\ number\ N,\nthe\ probability\ of\ getting\ all\ zeros\ or\ ones\ would\ be:\nset\ aa\ \[\ expr\ \{\ \ (1./(2**\$N))\}\ \]\ \;#\ generic\ TCL\nFor\ three\ coins,\ the\ formula\ would\ be\ \nset\ aa\ \[\ expr\ \{\ \ (1./(2**3)\}\ \]\ \ \ \ or\ 1/8\nFor\ example\ the\ trigrams\ known\ as\ heaven\ (111)\ and\nearth\ (000)\ would\ have\ a\ probability\ of\ 1/8.\ \nFor\ six\ coins,\ the\ formula\ would\ be\ \ set\ aa\ \[\ expr\ \{\ \ (1./(2**6)\}\ \]\nor\ 1/64.\nFor\ N\ dice,\ the\ probability\ that\ a\ one\ or\ zero\ would\ show\ up\non\ one\ of\ N\ dice\ would\ be\ \nset\ aa\ \[\ expr\ \{\ \ (1.-(1./(2**\$N)))\}\ \]\ \ \n\n----\nThe\ Chinese\ believed\ that\ weather\ was\ the\ \ncombination\ of\ the\ 5\ elements\ or\ chi\ forces\ \ in\ the\ air\nnamely,\ rain,\ sunshine,\ heat,\ cold\ and\ wind\ .\nthey\ reasoned\ that\ the\ weather\ was\ the\ combination\ of\nchi\ forces\ between\ heaven\ and\ earth.\nFor\ example,\ the\ combination\ of\ cold\ and\ rain\ produces\ snow.\n\nUsing\ the\ trigrams\ as\ symbols\ ,\ the\ combination\ of\ \ntwo\ infer\ the\ mixing\ of\ conditions.\nFurther,\ the\ trigrams\ were\ associated\ with\ directions.\ \nforetell\ the\ weather\n1.\ based\ on\ the\ primary\ trigram\n2.\ the\ combination\ of\ trigrams\n3.\ the\ season\n4.\ prevailing\ conditions\n\nThe\ \ fortnight\ periods,\ more\ specific\ as\ to\ expected\ conditions.\ \nand\ 5\ seasons.\ spring,\ summer,\ late\ summer,\ autumn,\ and\ winter.\n\n\nIt\ is\ possible\ to\ make\ a\ \ iching\ gnomon\ using\ a\ pointed\ stick\ and\nboard.\ These\ individual\ markers\ will\ register\ binary\ ones\ and\ zeros\nas\ the\ sun\ rises\ from\ 600\ to\ 1200\ hours.\ And\ flipping\ the\ orientation\ \nof\ the\ board,\ measure\ the\ hours\ 1200\ to\ 1800\ hours.\ For\ the\ iching\ gnomon\nbelow,\ the\ shadow\ of\ 1300\ hours\ is\ across\ the\ first\ bar,\ which\ is\none\ hour\ after\ noon,\ meaning\ \ 1300\ hours.\ \ The\ six\ binary\ bars\ show\n011111.\ \ \n\n\nWhen\ the\ goinon\ end\ of\ the\ board\ \ is\ pointed\ at\ the\ morning\ sun,\nthe\ goinon\ will\ measure\ the\ hours\ (600+N)\ until\ noon.\n\nWhen\ the\ goinon\ end\ of\ the\ board\ \ is\ pointed\ at\ the\ afternoon\ sun,\nthe\ goinon\ will\ measure\ the\ hours\ (1200+N)\ until\ the\ sun\ goes\ down.\nAs\ the\ goinon\ shadow\ passes\ a\ stick\ mark,\ the\ sequence\ of\ 6\ binary\ numbers\nis\ 111111,\ \ 011111,001111,000111,000011,000001\ or\ decimals\n63,31,15,7,3,1\n\n\n\n\n\n\n\n\n\nIn\ the\ context\ of\ the\ oracle\ bones,\nthe\ Shang\ were\ careful\ to\ \nrecord\ the\ weather\ as\ the\ hunting\nparty\ or\ warrior\ raid\ set\ out,\npresumably\ early\ in\ the\ morning.\nSecondly\ they\ recorded\ the\noracle\ forecast\ and\ result.\nThese\ observations\ on\ the\ oracle\ bones\ \ncontain\ elements\ of\ the\ scientific\ method.\n----\nFor\ a\ trigram,\ returning\ 2\ out\nof\ 3\ yin\ lines\ might\ \ngive\ a\ rainy\ forcast\ at\ binomial\nprobability\ of\ 0.375.\nAny\ area\ with\ roughly\ 10\ rainy\ndays\ a\ month\ over\ the\nsummer\ \ would\ have\ a\ probability\ of\n10/30\ or\ 0.333.\ Here\ is\ \npossible\ theory\ that\nthe\ trigram\ probability\nand\ the\ rainy\ day\ probability\nare\ somewhat\ comparable.\n----\nFor\ Shanghai\ on\ 8Jul2010,\ the\ two\ trigrams\ developed\ were\ 2\ and\ 3\ \nwhich\ indicates\ southwest\ and\ \nrain\ conditions.\ The\ interpolated\ mean\ \ntemperature\ was\ 24\ C.\ The\ internet\nreported\ rain\ and\ winds\ in\ the\nsouthwest\ at\ 7\ mph,\ 27\ C,\ \ and\ 79\ \nper\ cent\ humidity.\ The\ Shanghai\ timezone\ \nwas\ loaded\ into\ the\ code\ on\ the\ fly.\ \ \ \n\n----\nFor\ Beijing\ on\ 11Jul2010,\ the\ temp\ was\ 22C,\nlight\ rain,east\ wind\ at\ 9\ mph,\ humidity\ 83%.\nThe\ picked\ trigrams\ were\ 3\ and\ 5,\ meaning\nhot\ sunny\ and\ windy,\ pretty\ much\ a\ bust\ for\ the\nIching.\ Interpolated\ temperature\ \nwas\ 23.9C\ and\ chance\ of\ rainy\ day\ was\ 0.47.\n---\nFor\ Chicago\ on\ 11Jul2010,\ \nthe\ temp\ was\ 29C,\ \ ,northwest\ wind\ at\ 16\ kmph,\ \ .\nThe\ picked\ trigrams\ were\ 5\ and\ 5,\nmeaning\ \ windy\ and\ change\ with\ SE\ wind,\npretty\ much\ a\ strike\ out\ for\ the\ Iching.\ \nInterpolated\ temperature\ was\ \n17C\ and\ chance\ of\ rainy\ day\ was\ 0.27.\n\n\n\n\n\n\n\n\n\n\nShanghai\ was\ checked\ on\ 21JUL2010,\ \nthe\ weather\ was\ mostly\ cloudy\ and\ 27\ degrees\ C.\nReported\ 84\ %humidity\ and\ SE\ winds\ at\ 9mph.\nIching\ forcast\ was\ trigrams\ 3\ and\ 4,\nmeaning\ hot\ sunny,\ and\ stormy.\nMean\ temp\ was\ 30.47\ C.and\n0.33\ chance\ of\ rainy\ day.\ Iching\npredction\ seemed\ moderately\ accurate.\n----\nThe\ weather\ fronts\ do\nseem\ to\ come\ in\ cycles.\nThe\ theory\ of\ weekend\ rain\nproposes\ greater\ chance\non\ rain\ on\ weekends\ \nWould\ like\ to\ gather\nsome\ more\ testcases\ and\ profiles,\ maybe\ \nsome\ kind\ of\ neural\ filter\nor\ fuzzy\ logic\ could\ be\ developed.\nA\ very\ interesting\ cosine\ model\nfor\ daily\ temperature\ by\ Martinez\ was\ found\nin\ the\ literature.\ A\ normalized\ solar\ loading\ncurve\ were\ calculated\ at\ another\ site.\n\n\n----\nWith\ the\ buttons\ in\ the\ little\ \ncanvas\ demo,\ one\ can\ call\ up\nseparate\ routines\ to\ lay\nout\ the\ different\nboards\ and\ install\ the\ various\ options\ \ .\nIn\ a\ teamwork\ situation,\ programming\nteams\ could\ divide\ up\nthe\ several\ tasks\ with\ the\ framework.\nIn\ the\ button\ call\ \nup\ of\ the\ canvas\ demo,\ separate\ tasks\ncan\ laid\ in\ successive\nstatements\ to\ clear\ board,\nset\ states,\ layout\ the\ board,\ .\nLoading\ three\ statements\ in\ the\ button\nmight\ be\ ClrCanvas\ .cv\;\ \nset\ state3\ 3\;board\ .cv\;\nThis\ gets\ a\ little\ lengthy\ for\ a\nbutton\ line,\ so\ these\ statements\ could\ \nbe\ stacked\ in\ a\ separate\ subroutine.\nWith\ some\ global\ statements\ for\nany\ constants\ and\ passing\ the\ncanvas\ name\ as\ \$w,\ the\ \ subroutine\ncould\ be\ written\ like\ \n\n======\n\ \ proc\ stackedlist\ \{w\}\ \{\n\ \ \ \ global\ state3\n\ \ \ \ ClrCanvas\ \$w\n\ \ \ \ set\ state3\ 3\n\ \ \ \ board\ \$w\n\ \ \}\n======\n\n----\n**Screenshots\ Section**\n\n\[http://farm5.static.flickr.com/4078/4781356338_5b53b1a444.jpg\]\n\[http://farm5.static.flickr.com/4121/4796219415_455bd2f5a2.jpg\]\n\[http://farm5.static.flickr.com/4136/4812522943_33727ff8ec.jpg\]\n\[http://farm5.static.flickr.com/4114/4812413403_e697523a46.jpg\]\n\[http://farm5.static.flickr.com/4098/4818003683_be9dddea77.jpg\]\n\[http://farm5.static.flickr.com/4123/4821292691_35da154995.jpg\]\n\n----\n**Comments\ Section**\nPlease\ place\ any\ comments\ here,\ Thanks.\n\n\[gold\]\ Changes.\n\n----\n**References***\n\n\ \ \ *\ \[Simple\ Canvas\ Demo\]\n\ \ \ *\ \[Clock\ and\ daylight\ saving\ time\ corrections\]\n\ \ \ *\ \[timezone\]\n\ \ \ *\ www.ejournal.unam.mx/atm/Vol04-3/ATM04302.pdf\n\ \ \ *\ http://rishida.net/tools/conversion/,\ outstanding\ unicode\ conversion\ online!!!\n\ \ \ *\ http://pinyin.info/tools/converter/chars2uninumbers.html\n\ \ \ *\ http://en.wikipedia.org/wiki/Miscellaneous_Symbols_Unicode_block\n\ \ \ *\ http://www.dennismerrittjungiananalyst.com/China_paper.htm\n\ \ \ *\ http://www.openexchange.org/archives/AMJ04/gordon.html\n\ \ \ *\ http://www.superiching.com/guanature.htm\n\ \ \ *\ http://news.bbc.co.uk/2/hi/sci/tech/146120.stm\n\ \ \ *\ http://nasgem.rpi.edu/files/1686\n\ \ \ *\ http://www.biroco.com/yijing/Shih-chuan_Chen.pdf\n\ \ \ *\ Early\ Bronzes,\ chen\ lang\n\ \ \ *\ \[http://www.biroco.com/yijing/Chang_Cheng-lang.pdf\]\n\ \ \ *\ http://www.nature.com/nature/journal/v256/n5515/abs/256296a0.ht\n\ \ \ *\ http://mysite.du.edu/~jcalvert/math/chinum.htm\n\ \ \ *\ Doctor\ Syd,\ \ The\ Math\ Forum,\ 2/25/96\ \ on\ probability\ of\ 6\ choose\ 2\n\ \ \ *\ http://www.chineseastrologyonline.com/OracleBone.htm\n\ \ \ *\ http://www.chinavista.com/experience/oracle/oracle.html\n\ \ \ *\ http://www.lib.cuhk.edu.hk/uclib/bones/bones.htm\n\ \ \ *\ http://www.chinapage.com/oracle/oracle.html\n\ \ \ *\ http://www.chinapage.com/archeology/030411.pdf\n\ \ \ *\ http://www.chinapage.com/oracle/news.html\n\ \ \ *\ http://www.chinesefortunecalendar.com/CLC/Default.htm\n\ \ \ *\ http://www.chinesefortunecalendar.com/CLC/LunarCalendar.htm\n===\nTEMPERATURE\ AND\ THE\ ASSIGNMENT\ OF\ THE\ HEXAGRAMS\ OF\ THE\ I-CHING\ TO\ THE\ CALENDAR\nEDWARD\ A.\ HACKER\ 1\ \n1\ NORTHEASTERN\ UNIVERSITY,\ BOSTON,\ MASSACHUSETTS\ \nhttp://www3.interscience.wiley.com/journal/119856417/abstract\n===\nJournal\ of\ Chinese\ Philosophy\nVolume\ 9\ Issue\ 4,\ Pages\ 395\ -\ 400\nPublished\ Online:\ 28\ Jun\ 2008\n===\n\n**appendix\ TCL\ programs**\n\n======\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ \ \ \ #based\ on\n\ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\ \ \ \ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\n\ \ package\ require\ Tk\n\ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\n\ \ \ return\ \$answer\n\ \ \}\n\ \ \ \ \n\ \ \ \ \ proc\ chseason\ \{aa\}\ \{\n\ \ \ \ \ set\ chinaseason\ \"?\"\n\ \ \ \ if\ \{\ \$aa\ >=\ 20\ &&\ \$aa\ <=\ 93\ \}\ \{set\ chinaseason\ \"spring\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 93\ &&\ \$aa\ <=\ 167\ \}\ \{set\ chinaseason\ \"summer\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 167\ &&\ \$aa\ <=\ 242\ \}\ \{set\ chinaseason\ \"late\ summer\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 242\ &&\ \$aa\ <=\ 315\}\ \{set\ chinaseason\ \"autumn\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 315\ &&\ \$aa\ <=\ 365\}\ \{set\ chinaseason\ \"winter\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 0\ &&\ \$aa\ <=\ 6\}\ \{set\ chinaseason\ \"winter\"\}\n\ \ \ \ \ return\ \$chinaseason\ \}\n\n\ \ \ \ \ proc\ cmonth\ \{aa\}\ \{\n\n\ \ \ \ \ set\ cmonth\ \"?\"\n\ \ \ \ if\ \{\ \$aa\ >=\ 36\ &&\ \$aa\ <=\ 51\ \}\ \{set\ cmonth\ \"beginning\ of\ spring\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 51\ &&\ \$aa\ <=\ 66\ \}\ \{set\ cmonth\ \"rain\ water\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 66\ &&\ \$aa\ <=\ 81\ \}\ \{set\ cmonth\ \"excited\ insects\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 81\ &&\ \$aa\ <=\ 96\}\ \{set\ cmonth\ \"spring\ equinox\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 96\ &&\ \$aa\ <=\ 157\}\ \{set\ cmonth\ \"clear\ and\ bright\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 157\ &&\ \$aa\ <=\ 126\}\ \{set\ cmonth\ \"grain\ rains\ \ \ \ \ \ \ \ \"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 126\ &&\ \$aa\ <=\ 142\}\ \{set\ cmonth\ \"summer\ begins\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 142\ &&\ \$aa\ <=\ 158\}\ \{set\ cmonth\ \"grain\ filling\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 158\ &&\ \$aa\ <=\ 173\}\ \{set\ cmonth\ \"grain\ in\ ear\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 173\ &&\ \$aa\ <=\ 189\}\ \{set\ cmonth\ \"summer\ solstice\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 189\ &&\ \$aa\ <=\ 205\}\ \{set\ cmonth\ \"slight\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 205\ &&\ \$aa\ <=\ 220\}\ \{set\ cmonth\ \"great\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 220\ &&\ \$aa\ <=\ 236\}\ \{set\ cmonth\ \"autumn\ begins\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 236\ &&\ \$aa\ <=\ 251\}\ \{set\ cmonth\ \"limit\ of\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 251\ &&\ \$aa\ <=\ 267\}\ \{set\ cmonth\ \"white\ dew\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 267\ &&\ \$aa\ <=\ 282\}\ \{set\ cmonth\ \"autumn\ equinox\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 282\ &&\ \$aa\ <=\ 297\}\ \{set\ cmonth\ \"cold\ dew\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 297\ &&\ \$aa\ <=\ 312\}\ \{set\ cmonth\ \"hoar\ frost\ descends\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 312\ &&\ \$aa\ <=\ 327\}\ \{set\ cmonth\ \"Winter\ begins\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 327\ &&\ \$aa\ <=\ 341\}\ \{set\ cmonth\ \"slight\ snow\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 341\ &&\ \$aa\ <=\ 356\}\ \{set\ cmonth\ \"great\ snow\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 356\ &&\ \$aa\ <=\ 365\}\ \{set\ cmonth\ \"winter\ solstice\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 1\ &&\ \$aa\ <=\ 6\}\ \{set\ cmonth\ \"winter\ solstice\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 6\ &&\ \$aa\ <=\ 21\}\ \{set\ cmonth\ \"slight\ cold\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 21\ &&\ \$aa\ <=\ 36\}\ \{set\ cmonth\ \"great\ cold\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 366\}\ \{set\ cmonth\ \"?\"\}\n\ \ \ \ return\ \$cmonth\ \ \ \ \}\n\n\ \ \ \ \ \ \ \ proc\ pi\ \{\}\ \{expr\ acos(-1)\}\n\n\ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\n\ \ \ \ \ proc\ tempform\ \{\ aa\ bb\ cc\ \}\ \{\n\ \ set\ \ hour1\ \$cc\n\n\ \ set\ bigterm\ \[\ expr\ \{((\$aa+\$bb)/2.)+((\$bb-\$aa)/2.)\}\ \]\n\ \ \ \ set\ hour3\ 6\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\ \ set\ hour2\ 12\n\ \ set\ hour3\ 14\n\ \ \ #set\ cc\ 20\n\ \ if\ \{\ \$cc\ <=\ 14\}\ \{\n\ \ #set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ \ #puts\ \"first\ \$res\"\n\ \ return\ \$res\}\n\n\ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\n\ \ \ \ \ if\ \{\ \$cc\ >\ 14\}\ \{\n\ \ \ \ \ \ set\ hour3\ 13\n\ \ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1-\ 14)/(14-\$hour3)\ \ \ \ \}\]\n\ \ \ \ \ \ set\ res\ \[\ expr\ \{\ \$bigterm*cos(\ \$term3\ )\ *-1.\ \ \ \ \}\]\}\n\ \ \ #puts\ \"second\ \ \$res\"\n\ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \}\n\n\ \ \ \ \ \ proc\ tempformxxx\ \{\ aa\ bb\ cc\ \}\ \{\n\ \ set\ \ hour1\ \$cc\n\n\ \ set\ bigterm\ \[\ expr\ \{((\$aa+\$bb)/2.)+((\$bb-\$aa)/2.)\}\ \]\n\n\ \ \ \ \ \ set\ term5\ \[\ expr\ \{\ \}\]\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$term5)/(10+\$hour1)\ \ \ \ \ \}\]\n\n\ \ set\ hour2\ 12\n\ \ set\ hour3\ 14\n\ \ \ \ set\ cc\ 9\n\ \ if\ \{\ \$cc\ <=\ 14\}\ \{\n\n\ \ \ \ \ \ \ \ set\ hprime5\ \[\ expr\ \{\ \}\]\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$hprime5)/(10+\$hour1)\ \ \ \ \ \}\]\n\n\ \ set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ #puts\ \"first\ \$res\"\n\ \ return\ \$res\}\n\n\ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\n\ \ \ \ \ if\ \{\ \$cc\ >\ 14\}\ \{\n\ \ \ \ \ \ set\ hour3\ 13\n\ \ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1-\ 14)/(14-\$hour3)\ \ \ \ \}\]\n\ \ \ \ \ \ set\ res\ \[\ expr\ \{\ \$bigterm*cos(\ \$term3\ )\ *-1.\ \ \ \ \}\]\}\n\ \ \ #puts\ \"second\ \ \$res\"\n\ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \}\n\n\ \ \ \ \ proc\ listnumbers\ \{\ aa\ bb\}\ \{\ for\ \{set\ i\ \[\ expr\ \{int(\$aa)\}\]\}\ \{\$i<=\$bb\}\ \{incr\ i\}\ \{lappend\ dd\ \[\ expr\ .1*\ \$i\]\ \}\;return\ \$dd\}\n\n\ \ \ \ \ \ \ proc\ sinwave\ \{\ w\ \}\ \{\n\ \ \ console\ show\n\n\ \ \ set\ goo\ \[listnumbers\ 1\ 70\ \]\n\ \ foreach\ item\ \ \ \$goo\ \ \{\n\ \ \ \ puts\ \[\ expr\ \{\ cos\ (\$item)\ \}\ \]\n\ \ \ \ \ \}\n\n\ \ \ \ \ \}\n\n\ \ \ \ \ \ proc\ clrcanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\n\ \ \}\n\n\ \ proc\ pick\ \{w\ zone\ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\n\ \$w\ create\ text\ 100\ \ \ 100\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\n\n\ \ \ \ \$w\ create\ text\ 200\ \ \ 180\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\n\n\ \ \ \ \ \$w\ create\ text\ \ 300\ \ \ 100\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ \ #\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n\ \ \ \ #\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n\ \ \ \ \ #\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\ \ \ \ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \$w\ create\ text\ 200\ \ \ 200\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ set\ juliandater\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ -timezone\ \$zone\]\"\n\ \ \ set\ mean20\ \[\ cmonth\ \$day\ \]\n\ \ \ set\ mean25\ \[\ chseason\ \$day\ \]\n\ \ \$w\ create\ text\ 200\ \ \ 225\ -text\ \"chinese\ season\ is\ \ \ \ *\ \$mean25\ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 245\ -text\ \"chinese\ fortnight\ \ is\ \ \ \ *\ \$mean20\ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"\$juliandater\ \ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\ -timezone\ \$zone\]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ weathermean\ .cv\ \$zone\n\n\ \ \}\n\n\ \ \ \ \ proc\ weathermean\ \{w\ zone\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":Asia/Shanghai\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 39\ 59\ 81\ 102\ 115\ 152\ 128\ 133\ 156\ 61\ 51\ 35\ 35\ 35\ 35\ 35\}\n\n\ set\ rainydays\ \{\ 9\ 10\ 13\ 13\ 14\ 12\ 10\ 12\ 9\ 8\ 7\ 7\ 7\ 7\ 7\ \ \}\n\n\ \ \ set\ meanmin\ \{\ .5\ 1.5\ 5.1\ 10.6\ 15.7\ 20.3\ 24.8\ 24.7\ 20.5\ 14.7\ 8.6\ 2.4\ 2.4\ 2.4\ 2.4\ 2.4\ \ \ \}\n\ \ set\ meanmax\ \{\ 7.7\ 8.6\ 12.7\ 18.6\ 23.5\ 27.2\ 31.6\ 31.5\ 27.2\ 22.3\ 16.7\ 10.6\ 10.6\ 10.6\ \ \}\n\ \ \}\n\n\ if\ \{\ \$zone\ ==\ \":Asia/Hong_Kong\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 24.9\ 52.3\ 71.4\ 188.5\ 329.5\ 388.1\ 374.4\ 444.6\ 287.5\ 151.9\ 35.1\ 34.5\ 34.5\ 34.5\}\n\n\ set\ rainydays\ \{\ 5.6\ 9.5\ 10.5\ 11.7\ 15.5\ \ \ 18.8\ 17.8\ 17.4\ 14.8\ 8.1\ 5.7\ 4.3\ 4.3\ 4.3\ 4.3\}\n\n\ \ \ set\ meanmin\ \{\ 14.1\ 14.4\ 16.9\ 20.6\ 23.9\ 26.1\ 26.7\ 26.4\ 25.6\ 23.4\ 19.4\ 15.7\ 15.7\ 15.7\}\n\ \ set\ meanmax\ \{\ 18.6\ 18.6\ 21.5\ 25.1\ 28.4\ 30.4\ 31.3\ 31.1\ 30.2\ 27.7\ 24.0\ 20.3\ 20.3\ 20.3\ \ \}\n\ \}\n\n\ \ if\ \{\ \$zone\ ==\ \":Asia/Taipei\"\ \}\ \{\n\ \ #beijing\n\ \ \ \ \ \ \ \ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\n\n\ \ \ \ \ \ \ \ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{\ \ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ -.4\ -6.9\ -6.9\ -6.9\}\n\ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\ v3.3\ \ \ \}\n\ \ \}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":America/Chicago\"\ \}\ \{\n\ \ \ \ \ set\ meanrainmm\ \{\ \ \ 38.9\ 34.5\ 68.3\ 92.5\ 84.3\ 96.0\ 93.0\ 107.2\ 97.0\ 61.2\ 74.2\ 62.7\ 62.7\ \}\n\n\ \ \ \ \ set\ rainydays\ \{\ 7.3\ 6.2\ 9.0\ 9.5\ 8.9\ 8.0\ 8.0\ 7.5\ 7.7\ 6.6\ 7.9\ 7.8\ 7.8\ 7.8\ \}\n\n\ \ \ set\ meanmin\ \{\ -10.6\ -8.2\ -1.9\ 3.7\ 8.7\ 14.2\ 17.0\ 16.4\ 12.2\ 5.7\ -0.2\ -7.2\ -7.2\ -7.2\ \ \}\n\ \ \ \ \ set\ meanmax\ \{-1.7\ 0.8\ 7.7\ 14.8\ 21.2\ 26.4\ 28.7\ 27.7\ 23.8\ 17.4\ 9.1\ 1.1\ 1.1\ 1.1\ \ \}\n\ \ \ \}\n\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[format\ \"%6.2f\"\ \[\ meanmonth\ \$day\ \$rainydays\]\]\ \ \"\n\n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\[format\ \"%6.2f\"\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\]\"\n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[format\ \"%6.2f\"\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ -timezone\ \$zone\]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \]\ \"\}\n\n\ \ \ \ set\ kick\ \[\ tempform\ \[\ meanmonth\ \$day\ \$meanmin\]\ \ \[\ meanmonth\ \$day\ \$meanmax\]\ \ \ \$hour\]\n\ \ \ \ \ set\ kick\ \[\ expr\ \{\ abs(\$kick)\ \}\ \]\n\ \ \ \ set\ mean8\ \"\ cosine'\ formula\ \ \ \[format\ \"%6.2f\"\ \$kick\]\ C.\ \"\n\ \ \ \ \ \ \n\ \ \ \ \ set\ mean9\ \"\ chinese\ fortnight\ \[cmonth\ \$day\ \]\"\n\ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 265\ -text\ \$mean8\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \ #console\ show\n\ \ \ #puts\ \[\ tempform\ \[\ meanmonth\ \$day\ \$meanmin\]\ \ \[\ meanmonth\ \$day\ \$meanmax\]\ \ \ \$hour\ \ \ \ \ \]\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\n\ \ \ \ \ \ if\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\n\ \ \ \ if\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\n\ \ \ \ \ \ \ if\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ \ \ \ set\ guess\ \"?\"\n\ \ return\ \$guess\n\ \ \ \}\n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ clrcanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\ \ \ \ \}\n\n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"clear\"\ -command\ \{\ clrcanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"chicago\"\ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :America/Chicago\ \ \ \ \ \}\n\ \ button\ \ .b2\ -text\ \"hongkong\"\ \ -command\ \{\ clrcanvas\ .cv\;pick\ .cv\ :Asia/Hong_Kong\ \ \}\n\ \ button\ \ .b3\ -text\ \"shanghai\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :Asia/Shanghai\}\n\ \ button\ \ .b4\ -text\ \"beijing\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ \ \ .cv\ :Asia/Taipei\ \}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b6\ -text\ \"cos\"\ \ \ -command\ \{\ sinwave\ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b8\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ .b7\ .b8\ -in\ .f2\ \ -side\ left\ -padx\ 2\n\ \ \ \ \ board\ \ \ .cv\n\ #catch\ \{console\ show\}\n======\n\n***FIRST\ VERSION***\ \n\n\n****SECOND\ VERSION\ WITH\ ADDED\ HACKS\ ***\ \n\n\n======\ \n\n\ \ \ \ \ #start\ of\ deck#!/bin/sh\n\ \ \ \ #based\ on\ \n\ \ \ \ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ \ \ \ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\ \n\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\ \n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\ \n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\ \ \ \ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\ \n\ \ \ \ \ package\ require\ Tk\n\ \ \ \ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ \ \ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \n\ \ \ return\ \$answer\n\ \ \}\n\ \ proc\ meanrelmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \ set\ x1\ 6\n\ \ \ set\ x2\ 8\n\ \ \ set\ x3\ 10\n\ \ \ set\ y1\ 5\n\ \ \ set\ y3\ 8\n\ \ \ set\ answer5\ \[expr\ \{\ ((x2-x1)*(y3-y1))/(x3-x1))\ +\ y1\ \}\ \]\n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \ \ set\ answer2\ \[lindex\ \$monthdata\ \$month\]\n\ \ \ set\ answer3\ \[lindex\ \$monthdata\ \[\ expr\ \{\ \$month\ +\ 1\}\ \]\]\n\ \ \ set\ average\ \[\ expr\ \{(\$answer\ +\$answer3)/2\}\]\n\ \ \ set\ portion\ \[\ expr\ \{(\$answer\ +\$answer3)/2\}\]\n\ \ \ return\ \$answer\n\ \ \}\n\n\ \ \ \ \ \ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ \ \ \ \ \ \ \ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\n\nproc\ ClrCanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\ \n\ \ \}\n\n\ \ proc\ DrawAxis\ \{w\}\ \{\n\ \ \ \ set\ midX\ \[expr\ \{\ \$::maxX\ /\ 2\ \}\]\n\ \ \ \ set\ midY\ \[expr\ \{\ \$::maxY\ /\ 2\ \}\]\n\ \ \ \ \$w\ create\ line\ 0\ \ \ \ \ \$midY\ \ \$::maxX\ \ \ \$midY\ \ -tags\ \"axis\"\n\ \ \ \ \$w\ create\ line\ \$midX\ 0\ \ \ \ \ \ \ \ \$midX\ \$::maxY\ \ -tags\ \"axis\"\n\ \ \}\n\n\ \ proc\ PaintText\ \{w\ Txt\}\ \{\n\ \ \ \ global\ y\n\ \ \ \ incr\ y\ 10\n\ \ \ \ \$w\ create\ text\ 20\ \$y\ -text\ \$Txt\ -tags\ \"text\"\n\ \ \}\n\n\ \ proc\ pick\ \{w\ \ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\ \ \ \ \n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\ \$w\ create\ text\ 100\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\ \n\ \ \ \ \n\ \ \ \ \$w\ create\ text\ 200\ \ \ 230\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\n\ \$w\ create\ text\ \ 300\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\ \n\ set\ systemTime\ \[clock\ seconds\]\n\n#\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n#\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n#\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\n\ \$w\ create\ text\ 200\ \ \ 250\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\"\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\]\ \ -tags\ \"text\"\ \ -font\ \$font5\nweathermean\ .cv\n\ \ \ \ \ \ \ \ \ \n\ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ proc\ weathermean\ \{w\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\ \ \n\n\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[\ meanmonth\ \$day\ \$rainydays\]\ \ \"\ \n\ \ \ \ \ \n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\"\n\ \ \n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ \]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\ \n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\}\n\n\ \ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\ \ \ \nif\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\nif\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\nif\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\nif\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\nif\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\nif\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\nif\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\nif\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ set\ guess\ \"?\"\n\ \ return\ \$guess\n\}\n\n\ \ proc\ DrawBox\ \{w\}\ \{\n\ \ \ \ global\ x1\ y1\ x2\ y2\n\ \ \ \ \$w\ create\ rect\ \ 50\ \ 10\ \ 100\ \ 60\ \ -tags\ \"box\"\n\ \ \ \ \$w\ create\ rect\ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -tags\ \"box\"\n\ \ \ \ incr\ x1\ 15\n\ \ \ \ incr\ x2\ 15\n\ \ \ \ incr\ y1\ 10\n\ \ \ \ incr\ y2\ 10\n\ \ \}\n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ ClrCanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\ \ \ \ \}\n\ \ \ \ \ \ \ \n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\ \n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"Clear\"\ -command\ \{\ ClrCanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"Text\"\ \ -command\ \{\ PaintText\ .cv\ \"Canvas\"\ \}\n\ \ button\ \ .b2\ -text\ \"Axis\"\ \ -command\ \{\ DrawAxis\ \ .cv\ \}\n\ \ button\ \ .b3\ -text\ \"Box\"\ \ \ -command\ \{\ DrawBox\ \ \ .cv\ \}\n\ \ button\ \ .b4\ -text\ \"pick\"\ \ \ -command\ \{ClrCanvas\ .cv\;pick\ \ \ .cv\ \}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ button\ \ .b6\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ -in\ .f2\ \ -side\ left\ -padx\ 2\nboard\ \ \ .cv\n\ #catch\ \{console\ show\}\n\ \ \ \ \ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\ #!/bin/sh\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ \n\ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\ \ \ \ \ \ \n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n======\n\n****Version\ with\ added\ hacks\ ****\n\n======\n\n\ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\ \n\ \ \ \ \ \ \ \n\ #!/bin/sh\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ #based\ on\ \n\ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\ \n\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\ \n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\ \n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\n\n\n\n\n\n\n\ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\ \n\ \ package\ require\ Tk\n\ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\n\n\n\n\ \n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \n\n\ \ \ return\ \$answer\n\ \ \}\n\ \n\n\ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\ proc\ listnumbers\ \{\ aa\ bb\}\ \{\ for\ \{set\ i\ \[\ expr\ \{int(\$aa)\}\]\}\ \{\$i<=\$bb\}\ \{incr\ i\}\ \{lappend\ dd\ \[\ expr\ .1*\ \$i\]\ \}\;return\ \$dd\}\n\ \ \ \ \n\ proc\ sinwave\ \{\ w\ \}\ \{\n\ \ \ console\ show\n\ \ \n\ \ \ set\ goo\ \[listnumbers\ 1\ 70\ \]\n\ \ foreach\ item\ \ \ \$goo\ \ \{\n\ \ \ \ puts\ \[\ expr\ \{\ cos\ (\$item)\ \}\ \]\n\ \ \ \ \ \}\n\ \ \ \ \n\ \ \n\ \}\n\n\n\nproc\ clrcanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\ \n\ \ \}\n\n\ \n\n\n\ \ proc\ pick\ \{w\ zone\ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\ \ \ \n\ \n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\ \$w\ create\ text\ 100\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\ \n\ \ \ \ \n\ \ \ \ \$w\ create\ text\ 200\ \ \ 230\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\n\ \$w\ create\ text\ \ 300\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\ \n\ set\ systemTime\ \[clock\ seconds\]\n\n#\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n#\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n#\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\n\ \$w\ create\ text\ 200\ \ \ 250\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ -timezone\ \$zone\]\"\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\ -timezone\ \$zone\]\ \ -tags\ \"text\"\ \ -font\ \$font5\nweathermean\ .cv\ \$zone\n\ \ \ \ \ \ \ \ \ \n\ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ proc\ weathermean\ \{w\ zone\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\ \ \n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":Asia/Shanghai\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ if\ \{\ \$zone\ ==\ \":Asia/Hong_Kong\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ \ if\ \{\ \$zone\ ==\ \":Asia/Taipei\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":America/Chicago\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[format\ \"%6.2f\"\ \[\ meanmonth\ \$day\ \$rainydays\]\]\ \ \"\ \n\ \ \ \ \ \n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\[format\ \"%6.2f\"\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\]\"\n\ \ \n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[format\ \"%6.2f\"\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ -timezone\ \$zone\]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\ \n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \]\ \"\}\n\n\ \ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\ \ \ \nif\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\nif\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\nif\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\nif\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\nif\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\nif\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\nif\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\nif\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ set\ guess\ \"?\"\n\ \ return\ \$guess\n\}\n\n\ \n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ clrcanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\n\ \ \ \ \ \n\ \ \ \ \n\ \ \ \ \}\n\ \ \ \ \ \ \ \n\n\n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\ \n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"clear\"\ -command\ \{\ clrcanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"chicago\"\ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :America/Chicago\ \ \ \ \ \}\n\ \ button\ \ .b2\ -text\ \"hongkong\"\ \ -command\ \{\ clrcanvas\ .cv\;pick\ .cv\ :Asia/Hong_Kong\ \ \}\n\ \ button\ \ .b3\ -text\ \"shanghai\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :Asia/Shanghai\}\n\ \ button\ \ .b4\ -text\ \"peking\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ \ \ .cv\ :Asia/Taipei\}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ button\ \ .b6\ -text\ \"cos\"\ \ \ -command\ \{\ sinwave\ \ .cv\ \}\n\ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ -in\ .f2\ \ -side\ left\ -padx\ 2\nboard\ \ \ .cv\n\ #catch\ \{console\ show\}\n\n\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck*\ \n\ \ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\n\ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \ \ #end\ of\ deck\n\ \ \ #end\ of\ \ deck\n\ \ \ #end\ of\ deck\n\ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \n======\n\ \ \ \ \n<<categories>>\ Toys\ |\ Example\ |\ Games\ |\ Characters regexp2} CALL {my render {Chinese Iching Random Weather Predictions} \ \n**Chinese\ Iching\ Random\ Weather\ Predictions**\n\n----\ \ \ \nThis\ page\ is\ under\ development.\ Comments\ are\ welcome,\nbut\ please\ load\ any\ comments\ in\ the\ comments\ section\nat\ the\ middle\ of\ the\ page.\ Thanks,\ \[gold\]\n\n----\nHere\ is\ some\ starter\ code\ for\nChinese\ Iching\ Random\ Weather\ Predictions.\ \nThe\ Iching\ is\ the\ ancient\ fortune\ telling\nbook\ of\ China.\ The\ Iching\ literature\ mentions\nvarious\ methods\ for\ casting\ fortune\ patterns.\nIn\ researching\ for\ the\ Iching\ Fortunes\ \npage\ on\ this\ wiki,\nI\ ran\ into\ several\ mentions\ of\ \nusing\ the\ Iching\ to\ predict\nthe\ weather.\ \ In\ the\ iching\ itself,\nthere\ are\ at\ least\ some\ninferences\ on\ weather.\nOn\ the\ public\ wall\ in\ beijing,\ the\ iching\ \ntrigrams\ were\ generally\ posted\ \ \nas\ a\ daily\ weather\ prediction\ in\ Ming\ times.\ \nThis\ page\ is\ more\ an\ investigation\ into\nthe\ mindset\ of\ the\ Chinese\ sages,\nusing\ TCL\ visual\ and\ random\ subroutines\ \ \n\n----\nThe\ Iching\ is\ the\ ancient\ fortune\ telling\nbook\ of\ China.\ The\ Iching\ literature\ mentions\nvarious\ methods\ for\ casting\ fortune\ patterns\nof\ Iching.\ The\ various\ methods\ include\ \nhot\ ironing\ of\ turtle\ shells\ (-t.),\nmanipulations\ of\ yarrow\ sticks,\ flipping\ coins,\nthrowing\ shaman\ bones,\ and\ dice.\nOne\ analogy\ from\ North\ America\nis\ a\ shaman\ throwing\ or\nshuffling\ stick\ dice.\n----\nI\ made\ three\ stick\ dice\ for\nIching\ by\ cutting\ a\ dowel\ of\ square\ cross\ section\ninto\ three\ sticks.\nFor\ the\ three\ stick\ dice,\ the\ flat\ sides\ are\ marked\ or\nburned\ with\ 2\ or\ 3\ holes\ alternately.\nTwo\ sticks\ are\ marked\nwith\ \{3\ 2\ 3\ 2\}\ dots\ on\ the\ sides.\ One\ stick\ is\ marked\nwith\ \{3\ 3\ 3\ 2\}\ dots\ on\ the\ sides.\nIn\ casting\ such\ three\ dice,\nthe\ possible\ sums\ are\ 6,7,8,\ or\ 9.\ Further,\ the\nstick\ dice\ are\ cast\ six\ times\ to\ obtain\ whole\ lines\nor\ broken\ lines\ in\ a\ pattern\ or\ set\ of\ six\ lines.\nA\ set\ of\ six\ Iching\ lines\ is\ called\ a\ gua\nin\ the\ orient\ or\ a\ hexagram\ in\ some\ translations\nof\ the\ Chinese.\n----\nIn\ the\ Iching\ interpretations,\ casts\ of\n6\ and\ 8\ are\ broken\ or\ yin\ (female)\ lines,\nwhile\ casts\ of\ 7\ and\ 9\ are\ whole\ or\ yang\ (male)\ lines.\nThe\ yin\ numbers\ of\ 6\ and\ 8\ are\ even\ numbers.\nThe\ yang\ numbers\ of\ 7\ and\ 9\ are\ odd\ numbers.\nThe\ casts\ are\ recorded\ by\npencil\ with\ the\ first\ line\nat\ bottom\ and\ marking\ up\ the\ column.\nIt\ is\ possible\ to\ record\ the\ numbers\ from\ the\ \ncasts\ with\ tally\ sticks\ \ or\ Chinese\ counting\ rods,\nwhich\ are\ somewhat\ reminiscent\ of\nthe\ Iching\ patterns\ themselves.\nAfter\ marking\ the\ original\ pattern\ or\ \ \nhexagram,\ sometimes\ a\ second\ follow-up\ hexagram\nis\ developed\ by\ swapping\ throws\ of\ 6\ for\ a\ 7\nand\ throws\ of\ 9\ for\ a\ 6.\ These\ swaps\ \ effectively\ntrade\ a\ broken\ \ line(6)\ for\ a\ whole\ line(7)\nand\ a\ whole\ line(9)\ for\ a\ broken\ line(6).\ \nThe\ throws\ for\ the\ changing\nlines\ (6&9)\ may\ not\ always\ \nbe\ come\ out\ in\ the\ first\ hexagram\ or\ \nits\ component\ lines,\ so\ the\ followup\ hexagram\nmay\ not\ exist\ \{under\ consistent\ rules\}.\nIf\ the\ first\ hexagram\ is\ interpreted\ on\ a\ line\nby\ line\ basis,\ any\ changing\ lines(6&9)\ or\ second\nhexagram\ offers\ some\ modification\ or\ discount\ on\nthe\ interpretation\ of\ the\ first\ hexagram.\ \ \n\n----\nContinuing\ with\ the\ development\ of\ hexagrams,\ there\nwould\ be\ 2**6\ or\ 64\ hexagrams.\nAnd\ the\ ancient\ chinese\nwere\ not\ finished\ with\ 64\ hexagrams.\nAt\ least\ one\ western\ Han\ text\n(Chiao\ shih\ Yi\ Lin\ )\ gives\ consideration\ to\ transforms\nof\ 64*64\ dimensions\ or\ 4096.\ So\ the\nchinese\ busted\ into\nthe\ barrier,\ \ 2\ **\ 12\ =\ 4096.\ \ \n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n----\nIn\ developing\ a\ computer\ program\ or\ application,\nit\ is\ helpful\ to\ develop\ analogs\ \nfor\ the\ individual\ tasks\ of\ the\ application.\nAn\ Iching\ application\ would\ have\ to\ compose,\ \nbeg,\ or\ borrow\ TCL\ procedures\ for\ random\ casts,\ntallies\ of\ scores,\ accounting\ files,\ndisplay\ hexagram\ lines\ on\ a\ screen,\ \nswapping\ changing\ lines,\ hexagram\ pattern\ \nrecognition\ and\ ranking\ interpretations.\n\ \ \ \ \ \ \ \nFor\ computer\ procedures,\ the\ patterns\ are\ effectively\ a\ \nhorizontal\ bar\ code\ of\ 6\ lines.\n\n----\nIn\ the\ process\ of\ designing\ the\ basic\nsubroutine\ tasks,\ we\ could\ throw\ in\ some\nswitches,\ logic\ chains,\ or\ daisy\ chains\nthat\ break\ the\ outset\ rules\ given\ above.\nFor\ example,\ TCL\ is\ so\ good\ at\ swapping\ lines\ (6&9)\nfor\ the\ second\ hexagram,\ that\ it\ would\ \nbe\ easy\ to\ put\ a\ switch\ that\ generates\ or\nswaps\ all\ hexagram\ lines\ (6,7,8,&9)\nfor\ their\ opposites.\nAlso\ from\ some\ scripts\ of\nthe\ Chinese\ Chou\ dynasty,\ndifferent\ Iching\ fortune\ methods\ of\nyarrow\ sticks\ or\ coins\ would\ generate\ndifferent\ probabilities\ of\ obtaining\neach\ hexagram\ line.\ Might\ be\ interesting\ to\nhave\ a\ back\ door\ in\ the\ program\nto\ check\ (or\ adapt\}\ the\ different\ probabilities\nof\ stick\ or\ coin\ throws.\ Several\ authors\nhave\ pointed\ out\ that\ a\ few\ of\ the\ hexagrams\nlook\ similar\ to\ Chinese\ characters\ or\ even\nMayan\ calendar\ notation.\ Without\ wading\ too\ \ndeep\ into\ alternate\ realities,\ the\ Iching\nhexagrams\ could\ be\ used\ as\ numerals,\nscript\ alphabet,\ game\ tokens,\ symbol\ recognition\ code,\nor\ maybe\ a\ programming\ language\ (like\ Greek\nletters\ for\ APL\ operators).\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \nSuch\ rule\ breaking\ helps\ keep\ the\ finished\nprogram\ more\ flexible.\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\n\nIn\ the\ West,\nLeibniz\ recognized\ that\nthe\ whole\ and\ broken\ lines\nin\ the\ hexagram\ patterns\ could\nbe\ counted\ as\ ones\ and\ zeros,\ respectively\ in\na\ binary\ number\ system.\ For\ example,\ a\ cast\ or\ \ \ list\nof\ \{\ 6,7,8,9,6,7\ \}\ could\ be\ expressed\ as\ a\ binary\nnumber,\ 010101.\ For\ computer\ procedures,\nthe\ patterns\ are\ effectively\ a\nhorizontal\ bar\ code\ of\ 6\ lines.\nThe\ probability\ of\ each\ line\ by\ \nthe\ yarrow\ stick\ method\ or\ coin\ casting\ method\ is\ndifferent.\ \n\n\n\nThe\ probability\ of\ the\ yarrow\ stick\ method\ is\ 1,3,5,7\ over\ 16.\nThe\ number\ 6\ or\ old\ yin\ is\ 1/16\ or\ 0.0625\nThe\ number\ 7\ or\ young\ yang\ is\ 3/16\ or\ 0.1875.\nThe\ number\ 8\ or\ young\ yin\ is\ 5/16\ or\ 0.3125.\nThe\ number\ 9\ or\ old\ yang\ is\ 7/16\ or\ .4375.\nFor\ the\ yarrow\ sticks,\ the\ combined\ probability\ of\ any\ throw\ is\n.0625\ +\ .1875\ +\ .3125\ +\ .4375\ =\ 1\n\nFor\ the\ iching\ dice\ pictured\ below,\ the\ three\ sticks\ read\n2,3,and\ 3\ which\ totals\ 8.\ The\ combined\ probability\ of\ncasting\ 2,3,\ and\ 3\ is\ 0.3125\ (with\ the\ sticks).\ \n\nFor\ the\ coins,the\ probability\ of\ the\ coin\ casting\ method\ is\ 2,2,6,6\ over\n16.\nThe\ number\ 6\ or\ old\ yin\ is\ 2/6\ or\ 0.125.\ \n\nThe\ number\ 7\ or\ young\ yang\ is\ 2/16\ or\ 0.125.\nThe\ number\ 8\ or\ young\ yin\ is\ 6/16\ or\ 0.375.\nThe\ number\ 9\ or\ old\ yang\ is\ 6/16\ or\ .375.\nFor\ the\ coins,\ the\ combined\ probability\ of\ any\ throw\ is\n.125\ +\ .125\ +\ .375\ +\ .375\ =\ 1\n\nFor\ a\ system\ of\ 2\ sided\ sticks\ or\ coins\ of\ the\ number\ N,\nthe\ probability\ of\ getting\ all\ zeros\ or\ ones\ would\ be:\nset\ aa\ \[\ expr\ \{\ \ (1./(2**\$N))\}\ \]\ \;#\ generic\ TCL\nFor\ three\ coins,\ the\ formula\ would\ be\ \nset\ aa\ \[\ expr\ \{\ \ (1./(2**3)\}\ \]\ \ \ \ or\ 1/8\nFor\ example\ the\ trigrams\ known\ as\ heaven\ (111)\ and\nearth\ (000)\ would\ have\ a\ probability\ of\ 1/8.\ \nFor\ six\ coins,\ the\ formula\ would\ be\ \ set\ aa\ \[\ expr\ \{\ \ (1./(2**6)\}\ \]\nor\ 1/64.\nFor\ N\ dice,\ the\ probability\ that\ a\ one\ or\ zero\ would\ show\ up\non\ one\ of\ N\ dice\ would\ be\ \nset\ aa\ \[\ expr\ \{\ \ (1.-(1./(2**\$N)))\}\ \]\ \ \n\n----\nThe\ Chinese\ believed\ that\ weather\ was\ the\ \ncombination\ of\ the\ 5\ elements\ or\ chi\ forces\ \ in\ the\ air\nnamely,\ rain,\ sunshine,\ heat,\ cold\ and\ wind\ .\nthey\ reasoned\ that\ the\ weather\ was\ the\ combination\ of\nchi\ forces\ between\ heaven\ and\ earth.\nFor\ example,\ the\ combination\ of\ cold\ and\ rain\ produces\ snow.\n\nUsing\ the\ trigrams\ as\ symbols\ ,\ the\ combination\ of\ \ntwo\ infer\ the\ mixing\ of\ conditions.\nFurther,\ the\ trigrams\ were\ associated\ with\ directions.\ \nforetell\ the\ weather\n1.\ based\ on\ the\ primary\ trigram\n2.\ the\ combination\ of\ trigrams\n3.\ the\ season\n4.\ prevailing\ conditions\n\nThe\ \ fortnight\ periods,\ more\ specific\ as\ to\ expected\ conditions.\ \nand\ 5\ seasons.\ spring,\ summer,\ late\ summer,\ autumn,\ and\ winter.\n\n\nIt\ is\ possible\ to\ make\ a\ \ iching\ gnomon\ using\ a\ pointed\ stick\ and\nboard.\ These\ individual\ markers\ will\ register\ binary\ ones\ and\ zeros\nas\ the\ sun\ rises\ from\ 600\ to\ 1200\ hours.\ And\ flipping\ the\ orientation\ \nof\ the\ board,\ measure\ the\ hours\ 1200\ to\ 1800\ hours.\ For\ the\ iching\ gnomon\nbelow,\ the\ shadow\ of\ 1300\ hours\ is\ across\ the\ first\ bar,\ which\ is\none\ hour\ after\ noon,\ meaning\ \ 1300\ hours.\ \ The\ six\ binary\ bars\ show\n011111.\ \ \n\n\nWhen\ the\ goinon\ end\ of\ the\ board\ \ is\ pointed\ at\ the\ morning\ sun,\nthe\ goinon\ will\ measure\ the\ hours\ (600+N)\ until\ noon.\n\nWhen\ the\ goinon\ end\ of\ the\ board\ \ is\ pointed\ at\ the\ afternoon\ sun,\nthe\ goinon\ will\ measure\ the\ hours\ (1200+N)\ until\ the\ sun\ goes\ down.\nAs\ the\ goinon\ shadow\ passes\ a\ stick\ mark,\ the\ sequence\ of\ 6\ binary\ numbers\nis\ 111111,\ \ 011111,001111,000111,000011,000001\ or\ decimals\n63,31,15,7,3,1\n\n\n\n\n\n\n\n\n\nIn\ the\ context\ of\ the\ oracle\ bones,\nthe\ Shang\ were\ careful\ to\ \nrecord\ the\ weather\ as\ the\ hunting\nparty\ or\ warrior\ raid\ set\ out,\npresumably\ early\ in\ the\ morning.\nSecondly\ they\ recorded\ the\noracle\ forecast\ and\ result.\nThese\ observations\ on\ the\ oracle\ bones\ \ncontain\ elements\ of\ the\ scientific\ method.\n----\nFor\ a\ trigram,\ returning\ 2\ out\nof\ 3\ yin\ lines\ might\ \ngive\ a\ rainy\ forcast\ at\ binomial\nprobability\ of\ 0.375.\nAny\ area\ with\ roughly\ 10\ rainy\ndays\ a\ month\ over\ the\nsummer\ \ would\ have\ a\ probability\ of\n10/30\ or\ 0.333.\ Here\ is\ \npossible\ theory\ that\nthe\ trigram\ probability\nand\ the\ rainy\ day\ probability\nare\ somewhat\ comparable.\n----\nFor\ Shanghai\ on\ 8Jul2010,\ the\ two\ trigrams\ developed\ were\ 2\ and\ 3\ \nwhich\ indicates\ southwest\ and\ \nrain\ conditions.\ The\ interpolated\ mean\ \ntemperature\ was\ 24\ C.\ The\ internet\nreported\ rain\ and\ winds\ in\ the\nsouthwest\ at\ 7\ mph,\ 27\ C,\ \ and\ 79\ \nper\ cent\ humidity.\ The\ Shanghai\ timezone\ \nwas\ loaded\ into\ the\ code\ on\ the\ fly.\ \ \ \n\n----\nFor\ Beijing\ on\ 11Jul2010,\ the\ temp\ was\ 22C,\nlight\ rain,east\ wind\ at\ 9\ mph,\ humidity\ 83%.\nThe\ picked\ trigrams\ were\ 3\ and\ 5,\ meaning\nhot\ sunny\ and\ windy,\ pretty\ much\ a\ bust\ for\ the\nIching.\ Interpolated\ temperature\ \nwas\ 23.9C\ and\ chance\ of\ rainy\ day\ was\ 0.47.\n---\nFor\ Chicago\ on\ 11Jul2010,\ \nthe\ temp\ was\ 29C,\ \ ,northwest\ wind\ at\ 16\ kmph,\ \ .\nThe\ picked\ trigrams\ were\ 5\ and\ 5,\nmeaning\ \ windy\ and\ change\ with\ SE\ wind,\npretty\ much\ a\ strike\ out\ for\ the\ Iching.\ \nInterpolated\ temperature\ was\ \n17C\ and\ chance\ of\ rainy\ day\ was\ 0.27.\n\n\n\n\n\n\n\n\n\n\nShanghai\ was\ checked\ on\ 21JUL2010,\ \nthe\ weather\ was\ mostly\ cloudy\ and\ 27\ degrees\ C.\nReported\ 84\ %humidity\ and\ SE\ winds\ at\ 9mph.\nIching\ forcast\ was\ trigrams\ 3\ and\ 4,\nmeaning\ hot\ sunny,\ and\ stormy.\nMean\ temp\ was\ 30.47\ C.and\n0.33\ chance\ of\ rainy\ day.\ Iching\npredction\ seemed\ moderately\ accurate.\n----\nThe\ weather\ fronts\ do\nseem\ to\ come\ in\ cycles.\nThe\ theory\ of\ weekend\ rain\nproposes\ greater\ chance\non\ rain\ on\ weekends\ \nWould\ like\ to\ gather\nsome\ more\ testcases\ and\ profiles,\ maybe\ \nsome\ kind\ of\ neural\ filter\nor\ fuzzy\ logic\ could\ be\ developed.\nA\ very\ interesting\ cosine\ model\nfor\ daily\ temperature\ by\ Martinez\ was\ found\nin\ the\ literature.\ A\ normalized\ solar\ loading\ncurve\ were\ calculated\ at\ another\ site.\n\n\n----\nWith\ the\ buttons\ in\ the\ little\ \ncanvas\ demo,\ one\ can\ call\ up\nseparate\ routines\ to\ lay\nout\ the\ different\nboards\ and\ install\ the\ various\ options\ \ .\nIn\ a\ teamwork\ situation,\ programming\nteams\ could\ divide\ up\nthe\ several\ tasks\ with\ the\ framework.\nIn\ the\ button\ call\ \nup\ of\ the\ canvas\ demo,\ separate\ tasks\ncan\ laid\ in\ successive\nstatements\ to\ clear\ board,\nset\ states,\ layout\ the\ board,\ .\nLoading\ three\ statements\ in\ the\ button\nmight\ be\ ClrCanvas\ .cv\;\ \nset\ state3\ 3\;board\ .cv\;\nThis\ gets\ a\ little\ lengthy\ for\ a\nbutton\ line,\ so\ these\ statements\ could\ \nbe\ stacked\ in\ a\ separate\ subroutine.\nWith\ some\ global\ statements\ for\nany\ constants\ and\ passing\ the\ncanvas\ name\ as\ \$w,\ the\ \ subroutine\ncould\ be\ written\ like\ \n\n======\n\ \ proc\ stackedlist\ \{w\}\ \{\n\ \ \ \ global\ state3\n\ \ \ \ ClrCanvas\ \$w\n\ \ \ \ set\ state3\ 3\n\ \ \ \ board\ \$w\n\ \ \}\n======\n\n----\n**Screenshots\ Section**\n\n\[http://farm5.static.flickr.com/4078/4781356338_5b53b1a444.jpg\]\n\[http://farm5.static.flickr.com/4121/4796219415_455bd2f5a2.jpg\]\n\[http://farm5.static.flickr.com/4136/4812522943_33727ff8ec.jpg\]\n\[http://farm5.static.flickr.com/4114/4812413403_e697523a46.jpg\]\n\[http://farm5.static.flickr.com/4098/4818003683_be9dddea77.jpg\]\n\[http://farm5.static.flickr.com/4123/4821292691_35da154995.jpg\]\n\n----\n**Comments\ Section**\nPlease\ place\ any\ comments\ here,\ Thanks.\n\n\[gold\]\ Changes.\n\n----\n**References***\n\n\ \ \ *\ \[Simple\ Canvas\ Demo\]\n\ \ \ *\ \[Clock\ and\ daylight\ saving\ time\ corrections\]\n\ \ \ *\ \[timezone\]\n\ \ \ *\ www.ejournal.unam.mx/atm/Vol04-3/ATM04302.pdf\n\ \ \ *\ http://rishida.net/tools/conversion/,\ outstanding\ unicode\ conversion\ online!!!\n\ \ \ *\ http://pinyin.info/tools/converter/chars2uninumbers.html\n\ \ \ *\ http://en.wikipedia.org/wiki/Miscellaneous_Symbols_Unicode_block\n\ \ \ *\ http://www.dennismerrittjungiananalyst.com/China_paper.htm\n\ \ \ *\ http://www.openexchange.org/archives/AMJ04/gordon.html\n\ \ \ *\ http://www.superiching.com/guanature.htm\n\ \ \ *\ http://news.bbc.co.uk/2/hi/sci/tech/146120.stm\n\ \ \ *\ http://nasgem.rpi.edu/files/1686\n\ \ \ *\ http://www.biroco.com/yijing/Shih-chuan_Chen.pdf\n\ \ \ *\ Early\ Bronzes,\ chen\ lang\n\ \ \ *\ \[http://www.biroco.com/yijing/Chang_Cheng-lang.pdf\]\n\ \ \ *\ http://www.nature.com/nature/journal/v256/n5515/abs/256296a0.ht\n\ \ \ *\ http://mysite.du.edu/~jcalvert/math/chinum.htm\n\ \ \ *\ Doctor\ Syd,\ \ The\ Math\ Forum,\ 2/25/96\ \ on\ probability\ of\ 6\ choose\ 2\n\ \ \ *\ http://www.chineseastrologyonline.com/OracleBone.htm\n\ \ \ *\ http://www.chinavista.com/experience/oracle/oracle.html\n\ \ \ *\ http://www.lib.cuhk.edu.hk/uclib/bones/bones.htm\n\ \ \ *\ http://www.chinapage.com/oracle/oracle.html\n\ \ \ *\ http://www.chinapage.com/archeology/030411.pdf\n\ \ \ *\ http://www.chinapage.com/oracle/news.html\n\ \ \ *\ http://www.chinesefortunecalendar.com/CLC/Default.htm\n\ \ \ *\ http://www.chinesefortunecalendar.com/CLC/LunarCalendar.htm\n===\nTEMPERATURE\ AND\ THE\ ASSIGNMENT\ OF\ THE\ HEXAGRAMS\ OF\ THE\ I-CHING\ TO\ THE\ CALENDAR\nEDWARD\ A.\ HACKER\ 1\ \n1\ NORTHEASTERN\ UNIVERSITY,\ BOSTON,\ MASSACHUSETTS\ \nhttp://www3.interscience.wiley.com/journal/119856417/abstract\n===\nJournal\ of\ Chinese\ Philosophy\nVolume\ 9\ Issue\ 4,\ Pages\ 395\ -\ 400\nPublished\ Online:\ 28\ Jun\ 2008\n===\n\n**appendix\ TCL\ programs**\n\n======\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ \ \ \ #based\ on\n\ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\ \ \ \ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\n\ \ package\ require\ Tk\n\ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\n\ \ \ return\ \$answer\n\ \ \}\n\ \ \ \ \n\ \ \ \ \ proc\ chseason\ \{aa\}\ \{\n\ \ \ \ \ set\ chinaseason\ \"?\"\n\ \ \ \ if\ \{\ \$aa\ >=\ 20\ &&\ \$aa\ <=\ 93\ \}\ \{set\ chinaseason\ \"spring\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 93\ &&\ \$aa\ <=\ 167\ \}\ \{set\ chinaseason\ \"summer\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 167\ &&\ \$aa\ <=\ 242\ \}\ \{set\ chinaseason\ \"late\ summer\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 242\ &&\ \$aa\ <=\ 315\}\ \{set\ chinaseason\ \"autumn\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 315\ &&\ \$aa\ <=\ 365\}\ \{set\ chinaseason\ \"winter\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 0\ &&\ \$aa\ <=\ 6\}\ \{set\ chinaseason\ \"winter\"\}\n\ \ \ \ \ return\ \$chinaseason\ \}\n\n\ \ \ \ \ proc\ cmonth\ \{aa\}\ \{\n\n\ \ \ \ \ set\ cmonth\ \"?\"\n\ \ \ \ if\ \{\ \$aa\ >=\ 36\ &&\ \$aa\ <=\ 51\ \}\ \{set\ cmonth\ \"beginning\ of\ spring\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 51\ &&\ \$aa\ <=\ 66\ \}\ \{set\ cmonth\ \"rain\ water\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 66\ &&\ \$aa\ <=\ 81\ \}\ \{set\ cmonth\ \"excited\ insects\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 81\ &&\ \$aa\ <=\ 96\}\ \{set\ cmonth\ \"spring\ equinox\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 96\ &&\ \$aa\ <=\ 157\}\ \{set\ cmonth\ \"clear\ and\ bright\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 157\ &&\ \$aa\ <=\ 126\}\ \{set\ cmonth\ \"grain\ rains\ \ \ \ \ \ \ \ \"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 126\ &&\ \$aa\ <=\ 142\}\ \{set\ cmonth\ \"summer\ begins\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 142\ &&\ \$aa\ <=\ 158\}\ \{set\ cmonth\ \"grain\ filling\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 158\ &&\ \$aa\ <=\ 173\}\ \{set\ cmonth\ \"grain\ in\ ear\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 173\ &&\ \$aa\ <=\ 189\}\ \{set\ cmonth\ \"summer\ solstice\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 189\ &&\ \$aa\ <=\ 205\}\ \{set\ cmonth\ \"slight\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 205\ &&\ \$aa\ <=\ 220\}\ \{set\ cmonth\ \"great\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 220\ &&\ \$aa\ <=\ 236\}\ \{set\ cmonth\ \"autumn\ begins\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 236\ &&\ \$aa\ <=\ 251\}\ \{set\ cmonth\ \"limit\ of\ heat\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 251\ &&\ \$aa\ <=\ 267\}\ \{set\ cmonth\ \"white\ dew\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 267\ &&\ \$aa\ <=\ 282\}\ \{set\ cmonth\ \"autumn\ equinox\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 282\ &&\ \$aa\ <=\ 297\}\ \{set\ cmonth\ \"cold\ dew\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 297\ &&\ \$aa\ <=\ 312\}\ \{set\ cmonth\ \"hoar\ frost\ descends\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 312\ &&\ \$aa\ <=\ 327\}\ \{set\ cmonth\ \"Winter\ begins\"\}\n\ \ \ \ if\ \{\ \$aa\ >=\ 327\ &&\ \$aa\ <=\ 341\}\ \{set\ cmonth\ \"slight\ snow\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 341\ &&\ \$aa\ <=\ 356\}\ \{set\ cmonth\ \"great\ snow\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 356\ &&\ \$aa\ <=\ 365\}\ \{set\ cmonth\ \"winter\ solstice\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 1\ &&\ \$aa\ <=\ 6\}\ \{set\ cmonth\ \"winter\ solstice\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 6\ &&\ \$aa\ <=\ 21\}\ \{set\ cmonth\ \"slight\ cold\"\}\n\ \ \ \ \ \ if\ \{\ \$aa\ >=\ 21\ &&\ \$aa\ <=\ 36\}\ \{set\ cmonth\ \"great\ cold\"\}\n\ \ \ \ \ if\ \{\ \$aa\ >=\ 366\}\ \{set\ cmonth\ \"?\"\}\n\ \ \ \ return\ \$cmonth\ \ \ \ \}\n\n\ \ \ \ \ \ \ \ proc\ pi\ \{\}\ \{expr\ acos(-1)\}\n\n\ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\n\ \ \ \ \ proc\ tempform\ \{\ aa\ bb\ cc\ \}\ \{\n\ \ set\ \ hour1\ \$cc\n\n\ \ set\ bigterm\ \[\ expr\ \{((\$aa+\$bb)/2.)+((\$bb-\$aa)/2.)\}\ \]\n\ \ \ \ set\ hour3\ 6\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\ \ set\ hour2\ 12\n\ \ set\ hour3\ 14\n\ \ \ #set\ cc\ 20\n\ \ if\ \{\ \$cc\ <=\ 14\}\ \{\n\ \ #set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ \ #puts\ \"first\ \$res\"\n\ \ return\ \$res\}\n\n\ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\n\ \ \ \ \ if\ \{\ \$cc\ >\ 14\}\ \{\n\ \ \ \ \ \ set\ hour3\ 13\n\ \ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1-\ 14)/(14-\$hour3)\ \ \ \ \}\]\n\ \ \ \ \ \ set\ res\ \[\ expr\ \{\ \$bigterm*cos(\ \$term3\ )\ *-1.\ \ \ \ \}\]\}\n\ \ \ #puts\ \"second\ \ \$res\"\n\ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \}\n\n\ \ \ \ \ \ proc\ tempformxxx\ \{\ aa\ bb\ cc\ \}\ \{\n\ \ set\ \ hour1\ \$cc\n\n\ \ set\ bigterm\ \[\ expr\ \{((\$aa+\$bb)/2.)+((\$bb-\$aa)/2.)\}\ \]\n\n\ \ \ \ \ \ set\ term5\ \[\ expr\ \{\ \}\]\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$term5)/(10+\$hour1)\ \ \ \ \ \}\]\n\n\ \ set\ hour2\ 12\n\ \ set\ hour3\ 14\n\ \ \ \ set\ cc\ 9\n\ \ if\ \{\ \$cc\ <=\ 14\}\ \{\n\n\ \ \ \ \ \ \ \ set\ hprime5\ \[\ expr\ \{\ \}\]\n\n\ \ \ \ \ set\ term2\ \[\ expr\ \{\ \[pi\]*(\$hprime5)/(10+\$hour1)\ \ \ \ \ \}\]\n\n\ \ set\ res\ \[\ expr\ \{\ -1.*\$bigterm*cos(\ \$term2\ )\ \ \ \ \ \}\]\n\ \ #puts\ \"first\ \$res\"\n\ \ return\ \$res\}\n\n\ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1+\ 10)/(10+\$hour3)\ \ \ \ \}\]\n\n\ \ \ \ \ if\ \{\ \$cc\ >\ 14\}\ \{\n\ \ \ \ \ \ set\ hour3\ 13\n\ \ \ \ \ set\ term3\ \[\ expr\ \{\ \[pi\]*(\$hour1-\ 14)/(14-\$hour3)\ \ \ \ \}\]\n\ \ \ \ \ \ set\ res\ \[\ expr\ \{\ \$bigterm*cos(\ \$term3\ )\ *-1.\ \ \ \ \}\]\}\n\ \ \ #puts\ \"second\ \ \$res\"\n\ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \}\n\n\ \ \ \ \ proc\ listnumbers\ \{\ aa\ bb\}\ \{\ for\ \{set\ i\ \[\ expr\ \{int(\$aa)\}\]\}\ \{\$i<=\$bb\}\ \{incr\ i\}\ \{lappend\ dd\ \[\ expr\ .1*\ \$i\]\ \}\;return\ \$dd\}\n\n\ \ \ \ \ \ \ proc\ sinwave\ \{\ w\ \}\ \{\n\ \ \ console\ show\n\n\ \ \ set\ goo\ \[listnumbers\ 1\ 70\ \]\n\ \ foreach\ item\ \ \ \$goo\ \ \{\n\ \ \ \ puts\ \[\ expr\ \{\ cos\ (\$item)\ \}\ \]\n\ \ \ \ \ \}\n\n\ \ \ \ \ \}\n\n\ \ \ \ \ \ proc\ clrcanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\n\ \ \}\n\n\ \ proc\ pick\ \{w\ zone\ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\n\ \$w\ create\ text\ 100\ \ \ 100\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\n\n\ \ \ \ \$w\ create\ text\ 200\ \ \ 180\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\n\n\ \ \ \ \ \$w\ create\ text\ \ 300\ \ \ 100\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ \ #\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n\ \ \ \ #\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n\ \ \ \ \ #\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\ \ \ \ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \$w\ create\ text\ 200\ \ \ 200\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ set\ juliandater\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ -timezone\ \$zone\]\"\n\ \ \ set\ mean20\ \[\ cmonth\ \$day\ \]\n\ \ \ set\ mean25\ \[\ chseason\ \$day\ \]\n\ \ \$w\ create\ text\ 200\ \ \ 225\ -text\ \"chinese\ season\ is\ \ \ \ *\ \$mean25\ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 245\ -text\ \"chinese\ fortnight\ \ is\ \ \ \ *\ \$mean20\ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"\$juliandater\ \ \"\ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\ -timezone\ \$zone\]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ weathermean\ .cv\ \$zone\n\n\ \ \}\n\n\ \ \ \ \ proc\ weathermean\ \{w\ zone\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":Asia/Shanghai\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 39\ 59\ 81\ 102\ 115\ 152\ 128\ 133\ 156\ 61\ 51\ 35\ 35\ 35\ 35\ 35\}\n\n\ set\ rainydays\ \{\ 9\ 10\ 13\ 13\ 14\ 12\ 10\ 12\ 9\ 8\ 7\ 7\ 7\ 7\ 7\ \ \}\n\n\ \ \ set\ meanmin\ \{\ .5\ 1.5\ 5.1\ 10.6\ 15.7\ 20.3\ 24.8\ 24.7\ 20.5\ 14.7\ 8.6\ 2.4\ 2.4\ 2.4\ 2.4\ 2.4\ \ \ \}\n\ \ set\ meanmax\ \{\ 7.7\ 8.6\ 12.7\ 18.6\ 23.5\ 27.2\ 31.6\ 31.5\ 27.2\ 22.3\ 16.7\ 10.6\ 10.6\ 10.6\ \ \}\n\ \ \}\n\n\ if\ \{\ \$zone\ ==\ \":Asia/Hong_Kong\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 24.9\ 52.3\ 71.4\ 188.5\ 329.5\ 388.1\ 374.4\ 444.6\ 287.5\ 151.9\ 35.1\ 34.5\ 34.5\ 34.5\}\n\n\ set\ rainydays\ \{\ 5.6\ 9.5\ 10.5\ 11.7\ 15.5\ \ \ 18.8\ 17.8\ 17.4\ 14.8\ 8.1\ 5.7\ 4.3\ 4.3\ 4.3\ 4.3\}\n\n\ \ \ set\ meanmin\ \{\ 14.1\ 14.4\ 16.9\ 20.6\ 23.9\ 26.1\ 26.7\ 26.4\ 25.6\ 23.4\ 19.4\ 15.7\ 15.7\ 15.7\}\n\ \ set\ meanmax\ \{\ 18.6\ 18.6\ 21.5\ 25.1\ 28.4\ 30.4\ 31.3\ 31.1\ 30.2\ 27.7\ 24.0\ 20.3\ 20.3\ 20.3\ \ \}\n\ \}\n\n\ \ if\ \{\ \$zone\ ==\ \":Asia/Taipei\"\ \}\ \{\n\ \ #beijing\n\ \ \ \ \ \ \ \ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\n\n\ \ \ \ \ \ \ \ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{\ \ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ -.4\ -6.9\ -6.9\ -6.9\}\n\ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\ v3.3\ \ \ \}\n\ \ \}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":America/Chicago\"\ \}\ \{\n\ \ \ \ \ set\ meanrainmm\ \{\ \ \ 38.9\ 34.5\ 68.3\ 92.5\ 84.3\ 96.0\ 93.0\ 107.2\ 97.0\ 61.2\ 74.2\ 62.7\ 62.7\ \}\n\n\ \ \ \ \ set\ rainydays\ \{\ 7.3\ 6.2\ 9.0\ 9.5\ 8.9\ 8.0\ 8.0\ 7.5\ 7.7\ 6.6\ 7.9\ 7.8\ 7.8\ 7.8\ \}\n\n\ \ \ set\ meanmin\ \{\ -10.6\ -8.2\ -1.9\ 3.7\ 8.7\ 14.2\ 17.0\ 16.4\ 12.2\ 5.7\ -0.2\ -7.2\ -7.2\ -7.2\ \ \}\n\ \ \ \ \ set\ meanmax\ \{-1.7\ 0.8\ 7.7\ 14.8\ 21.2\ 26.4\ 28.7\ 27.7\ 23.8\ 17.4\ 9.1\ 1.1\ 1.1\ 1.1\ \ \}\n\ \ \ \}\n\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[format\ \"%6.2f\"\ \[\ meanmonth\ \$day\ \$rainydays\]\]\ \ \"\n\n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\[format\ \"%6.2f\"\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\]\"\n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[format\ \"%6.2f\"\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ -timezone\ \$zone\]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \]\ \"\}\n\n\ \ \ \ set\ kick\ \[\ tempform\ \[\ meanmonth\ \$day\ \$meanmin\]\ \ \[\ meanmonth\ \$day\ \$meanmax\]\ \ \ \$hour\]\n\ \ \ \ \ set\ kick\ \[\ expr\ \{\ abs(\$kick)\ \}\ \]\n\ \ \ \ set\ mean8\ \"\ cosine'\ formula\ \ \ \[format\ \"%6.2f\"\ \$kick\]\ C.\ \"\n\ \ \ \ \ \ \n\ \ \ \ \ set\ mean9\ \"\ chinese\ fortnight\ \[cmonth\ \$day\ \]\"\n\ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 265\ -text\ \$mean8\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \ #console\ show\n\ \ \ #puts\ \[\ tempform\ \[\ meanmonth\ \$day\ \$meanmin\]\ \ \[\ meanmonth\ \$day\ \$meanmax\]\ \ \ \$hour\ \ \ \ \ \]\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\n\ \ \ \ \ \ if\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\n\ \ \ \ \ if\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\n\ \ \ \ if\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\n\ \ \ \ \ \ \ if\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ \ \ \ set\ guess\ \"?\"\n\ \ return\ \$guess\n\ \ \ \}\n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ clrcanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\ \ \ \ \}\n\n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"clear\"\ -command\ \{\ clrcanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"chicago\"\ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :America/Chicago\ \ \ \ \ \}\n\ \ button\ \ .b2\ -text\ \"hongkong\"\ \ -command\ \{\ clrcanvas\ .cv\;pick\ .cv\ :Asia/Hong_Kong\ \ \}\n\ \ button\ \ .b3\ -text\ \"shanghai\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :Asia/Shanghai\}\n\ \ button\ \ .b4\ -text\ \"beijing\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ \ \ .cv\ :Asia/Taipei\ \}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b6\ -text\ \"cos\"\ \ \ -command\ \{\ sinwave\ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ \ \ \ \ button\ \ .b8\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ .b7\ .b8\ -in\ .f2\ \ -side\ left\ -padx\ 2\n\ \ \ \ \ board\ \ \ .cv\n\ #catch\ \{console\ show\}\n======\n\n***FIRST\ VERSION***\ \n\n\n****SECOND\ VERSION\ WITH\ ADDED\ HACKS\ ***\ \n\n\n======\ \n\n\ \ \ \ \ #start\ of\ deck#!/bin/sh\n\ \ \ \ #based\ on\ \n\ \ \ \ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ \ \ \ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\ \n\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\ \n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\ \n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\ \ \ \ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\ \n\ \ \ \ \ package\ require\ Tk\n\ \ \ \ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ \ \ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \n\ \ \ return\ \$answer\n\ \ \}\n\ \ proc\ meanrelmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \ set\ x1\ 6\n\ \ \ set\ x2\ 8\n\ \ \ set\ x3\ 10\n\ \ \ set\ y1\ 5\n\ \ \ set\ y3\ 8\n\ \ \ set\ answer5\ \[expr\ \{\ ((x2-x1)*(y3-y1))/(x3-x1))\ +\ y1\ \}\ \]\n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \ \ set\ answer2\ \[lindex\ \$monthdata\ \$month\]\n\ \ \ set\ answer3\ \[lindex\ \$monthdata\ \[\ expr\ \{\ \$month\ +\ 1\}\ \]\]\n\ \ \ set\ average\ \[\ expr\ \{(\$answer\ +\$answer3)/2\}\]\n\ \ \ set\ portion\ \[\ expr\ \{(\$answer\ +\$answer3)/2\}\]\n\ \ \ return\ \$answer\n\ \ \}\n\n\ \ \ \ \ \ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ \ \ \ \ \ \ \ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\n\nproc\ ClrCanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\ \n\ \ \}\n\n\ \ proc\ DrawAxis\ \{w\}\ \{\n\ \ \ \ set\ midX\ \[expr\ \{\ \$::maxX\ /\ 2\ \}\]\n\ \ \ \ set\ midY\ \[expr\ \{\ \$::maxY\ /\ 2\ \}\]\n\ \ \ \ \$w\ create\ line\ 0\ \ \ \ \ \$midY\ \ \$::maxX\ \ \ \$midY\ \ -tags\ \"axis\"\n\ \ \ \ \$w\ create\ line\ \$midX\ 0\ \ \ \ \ \ \ \ \$midX\ \$::maxY\ \ -tags\ \"axis\"\n\ \ \}\n\n\ \ proc\ PaintText\ \{w\ Txt\}\ \{\n\ \ \ \ global\ y\n\ \ \ \ incr\ y\ 10\n\ \ \ \ \$w\ create\ text\ 20\ \$y\ -text\ \$Txt\ -tags\ \"text\"\n\ \ \}\n\n\ \ proc\ pick\ \{w\ \ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\ \ \ \ \n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\ \$w\ create\ text\ 100\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\ \n\ \ \ \ \n\ \ \ \ \$w\ create\ text\ 200\ \ \ 230\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\n\ \$w\ create\ text\ \ 300\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\ \n\ set\ systemTime\ \[clock\ seconds\]\n\n#\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n#\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n#\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\n\ \$w\ create\ text\ 200\ \ \ 250\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\"\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\]\ \ -tags\ \"text\"\ \ -font\ \$font5\nweathermean\ .cv\n\ \ \ \ \ \ \ \ \ \n\ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ proc\ weathermean\ \{w\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\ \ \n\n\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[\ meanmonth\ \$day\ \$rainydays\]\ \ \"\ \n\ \ \ \ \ \n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\"\n\ \ \n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ \]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\ \n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\}\n\n\ \ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\ \ \ \nif\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\nif\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\nif\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\nif\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\nif\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\nif\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\nif\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\nif\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ set\ guess\ \"?\"\n\ \ return\ \$guess\n\}\n\n\ \ proc\ DrawBox\ \{w\}\ \{\n\ \ \ \ global\ x1\ y1\ x2\ y2\n\ \ \ \ \$w\ create\ rect\ \ 50\ \ 10\ \ 100\ \ 60\ \ -tags\ \"box\"\n\ \ \ \ \$w\ create\ rect\ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -tags\ \"box\"\n\ \ \ \ incr\ x1\ 15\n\ \ \ \ incr\ x2\ 15\n\ \ \ \ incr\ y1\ 10\n\ \ \ \ incr\ y2\ 10\n\ \ \}\n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ ClrCanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\ \ \ \ \}\n\ \ \ \ \ \ \ \n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\ \n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"Clear\"\ -command\ \{\ ClrCanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"Text\"\ \ -command\ \{\ PaintText\ .cv\ \"Canvas\"\ \}\n\ \ button\ \ .b2\ -text\ \"Axis\"\ \ -command\ \{\ DrawAxis\ \ .cv\ \}\n\ \ button\ \ .b3\ -text\ \"Box\"\ \ \ -command\ \{\ DrawBox\ \ \ .cv\ \}\n\ \ button\ \ .b4\ -text\ \"pick\"\ \ \ -command\ \{ClrCanvas\ .cv\;pick\ \ \ .cv\ \}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ button\ \ .b6\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ -in\ .f2\ \ -side\ left\ -padx\ 2\nboard\ \ \ .cv\n\ #catch\ \{console\ show\}\n\ \ \ \ \ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\ #!/bin/sh\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ \n\ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\ \ \ \ \ \ \n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n======\n\n****Version\ with\ added\ hacks\ ****\n\n======\n\n\ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\n\ \ \ \ \ \ \ \ #start\ of\ deck\ \n\ \ \ \ \ \ \ \n\ #!/bin/sh\n\ #\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\ #based\ on\ \n\ #\ demo2-canvas.tcl\ -\ HaJo\ Gurt\ -\ 2005-12-13\ -\ http://wiki.tcl.tk/15073\n\ #:by\ gold,\ \ \ chinese\ \ iChing\ random\ weather\ \n\n\n\ #\ written\ on\ Windowws\ XP\ on\ eTCL\ \n\ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\ \n\ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 17Jul2010\n\n\n\n\n\n\n\n\n\ set\ xpieces\ \{\ \ \\u2630\ \\u2631\ \\u2632\ \\u2633\ \\u2634\ \\u2635\ \\u2636\ \\u2637\}\ \n\ \ package\ require\ Tk\n\ proc\ lpick\ L\ \{lindex\ \$L\ \[expr\ int(rand()*\[llength\ \$L\])\]\;\}\n\ \ proc\ average\ L\ \{expr\ (\[join\ \$L\ +\])/\[llength\ \$L\].\}\n\n\n\n\n\n\ \n\ \ proc\ meanmonth\ \{julianday\ monthdata\}\ \{\n\ \ \ \ \ \n\ \ \ set\ goofy\ \[\ expr\ \{\$julianday\ /\ 30.\}\]\n\ \ \ set\ month\ \[\ expr\ \{int(\ \$goofy)\}\]\n\ \ \n\ \ \ set\ answer\ \[lindex\ \$monthdata\ \$month\]\n\ \n\n\ \ \ return\ \$answer\n\ \ \}\n\ \n\n\ proc\ interlinear\ \{\ xx1\ xx2\ xx3\ yy1\ yy3\ \}\ \{\n\ return\ \[expr\ \{\ \ (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+\ \$yy1\ \}\ \]\ \;\}\n\ proc\ listnumbers\ \{\ aa\ bb\}\ \{\ for\ \{set\ i\ \[\ expr\ \{int(\$aa)\}\]\}\ \{\$i<=\$bb\}\ \{incr\ i\}\ \{lappend\ dd\ \[\ expr\ .1*\ \$i\]\ \}\;return\ \$dd\}\n\ \ \ \ \n\ proc\ sinwave\ \{\ w\ \}\ \{\n\ \ \ console\ show\n\ \ \n\ \ \ set\ goo\ \[listnumbers\ 1\ 70\ \]\n\ \ foreach\ item\ \ \ \$goo\ \ \{\n\ \ \ \ puts\ \[\ expr\ \{\ cos\ (\$item)\ \}\ \]\n\ \ \ \ \ \}\n\ \ \ \ \n\ \ \n\ \}\n\n\n\nproc\ clrcanvas\ \{w\}\ \{\n\ \ \ \ \$w\ delete\ \ \"all\"\ \n\ \ \}\n\n\ \n\n\n\ \ proc\ pick\ \{w\ zone\ \}\ \{\n\ \ \ \ global\ y\ xpieces\n\ \ \ \ incr\ y\ 10\n\ \ \ \ set\ txt\ canvas\n\ \ \ \n\ \n\ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ set\ color4\ blue\n\ \ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\ \$w\ create\ text\ 100\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_357034101\ \n\ \ \ \ \n\ \ \ \ \$w\ create\ text\ 200\ \ \ 230\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \ \ \ \ set\ texter\ \[\ lpick\ \$xpieces\]\n\n\ \ \ set\ state3\ \[lpick\ \{\ 0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ \ \}\ \]\n\ \ \ \ \ set\ texter\ \[\ lindex\ \ \$xpieces\ \$state3\]\ \n\n\ \$w\ create\ text\ \ 300\ \ \ 150\ -text\ \$texter\ -font\ \$font2\ -width\ \$boo\ -fill\ \$color4\ -tag\ obj_672148664\ \n\ set\ systemTime\ \[clock\ seconds\]\n\n#\ \"The\ time\ is:\ \[clock\ format\ \$systemTime\ -format\ %H:%M:%S\]\"\n#\ \"The\ date\ is:\ \[clock\ format\ \$systemTime\ -format\ %j\]\"\n#\ \[clock\ format\ \$systemTime\ -format\ \{Today\ is:\ %A,\ the\ %d\ of\ %B,\ %Y\}\]\n\n\ \$w\ create\ text\ 200\ \ \ 250\ -text\ \[seer\ \$state3\ \]\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \$w\ create\ text\ 200\ \ \ 425\ -text\ \"julian\ date\ is\ \[clock\ format\ \$systemTime\ -format\ %j\ -timezone\ \$zone\]\"\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \$w\ create\ text\ 200\ \ \ 440\ -text\ \[\ \ clock\ format\ \[clock\ scan\ now\]\ -timezone\ \$zone\]\ \ -tags\ \"text\"\ \ -font\ \$font5\nweathermean\ .cv\ \$zone\n\ \ \ \ \ \ \ \ \ \n\ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ proc\ weathermean\ \{w\ zone\}\ \{\n\ \ \ \ set\ boo\ 50\n\ \ set\ font2\ \ \"Helvetica\ 120\"\n\ \ set\ font5\ \ \"Helvetica\ 10\"\n\ \ \ \ \ set\ meanmax\ \{\ 1.6\ 4.0\ 11.3\ 19.9\ 26.4\ 30.3\ 30.8\ 29.5\ 25.8\ 19.0\ 10.1\ 3.3\ 3.3\}\ \ \n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":Asia/Shanghai\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ if\ \{\ \$zone\ ==\ \":Asia/Hong_Kong\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ \ if\ \{\ \$zone\ ==\ \":Asia/Taipei\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\ \ \ \ if\ \{\ \$zone\ ==\ \":America/Chicago\"\ \}\ \{\n\ set\ meanrainmm\ \{\ 3\ 6\ \ 9\ 26\ 29\ 71\ \ 176\ 182\ \ 49\ \ 19\ 6\ 2\ 2\ 2\ 2\}\ \ \n\n\ set\ rainydays\ \{\ 2\ 3\ 4\ 5\ 6\ 9\ 14\ 12\ 7\ 5\ 3\ \ 2\ 2\ 2\ 2\}\n\n\ \ \ set\ meanmin\ \{-9.4\ -9.4\ -6.9\ -0.6\ 7.2\ 13.2\ 18.2\ 21.6\ \ 20.4\ \ 14.2\ \ 7.3\ 7.3\ 7.3\}\ \ \n\ \ \}\n\n\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\n\ \ \ \ set\ day\ \[clock\ format\ \$systemTime\ -format\ %j\ \]\n\ \ \ \ set\ mean1\ \"\ mean\ min\ temp\ \[\ meanmonth\ \$day\ \$meanmin\]\ \"\n\ \ \ \ set\ mean2\ \"mean\ max\ temp\ \[\ meanmonth\ \$day\ \$meanmax\]\"\n\ \ \ \ \ set\ mean3\ \"\ mean\ perc.\ \ in\ mm\ per\ m\ \[\ meanmonth\ \$day\ \ \$meanrainmm\]\ \"\n\ \ \ \ set\ mean4\ \"\ Rainy\ days\ per\ m\ \[format\ \"%6.2f\"\ \[\ meanmonth\ \$day\ \$rainydays\]\]\ \ \"\ \n\ \ \ \ \ \n\ \ \ \ set\ mean5\ \"\ chance\ of\ rainy\ day\ in\ month\[format\ \"%6.2f\"\ \[expr\ \{\[\ meanmonth\ \$day\ \$rainydays\]/30.\}\]\]\"\n\ \ \n\n\ \ \ \ set\ mean6\ \"\ mean\ perc.\ in\ mm\ per\ day\ \[format\ \"%6.2f\"\ \[\ expr\ \{\[\ meanmonth\ \$day\ \ \$meanrainmm\]/30.\}\]\]\ \"\n\ \ \ \ \ set\ systemTime\ \[clock\ seconds\]\n\ \ \ \ set\ hour\ \[clock\ format\ \$systemTime\ -format\ %k\ -timezone\ \$zone\]\n\ \ \ \ #set\ hour\ 13.\n\ \ \ \ set\ mean7\ \[\ meanmonth\ \$day\ \$meanmin\]\ \n\ \ \ \ set\ mean8\ \[\ meanmonth\ \$day\ \$meanmax\]\n\ \ \ \ \ \ if\ \{\ \$hour\ <\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ .00001\ 10.\ 12.\ \$mean7\ \$mean8\ \]\]\ \"\}\n\ \ \ \ \ \ if\ \{\ \$hour\ >=\ 12.\ \}\ \{\ set\ mean7\ \"\ mean\ interpolated\ temp.(\$hour\ H)\ C\ deg.\ \[format\ \"%6.2f\"\ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \]\ \"\}\n\n\ \ \ \ \ #set\ mean7\ \"\ mean\ interpolated\ temp.\ C\ deg.\ \ \[interlinear\ 12.\ \$hour\ 24.\ \$mean7\ \$mean8\ \]\ \"\n\ \ \ \ \ \$w\ create\ text\ 200\ \ \ 300\ -text\ \$mean1\ \ -tags\ \"text\"\ \ -font\ \$font5\n\n\ \ \$w\ create\ text\ 200\ \ \ 320\ -text\ \$mean2\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 340\ -text\ \$mean3\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 360\ -text\ \$mean6\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 380\ -text\ \$mean4\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 400\ -text\ \$mean5\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \$w\ create\ text\ 200\ \ \ 280\ -text\ \$mean7\ \ -tags\ \"text\"\ \ -font\ \$font5\n\ \ \ \}\n\ \ \ \ \ \ proc\ seer\ \{state3\}\ \{\n\ \ \ global\ xpieces\n\ \ \ #set\ state3\ \[lpick\ \{\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ \}\ \]\n\ \ \ \nif\ \{\ \$state3\ ==\ 0\ \}\ \{return\ \"\ 1\ \ \ Force\ \ \ heaven\ \ \ northwest\ \ \ *\ colder\ and\ change,ice,snow\"\}\nif\ \{\ \$state3\ ==\ 1\ \}\ \{return\ \"\ 2\ \ \ Open\ \ \ swamp\ \ \ west\ \ \ \ \ \ \ \ \ \ *\ damp\ and\ dewy,rain\ \ \ \ \"\}\nif\ \{\ \$state3\ ==\ 2\ \}\ \{return\ \"\ 3\ \ \ Radiance\ \ \ fire\ \ \ south\ \ \ \ \ \ *\ hot\ and\ sunny,less\ clouds\"\}\nif\ \{\ \$state3\ ==\ 3\ \}\ \{return\ \"\ 4\ \ \ Shake\ \ \ thunder\ \ \ east\ \ \ \ \ \ \ *\ stormy\"\}\nif\ \{\ \$state3\ ==\ 4\ \}\ \{return\ \"\ 5\ \ \ Ground\ \ \ wind\ \ \ southeast\ \ \ \ *\ windy\ and\ change\"\}\nif\ \{\ \$state3\ ==\ 5\ \}\ \{return\ \"\ 6\ \ \ Gorge\ \ \ water\ \ \ north\ \ \ \ \ \ \ \ *\ colder\ and\ rain,rain,snow,fog\ \"\}\nif\ \{\ \$state3\ ==\ 6\ \}\ \{return\ \"\ 7\ \ \ Bound\ \ \ mountain\ \ northeast\ \ *\ change\ for\ better,\ clouds\"\}\nif\ \{\ \$state3\ ==\ 7\ \}\ \{return\ \"\ 8\ \ \ Field\ \ \ earth\ \ \ southwest\ \ \ \ *\ \ cloudy,foggy\"\}\n\ set\ guess\ \"?\"\n\ \ return\ \$guess\n\}\n\n\ \n\n\ \ proc\ leave\ \{w\}\ \{\n\ \ \ \ \ exit\n\ \ \}\n\n\ \ \n\ \ \ proc\ board\ \{w\}\ \{\n\ \ \ \ #set\ state3\ 1\n\ \ \ \ set\ state2\ 1\n\ \ \ \ clrcanvas\ \$w\n\ \ \ \ .\ configure\ -background\ orange\ -highlightcolor\ brown\ -relief\ raised\ -border\ 30\n\ \ \ \ \$w\ configure\ -bg\ tan\n\n\n\ \ \ \ \ \n\ \ \ \ \n\ \ \ \ \}\n\ \ \ \ \ \ \ \n\n\n\ \ #:\ Main\ :\n\ \ frame\ .f1\n\ \ frame\ .f2\n\ \ pack\ \ .f1\ .f2\n\n\ \ set\ maxX\ 400\n\ \ set\ maxY\ 450\n\ \ set\ y\ \ \ \ \ \ 0\n\n\ \ set\ x1\ 120\n\ \ set\ x2\ 150\n\ \ set\ y1\ \ 50\n\ \ set\ y2\ \ 80\n\n\ \ canvas\ \ .cv\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ tan\ \n\ \ pack\ \ \ \ .cv\ -in\ .f1\n\n\ \ button\ \ .b0\ -text\ \"clear\"\ -command\ \{\ clrcanvas\ .cv\ \}\n\ \ button\ \ .b1\ -text\ \"chicago\"\ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :America/Chicago\ \ \ \ \ \}\n\ \ button\ \ .b2\ -text\ \"hongkong\"\ \ -command\ \{\ clrcanvas\ .cv\;pick\ .cv\ :Asia/Hong_Kong\ \ \}\n\ \ button\ \ .b3\ -text\ \"shanghai\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ .cv\ :Asia/Shanghai\}\n\ \ button\ \ .b4\ -text\ \"peking\"\ \ \ -command\ \{clrcanvas\ .cv\;pick\ \ \ .cv\ :Asia/Taipei\}\n\ \ button\ \ .b5\ -text\ \"board\"\ \ \ -command\ \{\ board\ \ \ .cv\ \}\n\ button\ \ .b6\ -text\ \"cos\"\ \ \ -command\ \{\ sinwave\ \ .cv\ \}\n\ button\ \ .b7\ -text\ \"exit\"\ \ \ -command\ \{leave\ \ \ .cv\ \}\n\ \ pack\ .b0\ .b1\ .b2\ .b3\ .b4\ .b5\ \ .b6\ .b7\ -in\ .f2\ \ -side\ left\ -padx\ 2\nboard\ \ \ .cv\n\ #catch\ \{console\ show\}\n\n\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck*\ \n\ \ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\ \ \ \ \ \ #end\ of\ deck\n\n\ \ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \ \ #end\ of\ deck\n\ \ \ #end\ of\ \ deck\n\ \ \ #end\ of\ deck\n\ \ \ #end\ of\ deck\n\ \ \ \ #end\ of\ deck\n\ \n======\n\ \ \ \ \n<<categories>>\ Toys\ |\ Example\ |\ Games\ |\ Characters} CALL {my revision {Chinese Iching Random Weather Predictions}} CALL {::oo::Obj11252 process revision/Chinese+Iching+Random+Weather+Predictions} CALL {::oo::Obj11250 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4