Main Program Flow
flowchart TD
Start([START
Lines 5-10]) --> InputInst{Instructions?
Line 15-16} InputInst -->|NO| ShowInst[Show Instructions
Lines 20-140
Print text & GET key] InputInst -->|YES| InitGame ShowInst --> InitGame[Initialize Graphics
Lines 150-160
HGR, HCOLOR=6] InitGame --> InitGuns[Generate Gun Positions
Lines 170-190
G1, G2 random] InitGuns -->|G1,G2 too close| InitGuns InitGuns --> InitWind[Initialize Wind
Lines 200-230
W1 speed, W2 direction] InitWind --> DrawGuns[Draw Guns
Lines 240-340
Both cannons] DrawGuns --> CallMountain[GOSUB 1440
Draw Mountain
Line 360] CallMountain --> CallPlayer1[GOSUB 1630
Set Player Position
Line 370] CallPlayer1 --> LoopX8[FOR X8 = 1 TO 20
Game Turns Loop
Line 380] LoopX8 --> SwitchPlayer[Switch Player
Lines 390-400
P1 = P1 * -1] SwitchPlayer --> CallIndic[GOSUB 1290
Draw Indicator
Line 410] CallIndic --> CallWind[GOSUB 1580
Print Wind Info
Line 420] CallWind --> InputShot[Input Angle & Velocity
Lines 430-440
A1 20-100, V1 45-150] InputShot --> ValidateInput{Valid Input?
Lines 441-442} ValidateInput -->|NO| ErrorMsg[Print Error
Line 445] ErrorMsg -->|GOTO 430| InputShot ValidateInput -->|YES| CalcTraj[Calculate Trajectory
Lines 450-510
Convert angle, calc params] CalcTraj --> LoopY8[FOR Y8 = 0 TO T1 STEP T2
Trajectory Loop
Line 520] LoopY8 --> CalcPos[Calculate Position
Lines 530-580
X, Y with wind effect] CalcPos --> CheckLow{Y < 9?
Line 590} CheckLow -->|YES GOTO 750| CheckHit CheckLow -->|NO| CheckPlayer{P1 < 0?
Line 600} CheckPlayer -->|YES Right Gun| PlotRight[Plot Right Shot
Lines 680-730
HCOLOR=3 White] CheckPlayer -->|NO Left Gun| PlotLeft[Plot Left Shot
Lines 610-660
HCOLOR=5 Orange] PlotRight --> CheckHit[GOSUB 1060
Check Mountain Hit
Line 750] PlotLeft --> CheckHit CheckHit --> CheckP2{P2 = 5?
Mountain Hit?
Line 760} CheckP2 -->|YES GOTO 800| DrawExplosion CheckP2 -->|NO| NextY8[NEXT Y8
Line 770] NextY8 --> LoopY8 DrawExplosion[GOSUB 1160
Draw Explosion
Line 790] DrawExplosion --> CheckGun1{Hit G1?
Line 800} CheckGun1 -->|YES| RightWins[Right Gun Wins
Lines 820-830
T3++] CheckGun1 -->|NO| CheckGun2{Hit G2?
Line 850} CheckGun2 -->|YES| LeftWins[Left Gun Wins
Lines 870-880
T4++] RightWins -->|GOTO 930| PlayAgain LeftWins -->|GOTO 930| PlayAgain CheckGun2 -->|NO Miss| NextX8[NEXT X8
Line 920] NextX8 --> LoopX8 PlayAgain{Play Again?
Lines 930-951} PlayAgain -->|YES GOTO 150| InitGame PlayAgain -->|NO| ShowScore[Show Final Score
Lines 990-1020
T3 Right, T4 Left] ShowScore --> End([END
Line 1050]) style Start fill:#fff3e0,stroke:#f57c00,stroke-width:3px style End fill:#ffebee,stroke:#c62828,stroke-width:3px style InputInst fill:#fff9c4,stroke:#f9a825,stroke-width:2px style ValidateInput fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckLow fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckPlayer fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckP2 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckGun1 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckGun2 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style PlayAgain fill:#fff9c4,stroke:#f9a825,stroke-width:2px style LoopX8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style LoopY8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style NextX8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style NextY8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style InputShot fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style RightWins fill:#ffebee,stroke:#c62828,stroke-width:2px style LeftWins fill:#ffebee,stroke:#c62828,stroke-width:2px
Lines 5-10]) --> InputInst{Instructions?
Line 15-16} InputInst -->|NO| ShowInst[Show Instructions
Lines 20-140
Print text & GET key] InputInst -->|YES| InitGame ShowInst --> InitGame[Initialize Graphics
Lines 150-160
HGR, HCOLOR=6] InitGame --> InitGuns[Generate Gun Positions
Lines 170-190
G1, G2 random] InitGuns -->|G1,G2 too close| InitGuns InitGuns --> InitWind[Initialize Wind
Lines 200-230
W1 speed, W2 direction] InitWind --> DrawGuns[Draw Guns
Lines 240-340
Both cannons] DrawGuns --> CallMountain[GOSUB 1440
Draw Mountain
Line 360] CallMountain --> CallPlayer1[GOSUB 1630
Set Player Position
Line 370] CallPlayer1 --> LoopX8[FOR X8 = 1 TO 20
Game Turns Loop
Line 380] LoopX8 --> SwitchPlayer[Switch Player
Lines 390-400
P1 = P1 * -1] SwitchPlayer --> CallIndic[GOSUB 1290
Draw Indicator
Line 410] CallIndic --> CallWind[GOSUB 1580
Print Wind Info
Line 420] CallWind --> InputShot[Input Angle & Velocity
Lines 430-440
A1 20-100, V1 45-150] InputShot --> ValidateInput{Valid Input?
Lines 441-442} ValidateInput -->|NO| ErrorMsg[Print Error
Line 445] ErrorMsg -->|GOTO 430| InputShot ValidateInput -->|YES| CalcTraj[Calculate Trajectory
Lines 450-510
Convert angle, calc params] CalcTraj --> LoopY8[FOR Y8 = 0 TO T1 STEP T2
Trajectory Loop
Line 520] LoopY8 --> CalcPos[Calculate Position
Lines 530-580
X, Y with wind effect] CalcPos --> CheckLow{Y < 9?
Line 590} CheckLow -->|YES GOTO 750| CheckHit CheckLow -->|NO| CheckPlayer{P1 < 0?
Line 600} CheckPlayer -->|YES Right Gun| PlotRight[Plot Right Shot
Lines 680-730
HCOLOR=3 White] CheckPlayer -->|NO Left Gun| PlotLeft[Plot Left Shot
Lines 610-660
HCOLOR=5 Orange] PlotRight --> CheckHit[GOSUB 1060
Check Mountain Hit
Line 750] PlotLeft --> CheckHit CheckHit --> CheckP2{P2 = 5?
Mountain Hit?
Line 760} CheckP2 -->|YES GOTO 800| DrawExplosion CheckP2 -->|NO| NextY8[NEXT Y8
Line 770] NextY8 --> LoopY8 DrawExplosion[GOSUB 1160
Draw Explosion
Line 790] DrawExplosion --> CheckGun1{Hit G1?
Line 800} CheckGun1 -->|YES| RightWins[Right Gun Wins
Lines 820-830
T3++] CheckGun1 -->|NO| CheckGun2{Hit G2?
Line 850} CheckGun2 -->|YES| LeftWins[Left Gun Wins
Lines 870-880
T4++] RightWins -->|GOTO 930| PlayAgain LeftWins -->|GOTO 930| PlayAgain CheckGun2 -->|NO Miss| NextX8[NEXT X8
Line 920] NextX8 --> LoopX8 PlayAgain{Play Again?
Lines 930-951} PlayAgain -->|YES GOTO 150| InitGame PlayAgain -->|NO| ShowScore[Show Final Score
Lines 990-1020
T3 Right, T4 Left] ShowScore --> End([END
Line 1050]) style Start fill:#fff3e0,stroke:#f57c00,stroke-width:3px style End fill:#ffebee,stroke:#c62828,stroke-width:3px style InputInst fill:#fff9c4,stroke:#f9a825,stroke-width:2px style ValidateInput fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckLow fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckPlayer fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckP2 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckGun1 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style CheckGun2 fill:#fff9c4,stroke:#f9a825,stroke-width:2px style PlayAgain fill:#fff9c4,stroke:#f9a825,stroke-width:2px style LoopX8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style LoopY8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style NextX8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style NextY8 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style InputShot fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style RightWins fill:#ffebee,stroke:#c62828,stroke-width:2px style LeftWins fill:#ffebee,stroke:#c62828,stroke-width:2px