by Patrick Harvey (ICHING.BAS)

by Patrick Harvey, 101

Description

by Patrick Harvey, 101

From the Antic disk of August 1989 (Vol. 8 No. 4).

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

Atari BASIC program · 12.3 KB

Dialect
Atari BASIC
Lines
280
Variables
MOVE(, I, J, COIN, LINE(, SECOND, HEX, TRI1, TRI2, A, D, K, MOV, Y, Y1, ST, SP, TXT$, T$, CNT, QUIT, NTOP, NSET, XT, YT, PEEP(, SI, SJ, SK, V, GJ, GI, T0, T1, GL
BASIC listing (280 lines)
10 REM I CHING
20 REM BY PATRICK HARVEY
30 REM (C)1989, ANTIC PUBLISHING INC.
90 REM ***TITLE SCREEN AND
91 REM PARTIAL INITIALIZATION***
100 GRAPHICS 18:SETCOLOR 4,3,0
120 NTOP=PEEK(106)-8
130 POKE 106,NTOP
140 NSET=NTOP*256
150 MOV=ADR("hh┐Lh┐Kh┐Nh┐Mh┐Pp┌ ♥1K┌MHPyfLfNFPPqhp╲(◢1K┌M┴Px◆")
160 I=USR(MOV,57344,NSET,1024)
170 I=USR(MOV,ADR("♥|ff◀ff>0◀C3c[3f◢┴1cf┴fC◀I[[[R@♥♥▶╱l[6[m"),NSET+8*16,40)
180 I=USR(MOV,ADR("▶♥?00?♥▶▶♥◀╱╱FFG"),NSET+8*21,16)
190 POKE 756,NTOP
193 ? #6;"56565656565656565656"
197 ? #6;"       I CHING"
200 ? #6:? #6;"       0   24"
210 ? #6;"       1   3I"
220 ? #6:? #6;"      THE BOOK"
230 ? #6;"     OF CHANGES"
235 ? #6:? #6:? #6;"56565656565656565656";
240 OPEN #1,4,0,"K:"
250 DIM LINE(5)
260 POKE 82,0
270 I=USR(MOV,ADR("♥┘▖→??▶▶♥@px\Lff▶▶??→▖┘♥ffL\xp@♥gssssssg"),NSET+8*64,40)
280 GL=40
400 FOR I=1 TO 200:NEXT I
410 GOSUB 5500
420 FOR I=1 TO 250:NEXT I
490 REM ***INSTRUCTION SCREEN AND
491 REM REST OF INITIALIZATION***
500 GRAPHICS 0:SETCOLOR 1,3,6:SETCOLOR 2,3,0:SETCOLOR 4,3,0
503 POKE 756,NTOP:POKE 752,1
505 ? "5656565656565656565656565656565656565656"
507 ? "     0 24        I CHING       0 24"
508 ? "     1 3I                      1 3I":?
510 ? "          YOU HAVE A QUESTION.":?
520 ? "  Frame a detailed question about the"
530 ? "  future.  Hold it in your mind and"
540 ? "  open yourself to the universal"
550 ? "  influences of nature and to your own"
560 ? "  intuition.":?
590 ? "  Traditionally you should be facing"
600 ? "  north with the I Ching (the Atari)"
610 ? "  facing south, burning incense and"
620 ? "  bowing three times to the ground.":?
630 ? "  Instead, bow to the space bar and"
635 ? "  throw the coins....":?
640 ? :? "5656565656565656565656565656565656565656";
650 HEX=0:SECOND=0:TRI1=0:TRI2=0:Y=0
660 GL=20
700 FOR I=1 TO 3
710 GET #1,D
720 IF D<>ASC(" ") THEN GOTO 710
725 GOSUB 5500
730 NEXT I
740 SETCOLOR 1,3,10
1480 REM ***DETERMINE 1ST HEXAGRAM***
1490 ? "↰";
1500 FOR I=0 TO 5
1503 LINE(I)=0
1507 GOSUB 5000
1510 FOR J=0 TO 2
1520 COIN=INT(2*RND(0))
1530 POSITION J*6+10+INT(4*RND(0)),14+INT(7*RND(0))
1540 IF COIN=0 THEN ? "♥ ├↓←←← ●┤↓←←←▕ ┘":GOTO 1560
1550 ? "♥4├↓←←←0●0↓←←←▕3┘"
1560 GOSUB 5110
1600 LINE(I)=LINE(I)+COIN
1610 NEXT J
1620 IF LINE(I)=0 OR LINE(I)=3 THEN SECOND=1
1650 GOSUB 4000
1730 FOR J=1 TO 250:NEXT J
1735 POSITION 0,14:? "↑↑↑↑↑↑↑↑↑"
1737 FOR J=1 TO 50:NEXT J
1740 NEXT I
1750 TRI2=INT(HEX/8)
1760 SETCOLOR 1,3,6
1800 GOSUB 3000
2000 IF SECOND=0 THEN GOTO 2500
2005 REM ***CALCULATE 2ND HEXAGRAM***
2010 HEX=0:TRI1=0:TRI2=0:Y=12
2020 FOR I=0 TO 5
2030 IF LINE(I)=0 THEN LINE(I)=2
2040 IF LINE(I)=3 THEN LINE(I)=1
2100 GOSUB 4000
2120 NEXT I
2130 TRI2=INT(HEX/8)
2140 GOSUB 3000
2490 REM ***REPEAT OR END***
2500 GL=30:GOSUB 5500
2505 POSITION 0,23:? "Do you have another question? ";
2510 GET #1,D
2520 IF D=ASC("Y") THEN GOTO 500
2530 GRAPHICS 0
2600 END
2990 REM ***SUBR. PRINT FORTUNE***
3000 POSITION 0,Y:GOSUB HEX*10+9000
3100 POSITION 7,Y+2:GOSUB TRI2*10+7000
3150 POSITION 7,Y+3:GOSUB TRI2*10+8000
3200 POSITION 7,Y+5:GOSUB TRI1*10+7000
3250 POSITION 7,Y+6:GOSUB TRI1*10+8000
3300 POSITION 0,Y+8:GOSUB HEX*10+10000
3400 RETURN
3990 REM ***SUBR. PRINT LINES***
4000 IF LINE(I)>1 THEN HEX=HEX+2^I
4010 IF I=2 THEN TRI1=HEX
4020 POSITION 1,Y+6-I
4030 IF LINE(I)>1 THEN ? "▂▂ ▂▂";:RETURN
4040 ? "▂▂▂▂▂";
4050 RETURN
4990 REM ***SUBR. COIN SHAKE SOUND***
5000 FOR SI=1 TO 6
5010 GOSUB 5110
5040 FOR SJ=1 TO 5+INT(10*RND(0)):NEXT SJ
5050 NEXT SI
5060 RETURN
5100 REM ***SUBR. CLINK SOUND***
5110 SOUND 0,4,14,8
5120 FOR SK=1 TO 10:NEXT SK
5130 SOUND 0,0,0,0
5140 RETURN
5490 REM ***SUBR. GONG SOUND***
5500 V=4:T0=230:T1=204
5510 SOUND 0,T0,14,V:SOUND 1,T1,14,V
5520 FOR GJ=1 TO GL:NEXT GJ
5530 FOR GI=1 TO V
5540 FOR GJ=1 TO GI*GL/5:NEXT GJ
5550 V=V-1
5560 SOUND 0,T0,14,V:SOUND 1,T1,14,V
5570 NEXT GI
5580 RETURN
6990 REM ***SUBR. TRIGRAM TITLES***
7000 ? "CH'IEN":RETURN
7010 ? "SUN":RETURN
7020 ? "LI":RETURN
7030 ? "KEN":RETURN
7040 ? "TUI":RETURN
7050 ? "K'AN":RETURN
7060 ? "CHEN":RETURN
7070 ? "K'UN":RETURN
7090 REM ***SUBR. TRIGRAM QUALITIES***
8000 ? "Heaven, male, active, head.":RETURN
8010 ? "Wind, wood, gentle, thigh.":RETURN
8020 ? "Fire, summer, beauty, eye.":RETURN
8030 ? "Mountain, stubborn, hand.":RETURN
8040 ? "Lake, autumn, joy, mouth.":RETURN
8050 ? "Water, winter, danger, ear.":RETURN
8060 ? "Thunder, spring, arouse, foot.":RETURN
8070 ? "Earth, female, passive, belly.":RETURN
8090 REM ***SUBR. HEXAGRAM TITLES***
9000 ? "    CH'IEN   THE CREATIVE PRINCIPLE":RETURN
9010 ? "             KOU   CONTACT":RETURN
9020 ? "           T'UNG JEN   LOVERS":RETURN
9030 ? "           TUN   YIELDING":RETURN
9040 ? "         LU   TREADING, CONDUCT":RETURN
9050 ? "            SUNG   CONFLICT":RETURN
9060 ? "          WU WANG   INTEGRITY":RETURN
9070 ? "            P'I   STAGNATION":RETURN
9080 ? "   HSIAO CH'U   THE LESSER NOURISHER":RETURN
9090 ? "        SUN   WILLING SUBMISSION":RETURN
9100 ? "         CHIA JEN   THE FAMILY":RETURN
9110 ? "        CHIEN   GRADUAL PROGRESS":RETURN
9120 ? "CHUNG FU   INWARD CONFIDENCE & SINCERITY":RETURN
9130 ? "           HUAN   SCATTERING":RETURN
9140 ? "                I   GAIN":RETURN
9150 ? "          KUAN   LOOKING DOWN":RETURN
9160 ? "       TA YU   GREAT POSSESSIONS":RETURN
9170 ? "       TING   SACRIFICIAL VESSEL":RETURN
9180 ? "          LI   FLAMING BEAUTY":RETURN
9190 ? "           LU   THE TRAVELER":RETURN
9200 ? "         K'UEL   THE ESTRANGED":RETURN
9210 ? "      WEI CHI   BEFORE COMPLETION":RETURN
9220 ? "           SHIH HO   GNAWING":RETURN
9230 ? "            CHIN   PROGRESS":RETURN
9240 ? "     TA CH'U   THE GREAT NOURISHER":RETURN
9250 ? "               KU   DECAY":RETURN
9260 ? "             P'I   ELEGANCE":RETURN
9270 ? "            KEN   DESISTING":RETURN
9280 ? "               SUN   LOSS":RETURN
9290 ? "           MENG   IMMATURITY":RETURN
9300 ? "            I   NOURISHMENT":RETURN
9310 ? "            PO   PEELING OFF":RETURN
9320 ? "           KUAL   RESOLUTION":RETURN
9330 ? "            TA KUO   EXCESS":RETURN
9340 ? "            KO   REVOLUTION":RETURN
9350 ? "           HSIEN   ATTRACTION":RETURN
9360 ? "               TUI   JOY":RETURN
9370 ? "            K'UN   ADVERSITY":RETURN
9380 ? "            SUI   FOLLOWING":RETURN
9390 ? "       TS'UI   GATHERING TOGETHER":RETURN
9400 ? "       HSU   CALCULATED INACTION":RETURN
9410 ? "            CHING   A WELL":RETURN
9420 ? "       CHI CHI   AFTER COMPLETION":RETURN
9430 ? "            CHIEN   TROUBLE":RETURN
9440 ? "           CHIEH   RESTRAINT":RETURN
9450 ? "           K'AN   THE ABYSS":RETURN
9460 ? "           CHUN   DIFFICULTY":RETURN
9470 ? "              PI   UNITY":RETURN
9480 ? "   TA CHUANG   THE POWER OF THE GREAT":RETURN
9490 ? "        HENG   THE LONG ENDURING":RETURN
9500 ? "            FENG   ABUNDANCE":RETURN
9510 ? "      HSIAO KUO   THE SMALL GET BY":RETURN
9520 ? "   KUEI MEI   THE MARRIAGEABLE MAIDEN":RETURN
9530 ? "            HSIEH   RELEASE":RETURN
9540 ? "             CHEN   THUNDER":RETURN
9550 ? "              YU   REPOSE":RETURN
9560 ? "              T'AI   PEACE":RETURN
9570 ? "           SHENG   ASCENDING":RETURN
9580 ? "    MING I   DARKENING OF THE LIGHT":RETURN
9590 ? "            CH'IEN   MODESTY":RETURN
9600 ? "             LIN   APPROACH":RETURN
9610 ? "            SHIH   THE ARMY":RETURN
9620 ? "              FU   RETURN":RETURN
9630 ? "      K'UN   THE PASSIVE PRINCIPLE":RETURN
9990 REM ***SUBR. FORTUNES***
10000 ? "Sublime Success!  Persistence in a":? "righteous course brings reward.":RETURN
10010 ? "Women wield the power.  Do not marry:":? "the husband will be henpecked.":RETURN
10020 ? "Lovers in the open succeed!  Do not":? "slacken in righteous persistence.":RETURN
10030 ? "Success!  Persistence in small things":? "wins advantage.":RETURN
10040 ? "Though he treads upon the tiger's tail,":? "it does not bite him.  Success!":RETURN
10050 ? "With care, affairs can start to prosper,";:? "but the final outcome will be disaster.":RETURN
10060 ? "Righteous persistence brings reward.":? "Those opposed meet with injury.":RETURN
10070 ? "The great and the good decline;":? "the mean approach.":RETURN
10080 ? "Success will follow but it is not time":? "to take action yet.":RETURN
10090 ? "Success in small matters.  Advantageous":? "to have a goal and to visit a great man.":RETURN
10100 ? "Women's persistence brings reward.":? "Family order stabilizes the world.":RETURN
10110 ? "Persistence in a righteous course":? "brings reward.":RETURN
10120 ? "Advantageous to cross the great river.":? "Persistence in a course brings reward.":RETURN
10130 ? "The King has approached his temple.":? "Persistence brings reward.":RETURN
10140 ? "It is favorable to have a goal for the":? "route is straight and clear.":RETURN
10150 ? "The ablution has been done but not the":? "sacrafice.  Sincerity inspires respect.":RETURN
10160 ? "Who possesses much has supreme success.":RETURN
10170 ? "Supreme success!  The superior person":? "adheres firmly to heavan's decrees.":RETURN
10180 ? "Good fortune can be gained by giving":? "aid to those in need.":RETURN
10190 ? "Success in small matters.  Determined":? "travelers have good fortune.":RETURN
10200 ? "Heaven and earth lie apart, yet they":? "are one in their activity.":RETURN
10210 ? "While crossing the ice, the fox's tail":? "gets wet.  No goal is favorable now.":RETURN
10220 ? "The time is favorable for legal":? "processes.":RETURN
10230 ? "Great merit is richly rewarded.":RETURN
10240 ? "Good fortune results from eating out.":? "This is a good time for a long journey.":RETURN
10250 ? "What has happened once will surely":? "happen again.":RETURN
10260 ? "Some small advantage can be had by":? "having a particular goal.":RETURN
10270 ? "Walking in the courtyard without":? "noticing the people involves no error.":RETURN
10280 ? "Loss accompanied by confidence:":? "the way leads upwards.":RETURN
10290 ? "To ignore danger is youthful folly.":? "Yet such rashness may bring good luck.":RETURN
10300 ? "Watch people feeding others and observe":? "what they seek to eat themselves.":RETURN
10310 ? "At present, there is no goal which can":? "be sought with advantage.":RETURN
10320 ? "Frankness in revealing the true state":? "of affairs is dangerous.":RETURN
10330 ? "The ridgepole sags under excessive load.":RETURN
10340 ? "Upon the achievement of a necessary":? "revolution, regret vanishes.":RETURN
10350 ? "Righteous persistence brings reward.":? "Taking a wife will result in good luck.":RETURN
10360 ? "Gladness through persistence is the way":? "to accord with heaven and men.":RETURN
10370 ? "Good fortune for the truly moral.":? "What is said will not be believed.":RETURN
10380 ? "Sublime success!  Righteous persistence":? "brings reward--no error!":RETURN
10390 ? "Seeing a great man and persistence":? "will insure success.":RETURN
10400 ? "Calculated inaction and the confidence":? "of others win brilliant success.":RETURN
10410 ? "The well is not dry but the rope is too short or the pitcher broken--misfortune!":RETURN
10420 ? "Good fortune at the start; disorder":? "in the end.":RETURN
10430 ? "Trouble.  The west and south are":? "favorable, but not the east and north.":RETURN
10440 ? "It is wrong to persist in":? "harsh restraint.":RETURN
10450 ? "Grave danger!  Maintain confidence":? "and a sharp hold upon the mind.":RETURN
10460 ? "Persistence brings reward; but":? "do not seek a new goal.  Consolidate.":RETURN
10470 ? "Consulting the oracle again will give":? "an omen of great and lasting value.":RETURN
10480 ? "Strength to succeed despite":? "troubles.  Persistence brings reward.":RETURN
10490 ? "Success and freedom from error!":? "It is time to go for a new goal.":RETURN
10500 ? "Do not be sad; it is fitting to be":? "like the sun at its zenith.":RETURN
10510 ? "When birds fly high, their singing is":? "out of tune.  The humble are favored.":RETURN
10520 ? "Advance brings misfortune.":? "No goal is favorable now.":RETURN
10530 ? "Those with no good reason to advance":? "should retreat.  Do not stay put.":RETURN
10540 ? "Thunder comes with a terrible noise,":? "frightening people for miles around.":RETURN
10550 ? "Calm confidence profits those who build up the country and send forth armies.":RETURN
10560 ? "The mean decline; the great and good":? "approach--good fortune and success!":RETURN
10570 ? "It is essential to see a great man.":? "Progressing south brings good fortune.":RETURN
10580 ? "Righteous persistence in the face":? "of difficulty brings reward.":RETURN
10590 ? "The overfull is reduced and":? "the modest is increased.":RETURN
10600 ? "Sublime success!  But, in the eighth":? "month, misfortune will befall.":RETURN
10610 ? "Persistence in a righteous course bringsgood fortune to those in authority.":RETURN
10620 ? "Friends arrive and return, spending":? "seven days in their coming and going.":RETURN
10630 ? "At first he goes astray, but":? "later he finds his bearings.":RETURN