' ' ÛßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÛ ' Û DARTS - By Graham Daniell Û ' ÛÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÛ ' '  For instructions, select it from the in game menu  ' '  Press F5 to play - ENJOY!  ' ' DECLARE SUB DRAWBOARD () 'sub program declerations, to view them DECLARE SUB DRAWPLYR () 'select the EDIT menu, and goto SUBS DECLARE SUB DRAWLEFT () DECLARE SUB BLACKDART () DECLARE SUB HITBOARD () DECLARE SUB OUTSOUND () DECLARE SUB DRAWDETAILS () DECLARE SUB INSTRUCTIONS () DECLARE SUB GOODSCORE () start: ANI$ = "ON" 'if animation is on or not CPU = 150 'delay amount, lower to quicken arm movement LEVEL = 12 'this is how good the human is CLOOP = 4 'how many times the computer moves arm OCLOOP = CLOOP PLAYER$ = "PLAYER 1" 'sets the default first thrower as player 1 LET PLAYS = 1 'sets the amount of players GAME = 301 'sets the initial game as 301 G = 90 'these are used in the cursor sub program, N = 113 'these are found below BNDLEFT = 90 'the boundries for the throwers arm action BNDRIGHT = 115 AMNT = 2 'i.e. amount - used in the delay to slow down OAMNT = AMNT 'the throwing action. Change to change speed DIR$ = "RIGHT" 'the initial direction of the thrower's arm DART = 0 DX = 480 'the initial dart coordinates DY = 114 CX = 480 'the initial cursor coordinates CY = 165 DIM CROSS%(500) 'dims the room in the memory for the cursor, DIM DART%(500) 'and dart, 500 bytes too much? GOSUB INTRO 'go to the sub intro CLS 'clear screen HSCORE = GAME 'sets the initial players scores CSCORE = GAME GOSUB initialise 'this is the main loop of the game - the steps DRAWBOARD 'the game takes. I did it like this so that i begin: 'a label used when a player has finished throw IF DART = 0 THEN DRAWBOARD 'draw the board when a player has finished DRAWLEFT 'draw remaining floor/wall details on left LET DART = DART + 1 'change the current dart being thrown DRAWPLYR 'is easy to see what happens when DRAWDETAILS 'draw all the information boxes etc IF PLAYER$ = "PLAYER 2" AND PLAYS = 1 THEN GOSUB computer: GOTO pass IF PLAYER$ = "PLAYER 2" AND PLAYS = 2 THEN GOTO human IF PLAYER$ = "PLAYER 1" THEN GOTO human 'detects which player to throw (above) human: 'label to go to if player is human LOCATE 2, 50 'print who's turn it is in top right box PRINT ""; PLAYER$; "'S TURN " SLEEP 1 GOSUB cursor 'go to the cursor sub GOSUB throw 'go to the throwing sub GOSUB findart 'work out where dart is pass: GOSUB DETECT 'goto the sub program that detects the dart IF ANI$ = "Off" THEN GOSUB ANIMATION 'goto the sub program that shows dart 'animation. Delete it to cut out animation. LET TOTAL = TOTAL + SCORE 'add the thrown score to round total IF PLAYER$ = "PLAYER 1" THEN LET HSCORE = HSCORE - SCORE IF PLAYER$ = "PLAYER 2" THEN LET CSCORE = CSCORE - SCORE 'deducts the thrown score off the total players score IF PLAYER$ = "PLAYER 1" AND TYPE$ = "DOUBLE" AND HSCORE = 0 THEN GOSUB p1win: GOTO start IF PLAYER$ = "PLAYER 2" AND TYPE$ = "DOUBLE" AND CSCORE = 0 THEN GOSUB p2win: GOTO start 'checks to see if current player has finished IF PLAYER$ = "PLAYER 1" AND HSCORE <= 2 THEN LET PLAYER$ = "PLAYER 2": GOSUB bust: LET HSCORE = OHSCORE: GOTO begin IF PLAYER$ = "PLAYER 2" AND CSCORE <= 2 THEN LET PLAYER$ = "PLAYER 1": GOSUB bust: LET CSCORE = OCSCORE: GOTO begin 'checks to see if current player is bust HITBOARD 'goes to the procedure that has the hit sound LOCATE 22, 56 'make top right box blank PRINT " " LOCATE 22, 56 'print thrown score in lower right box PRINT ""; SCORE$; LOCATE 4, 19 'print total in top left box PRINT ""; TOTAL; IF TOTAL = 140 OR TOTAL = 180 OR TOTAL = 150 THEN GOODSCORE 'checks if the players total is "good" or not LOCATE 22, 11 'shows humans game total in appropriate box PRINT ""; HSCORE; LOCATE 22, 26 'shows cpu game total in appropriate box PRINT ""; CSCORE; LET MX = DX - 10 'works out dart picture coordinates IF SCORE$ = "BOUNCE OUT" THEN GOSUB BOUNCEOUT IF SCORE$ = "BOUNCE OUT" THEN GOTO skip 'deals with a bounce out case BLACKDART IF DY <= 5 THEN LET DY = 5 'screen limits IF SCORE$ = "HIT DART" THEN SOUND 700, 1 PUT (MX, DY), DART% 'shows the final darts position skip: SLEEP 1 IF DART = 3 AND PLAYER$ = "PLAYER 1" THEN LET DART = 0: PLAYER$ = "PLAYER 2": TOTAL = 0: SCORE = 0: OHSCORE = HSCORE: GOTO begin IF DART = 3 AND PLAYER$ = "PLAYER 2" THEN LET DART = 0: PLAYER$ = "PLAYER 1": TOTAL = 0: SCORE = 0: OCSCORE = CSCORE: GOTO begin ELSE GOTO begin 'check to see if end of throw, if so deals with it initialise: 'sub program initialise SCREEN 9 DRAW "C4 F10 U10 H10 D10 G10 U10 E10 C14 U25 D20 L1 U10 R2 D10 L1 D5" PAINT (312, 180), 4 PAINT (327, 180), 4 DRAW "M320, 175 C1 F10 U10 H10 D10 G10 U10 E10" GET (310, 140)-(330, 185), DART% RETURN cursor: 'sub program cursor LOCATE 2, 50 'print in top right box PRINT "SELECT WHERE TO AIM" DRAW "BM50,200 C14 U3 D6 U3 L3 R6" 'draw the cursor GET (47, 197)-(53, 203), CROSS% 'put it into memory DRAW "BM50,200 C0 U3 D6 U3 L3 R6" 'draw over in black PUT (CX, CY), CROSS% 'put the cursor picture down 40 'read characters from the keyboard LET Z$ = INKEY$ IF Z$ = " " THEN PUT (CX, CY), CROSS%: GOTO lower IF Z$ = "8" THEN PUT (CX, CY), CROSS%: LET CY = CY - 1: GOTO 30 IF Z$ = "2" THEN PUT (CX, CY), CROSS%: LET CY = CY + 1: GOTO 30 IF Z$ = "4" THEN PUT (CX, CY), CROSS%: LET CX = CX - 1: GOTO 30 IF Z$ = "6" THEN PUT (CX, CY), CROSS%: LET CX = CX + 1: GOTO 30 ELSE GOTO 40 30 PUT (CX, CY), CROSS% 'put the cursor down LOCATE 22, 11 'shows humans game total in appropriate box PRINT ""; HSCORE; LOCATE 22, 26 'shows cpu game total in appropriate box PRINT ""; CSCORE; GOTO 40 lower: CX = CX + 3 'change the cursor coordinates CY = CY + 3 LOCATE 2, 50 'print in the top right box PRINT " " RETURN 'go back to calling point DETECT: 'sub program detect SCORE$ = "" 'reset the scores SCORE = 0 ' green = 2 - colours used ' red = 4 ' light blue = 11 ' grey = 7 ' brown = 6 ' dark blue = 1 SLEEP IF POINT(DX, DY) = 1 THEN GOTO cont 'next few lines check to see if the IF POINT(DX, DY) = 7 THEN GOTO cont 'position hit is not a miss IF POINT(DX, DY) = 2 THEN GOTO cont IF POINT(DX, DY) = 6 THEN GOTO cont IF POINT(DX, DY) = 8 THEN GOTO cont IF POINT(DX, DY) = 4 THEN GOTO cont IF POINT(DX, DY) = 14 THEN LET SCORE$ = "HIT DART": GOTO bottom IF POINT(DX, DY) = 15 THEN LET SCORE$ = "BOUNCE OUT": GOTO bottom IF POINT(DX, DY) = 5 THEN LET SCORE$ = "MISS": GOTO bottom: ELSE SCORE$ = "MISS": GOTO bottom cont: '(below) check that it isn't a bull, 'outerbull or a bounce out IF POINT(DX, DY) = 1 THEN GOTO outerbull IF POINT(DX, DY) = 15 THEN LET SCORE$ = "BOUNCE OUT": GOTO bottom IF POINT(DX, DY) = 7 THEN GOTO bull '(below) detect which quarter of the 'board the dart has hit IF DX <= 480 AND DY <= 165 THEN GOTO topleft IF DX <= 480 AND DY >= 165 THEN GOTO bottomleft IF DX >= 480 AND DY <= 165 THEN GOTO topright IF DX >= 480 AND DY >= 165 THEN GOTO bottomright topleft: 'top left hand quarter X3 = DX Y3 = DY X1 = 361 Y1 = 137 X2 = 480 Y2 = 165 11 '(below) top line detects which side 'of the line the dart is 'second line decides which bit to go 'to next. P.S. - I haven't wrote much 'more in this sub - it's all the same, 'just the different numbers. Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "11": SCORE = 11: GOTO part: ELSE GOTO 14 14 X1 = 380 Y1 = 112 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "14": SCORE = 14: GOTO part: ELSE GOTO 9 9 X1 = 355 Y1 = 74 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "9": SCORE = 9: GOTO part: ELSE GOTO 12 12 X1 = 440 Y1 = 78 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "12": SCORE = 12: GOTO part: ELSE GOTO 5 5 LET SECTOR$ = "5": SCORE = 5: GOTO part bottomleft: 'bottom left hand quarter X3 = DX Y3 = DY X1 = 440 Y1 = 252 X2 = 480 Y2 = 165 3 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "3": SCORE = 3: GOTO part: ELSE GOTO 19 19 X1 = 355 Y1 = 256 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "19": SCORE = 19: GOTO part: ELSE GOTO 7 7 X1 = 380 Y1 = 218 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "7": SCORE = 7: GOTO part: ELSE GOTO 16 16 X1 = 361 Y1 = 194 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "16": SCORE = 16: GOTO part: ELSE GOTO 8 8 LET SECTOR$ = "8": SCORE = 8: GOTO part bottomright: 'bottom right hand quarter X3 = DX Y3 = DY X1 = 518 Y1 = 252 X2 = 480 Y2 = 165 17 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "17": SCORE = 17: GOTO part: ELSE GOTO 2 2 X1 = 605 Y1 = 256 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "2": SCORE = 2: GOTO part: ELSE GOTO 15 15 X1 = 580 Y1 = 218 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "15": SCORE = 15: GOTO part: ELSE GOTO 10 10 X1 = 598 Y1 = 194 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "10": SCORE = 10: GOTO part: ELSE GOTO 6 6 LET SECTOR$ = "6": SCORE = 6: GOTO part topright: 'top right hand quarter X3 = DX Y3 = DY X1 = 598 Y1 = 137 X2 = 480 Y2 = 165 13 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "13": SCORE = 13: GOTO part: ELSE GOTO 4 4 X1 = 580 Y1 = 112 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "4": SCORE = 4: GOTO part: ELSE GOTO 18 18 X1 = 605 Y1 = 74 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "18": SCORE = 18: GOTO part: ELSE GOTO 1 1 X1 = 518 Y1 = 78 Y4 = Y1 + ((Y2 - Y1) * ((X3 - X1) / ((X2 - X1)))) IF Y3 >= Y4 THEN LET SECTOR$ = "1": SCORE = 1: GOTO part: ELSE GOTO 20 20 LET SECTOR$ = "20": SCORE = 20: GOTO part part: IF POINT(DX, DY) = 2 THEN GOTO duble 'decides which type of scoring the IF POINT(DX, DY) = 6 THEN GOTO singl 'dart has hit, and goes to place IF POINT(DX, DY) = 8 THEN GOTO singl IF POINT(DX, DY) = 4 THEN GOTO treble duble: 'this changes all the variables so LET SCORE$ = "DOUBLE " + SECTOR$ 'that the rest of the program can LET SCORE = SCORE * 2 'detect that it is a double. It's LET TYPE$ = "DOUBLE" 'the same for trebles, singles etc. GOTO bottom singl: LET SCORE$ = "SINGLE " + SECTOR$ LET TYPE$ = "SINGLE" GOTO bottom treble: LET SCORE$ = "TREBLE " + SECTOR$ LET SCORE = SCORE * 3 LET TYPE$ = "TREBLE" GOTO bottom outerbull: LET SCORE$ = "OUTER BULL" LET SCORE = 25 GOTO bottom bull: LET SCORE$ = "BULLSEYE" LET SCORE = 50 LET TYPE$ = "DOUBLE" GOTO bottom bottom: RETURN throw: 'sub program throw LOCATE 2, 50 'print in top right box PRINT "STOP ARM AT RIGHT" DO 'start of loop that moves thrower's arm LINE (95, 133)-(G, 115), 0 'draw over the arms in black LINE (108, 133)-(K, 115), 0 CIRCLE (M, 113), 8, 0 'draw over the hand in black LET K = G + 13 'change the arm coordinates LET M = G + 7 CIRCLE (M, 113), 8, 4 'draw the hand IF DIR$ = "RIGHT" THEN LET G = G + 1 'continue direction IF DIR$ = "LEFT" THEN LET G = G - 1 LINE (95, 133)-(G, 115), 4 'draw the arm LINE (108, 133)-(K, 115), 4 AMNT = OAMNT 'reset "AMNT" DO 'start of sub loop FOR delay% = 1 TO CPU 'pauses for a bit NEXT delay% AMNT = AMNT - 1 'let "amnt" become smaller LOOP WHILE AMNT >= 0 LET FARLEFT = M - 4 ' LET FARIGHT = M + 4 IF DIR$ = "RIGHT" AND FARIGHT = BNDRIGHT THEN LET DIR$ = "LEFT" IF DIR$ = "LEFT" AND FARLEFT = BNDLEFT THEN LET DIR$ = "RIGHT" LOOP UNTIL INKEY$ = " " LOCATE 2, 50 PRINT " " RETURN findart: 'sub program findart - it works out the 'darts coordinates, using how big the 'error margine was found by the sub - '"throw" LET DIF = BNDRIGHT - FARIGHT 'let "DIF" equal how far the hand is 'away from the boundary DIF = DIF * LEVEL 'times that by what level it is set at RANDOMIZE TIMER 'randomize how far away the dart is 'from the aim postion, by using "DIF" DIFX = INT(RND * DIF) + 1 DIFY = INT(RND * DIF) + 1 WAYDIR = INT(RND * 4) + 1 IF WAYDIR = 1 THEN LET DX = CX - DIFX: DY = CY + DIFY IF WAYDIR = 2 THEN LET DX = CX + DIFX: DY = CY - DIFY IF WAYDIR = 3 THEN LET DX = CX - DIFX: DY = CY - DIFY IF WAYDIR = 4 THEN LET DX = CX + DIFX: DY = CY + DIFY '(above) work out where the dart is now, using the randomisations RETURN ANIMATION: 'sub program animation - shows the dart 'moving LOCATE 1, 1 'locate text coordinates LOCATE 2, 50 'print in top right box PRINT "WAIT AND HOPE!" DY2 = 300 - DY 'work out where the dart starts off LET MX = DX - 10 PX = MX 'let the variables the are to be PY = DY + DY2 'changed, equal the darts coordinates PUT (PX, PY), DART% 'put the dart picture down DO 'start of loop IF PY = 1 THEN GOTO enda 'checks the screen limits IF PX = 321 THEN GOTO enda IF PX = 635 THEN GOTO enda PUT (PX, PY), DART% 'puts the dart down LET PY = PY - 1 'move dart verticle coordinate up one IF PY = DY THEN GOTO enda 'checks if animation dart = final pos. PUT (PX, PY), DART% 'put dart down again LOOP 'go back to the beginning of the loop enda: LOCATE 2, 50 'print in the top right box PRINT " " RETURN BOUNCEOUT: 'sub program bounceout - deals with it RANDOMIZE TIMER 'randomises which direction to bounce DIR2 = INT(RND * 2) IF DIR2 = 0 THEN LET DIST = 550 - MX 'minuses it off the dart's postition IF DIR2 = 1 THEN LET DIST = MX - 380 LET QX = MX 'lets the variables equal orginal ones LET QY = DY OUTSOUND 'go to PROCEDURE "outsound" PUT (QX, QY), DART% 'put the dart down again DO 'begin a new loop IF QY = 290 THEN LET DOWN$ = "YES": GOTO endb 'check screen limits PUT (QX, QY), DART% 'put the dart down yet again IF DIR2 = 0 THEN LET QY = QY + 1: QX = QX + 1 'move the dart IF DIR2 = 1 THEN LET QY = QY + 1: QX = QX - 1 'move the dart FOR delay = 1 TO 100 'makes a delay NEXT delay PUT (QX, QY), DART% 'put dart down....again LET DIST = DIST - 1 'change how far to go LOOP UNTIL DIST = 0 'loop unless "DIST" equals 0 PUT (QX, QY), DART% 'put dart down endb: IF DOWN$ = "YES" THEN PUT (QX, QY), DART% 'a check to see whether to put 'dart down or not RETURN computer: 'sub computer - the whole of the 'computers turn LOCATE 2, 50 'print in top right box PRINT "COMPUTER'S TURN " SLEEP 1 '"sleep" for a bit LOCATE 2, 50 'print in top right box again PRINT " " IF CSCORE <= 51 THEN GOTO adouble 'check to see what to go for IF CSCORE >= 110 THEN GOTO atreble IF 50 >= CSCORE <= 110 THEN LET AIM = 20: GOTO CSINGLE ELSE GOTO adouble atreble: 'go for a treble IF DART = 1 THEN LET AIM$ = "TREBLE 20": GOTO ctreble 'aim for treble 20 IF DART = 2 THEN LET AIM$ = "TREBLE 20": GOTO ctreble 'aim for treble 20 IF DART = 3 THEN GOTO 35 35 'randomizes to see whether to go for 57 RANDOMIZE TIMER SECT = INT(RND * 7) IF SECT <= 4 THEN LET AIM$ = "TREBLE 20": GOTO ctreble ELSE LET AIM$ = "TREBLE 19": GOTO ctreble adouble: 'go for a double - to finish '(block below) check for it's favourite doubles IF CSCORE = 50 THEN LET AIM$ = "BULLSEYE": GOTO CSINGLE IF CSCORE = 40 THEN LET AIM$ = "DOUBLE 20": GOTO cdouble IF CSCORE = 32 THEN LET AIM$ = "DOUBLE 16": GOTO cdouble IF CSCORE = 20 THEN LET AIM$ = "DOUBLE 10": GOTO cdouble IF CSCORE = 16 THEN LET AIM$ = "DOUBLE 8": GOTO cdouble IF CSCORE = 10 THEN LET AIM$ = "DOUBLE 5": GOTO cdouble IF CSCORE = 6 THEN LET AIM$ = "DOUBLE 3": GOTO cdouble IF CSCORE = 2 THEN LET AIM$ = "DOUBLE 1": GOTO cdouble '(block below) get score down to nearest favourite double, by using 'singles IF CSCORE >= 40 THEN LET AIM = CSCORE - 40: GOTO CSINGLE IF CSCORE >= 32 THEN LET AIM = CSCORE - 32: GOTO CSINGLE IF CSCORE >= 20 THEN LET AIM = CSCORE - 20: GOTO CSINGLE IF CSCORE >= 10 THEN LET AIM = CSCORE - 10: GOTO CSINGLE IF CSCORE >= 6 THEN LET AIM = CSCORE - 6: GOTO CSINGLE IF CSCORE >= 2 THEN LET AIM = CSCORE - 2: GOTO CSINGLE ctreble: 'lets aim coordinates equal aim LET LAST$ = "TREBLE" 'variable to check target type IF AIM$ = "TREBLE 20" THEN AX = 489: AY = 118: GOTO comp2 IF AIM$ = "TREBLE 19" THEN AX = 450: AY = 207: GOTO comp2 IF AIM$ = "TREBLE 18" THEN AX = 526: AY = 131: GOTO comp2 IF AIM$ = "TREBLE 17" THEN AX = 489: AY = 212: GOTO comp2 IF AIM$ = "TREBLE 16" THEN AX = 422: AY = 186: GOTO comp2 IF AIM$ = "TREBLE 15" THEN AX = 526: AY = 198: GOTO comp2 IF AIM$ = "TREBLE 14" THEN AX = 422: AY = 144: GOTO comp2 IF AIM$ = "TREBLE 13" THEN AX = 544: AY = 157: GOTO comp2 IF AIM$ = "TREBLE 12" THEN AX = 449: AY = 123: GOTO comp2 IF AIM$ = "TREBLE 11" THEN AX = 416: AY = 158: GOTO comp2 IF AIM$ = "TREBLE 10" THEN AX = 538: AY = 187: GOTO comp2 IF AIM$ = "TREBLE 9" THEN AX = 433: AY = 132: GOTO comp2 IF AIM$ = "TREBLE 8" THEN AX = 416: AY = 173: GOTO comp2 IF AIM$ = "TREBLE 7" THEN AX = 434: AY = 198: GOTO comp2 IF AIM$ = "TREBLE 6" THEN AX = 544: AY = 172: GOTO comp2 IF AIM$ = "TREBLE 5" THEN AX = 469: AY = 118: GOTO comp2 IF AIM$ = "TREBLE 4" THEN AX = 538: AY = 143: GOTO comp2 IF AIM$ = "TREBLE 3" THEN AX = 469: AY = 211: GOTO comp2 IF AIM$ = "TREBLE 2" THEN AX = 509: AY = 207: GOTO comp2 IF AIM$ = "TREBLE 1" THEN AX = 509: AY = 122: GOTO comp2 cdouble: 'lets aim coordinates equal aim LET LAST$ = "DOUBLE" 'variable to check target type IF AIM$ = "DOUBLE 20" THEN AX = 498: AY = 78: GOTO comp2 IF AIM$ = "DOUBLE 19" THEN AX = 425: AY = 243: GOTO comp2 IF AIM$ = "DOUBLE 18" THEN AX = 564: AY = 102: GOTO comp2 IF AIM$ = "DOUBLE 17" THEN AX = 496: AY = 252: GOTO comp2 IF AIM$ = "DOUBLE 16" THEN AX = 373: AY = 205: GOTO comp2 IF AIM$ = "DOUBLE 15" THEN AX = 566: AY = 226: GOTO comp2 IF AIM$ = "DOUBLE 14" THEN AX = 372: AY = 126: GOTO comp2 IF AIM$ = "DOUBLE 13" THEN AX = 598: AY = 151: GOTO comp2 IF AIM$ = "DOUBLE 12" THEN AX = 425: AY = 87: GOTO comp2 IF AIM$ = "DOUBLE 11" THEN AX = 362: AY = 151: GOTO comp2 IF AIM$ = "DOUBLE 10" THEN AX = 587: AY = 204: GOTO comp2 IF AIM$ = "DOUBLE 9" THEN AX = 395: AY = 103: GOTO comp2 IF AIM$ = "DOUBLE 8" THEN AX = 362: AY = 179: GOTO comp2 IF AIM$ = "DOUBLE 7" THEN AX = 395: AY = 227: GOTO comp2 IF AIM$ = "DOUBLE 6" THEN AX = 598: AY = 179: GOTO comp2 IF AIM$ = "DOUBLE 5" THEN AX = 461: AY = 78: GOTO comp2 IF AIM$ = "DOUBLE 4" THEN AX = 587: AY = 124: GOTO comp2 IF AIM$ = "DOUBLE 3" THEN AX = 461: AY = 252: GOTO comp2 IF AIM$ = "DOUBLE 2" THEN AX = 535: AY = 243: GOTO comp2 IF AIM$ = "DOUBLE 1" THEN AX = 534: AY = 86: GOTO comp2 CSINGLE: 'lets aim coordinates equal aim LET LAST$ = "SINGLE" 'variable to check target type IF AIM = 20 THEN AX = 494: AY = 97: GOTO comp2 IF AIM = 19 THEN AX = 438: AY = 226: GOTO comp2 IF AIM = 18 THEN AX = 547: AY = 116: GOTO comp2 IF AIM = 17 THEN AX = 493: AY = 232: GOTO comp2 IF AIM = 16 THEN AX = 395: AY = 196: GOTO comp2 IF AIM = 15 THEN AX = 546: AY = 214: GOTO comp2 IF AIM = 14 THEN AX = 393: AY = 133: GOTO comp2 IF AIM = 13 THEN AX = 575: AY = 154: GOTO comp2 IF AIM = 12 THEN AX = 436: AY = 103: GOTO comp2 IF AIM = 11 THEN AX = 382: AY = 155: GOTO comp2 IF AIM = 10 THEN AX = 564: AY = 197: GOTO comp2 IF AIM = 9 THEN AX = 410: AY = 115: GOTO comp2 IF AIM = 8 THEN AX = 382: AY = 176: GOTO comp2 IF AIM = 7 THEN AX = 413: AY = 214: GOTO comp2 IF AIM = 6 THEN AX = 575: AY = 177: GOTO comp2 IF AIM = 5 THEN AX = 465: AY = 96: GOTO comp2 IF AIM = 4 THEN AX = 564: AY = 133: GOTO comp2 IF AIM = 3 THEN AX = 466: AY = 232: GOTO comp2 IF AIM = 2 THEN AX = 521: AY = 225: GOTO comp2 IF AIM = 1 THEN AX = 523: AY = 104: GOTO comp2 IF AIM$ = "BULLSEYE" THEN LET AX = 480: AY = 165: GOTO comp2 IF AIM$ = "OUTER BULL" THEN LET AX = 480: AY = 159: GOTO comp2 comp2: 'next step of aiming process LOCATE 2, 50 'print in top right box PRINT " BOO! " LET CLOOP = OCLOOP 'let the throw amount equal original RANDOMIZE TIMER DIF7 = INT(RND * 6) + 1 LET DIF6 = BNDRIGHT - DIF7 DO 'beginning of loop LINE (95, 133)-(G, 115), 0 'draws the arms in black LINE (108, 133)-(K, 115), 0 CIRCLE (M, 113), 8, 0 'draws the hand in black LET K = G + 13 'changes the drawing variables LET M = G + 7 CIRCLE (M, 113), 8, 4 'draw hand in red IF DIR$ = "RIGHT" THEN LET G = G + 1 'continue direction IF DIR$ = "LEFT" THEN LET G = G - 1 LINE (95, 133)-(G, 115), 4 'draws the arms in red LINE (108, 133)-(K, 115), 4 AMNT = OAMNT 'let "AMNT" equal original DO 'begin a new - sub loop FOR delay% = 1 TO CPU 'pause for a bit NEXT delay% AMNT = AMNT - 1 'change the "AMNT" variable LOOP WHILE AMNT >= 0 'rerun sub loop while "AMNT" >= 0 LET FARLEFT = M - 4 'let the variables equal sides of hand LET FARIGHT = M + 4 LOCATE 22, 11 'shows humans game total in appropriate box PRINT ""; HSCORE; LOCATE 22, 26 'shows cpu game total in appropriate box PRINT ""; CSCORE; IF DIR$ = "RIGHT" AND FARIGHT = BNDRIGHT THEN LET DIR$ = "LEFT": IF CLOOP >= 0 THEN LET CLOOP = CLOOP - 1 IF DIR$ = "LEFT" AND FARLEFT = BNDLEFT THEN LET DIR$ = "RIGHT": IF CLOOP >= 0 THEN LET CLOOP = CLOOP - 1 '(above) change direction of hand if it equals boundary IF CLOOP = 0 AND FARIGHT = DIF6 THEN GOTO cthrow 'goto next stage LOOP 'go back to the top cthrow: 'next stage of aiming process LET CX = AX 'let variables equal originals LET CY = AY LET DIF = BNDRIGHT - FARIGHT 'let "DIF" equal difference LET DIF7 = (20 - LEVEL) - 5 'value "DIF7" using the level DIF = DIF * DIF7 'value "DIF" by using "DIF7" RANDOMIZE TIMER 'randomize how far away dart is from 'aiming position DIFX = INT(RND * DIF) + 1 DIFY = INT(RND * DIF) + 1 WAYDIR = INT(RND * 4) + 1 IF WAYDIR = 1 THEN LET DX = CX - DIFX: DY = CY + DIFY IF WAYDIR = 2 THEN LET DX = CX + DIFX: DY = CY - DIFY IF WAYDIR = 3 THEN LET DX = CX - DIFX: DY = CY - DIFY IF WAYDIR = 4 THEN LET DX = CX + DIFX: DY = CY + DIFY '(above) change the darts postion depending on randomisation RETURN p1win: 'sub p1win - if p1 wins LOCATE 2, 50 'print in top right box PRINT " PLAYER 1 WINS!! " SOUND 900, 3 'make the "appropriate" sound SOUND 1200, 3 SLEEP 1 'wait for a bit RETURN p2win: 'sub p2win - same as p1win, so look 'above for what happens LOCATE 2, 50 PRINT " PLAYER 2 WINS!! " SOUND 900, 3 SOUND 1200, 3 SLEEP 1 LOCATE 2, 50 PRINT " " RETURN bust: LOCATE 2, 50 PRINT " BUST!! " SOUND 500, 2.5 SOUND 400, 2.5 SLEEP 1 SCORE = 0 TOTAL = 0 DART = 0 LOCATE 2, 50 PRINT " " RETURN INTRO: 'sub intro - guess what? SCREEN 13 'set screen mode 13 LOCATE 5, 18 'locate text coordinates COLOR 15 'text colour 15 - white PRINT "DARTS" 'print word "DARTS" DRAW "C14 BM128,41 U12 R52 D12 L52" 'draw the 2 boxes around word DRAW "C4 BM123,46 U22 R62 D22 L62" LOCATE 8, 12 'locate text coordinates COLOR 15 'text colour 15 - white again PRINT "BY GRAHAM DANIELL" 'print my name DRAW "C14 BM80,134 U55 R150 D55 L150" 'draw boxes for the menu DRAW "C4 BM75,139 U65 R160 D65 L160" LOCATE 12, 13 'this next block prints out the menu COLOR 1 PRINT "1) INSTRUCTIONS" LOCATE 13, 13 COLOR 10 PRINT "2) NEW GAME" LOCATE 14, 13 COLOR 11 PRINT "3) PLAYERS -"; PLAYS; LOCATE 15, 13 COLOR 13 PRINT "4) GAME - "; GAME; LOCATE 16, 13 COLOR 12 PRINT "5) SKILL - "; LEVEL; LOCATE 21, 9 'locate text coordinates COLOR 15 'text colour 15 - white PRINT "EMAIL - DANIELL@WHICH.NET" 'print my email address int2: DO 'begin a new loop LET INTR$ = INKEY$ 'let "INTR$" be read from keyboard IF INTR$ = "1" THEN PLAY "": INSTRUCTIONS: GOSUB INTRO IF INTR$ = "2" THEN PLAY "": GOTO startg IF INTR$ = "3" AND PLAYS = 1 THEN LET PLAYS = 2: PLAY "": GOTO show IF INTR$ = "3" AND PLAYS = 2 THEN LET PLAYS = 1: PLAY "": GOTO show IF INTR$ = "4" AND GAME = 301 THEN LET GAME = 501: PLAY "": GOTO show IF INTR$ = "4" AND GAME = 501 THEN LET GAME = 301: PLAY "": GOTO show IF INTR$ = "5" THEN LET LEVEL = LEVEL + 1: PLAY "": GOTO show2 '(above) checks what "INTR$" is and deals with it LOOP 'goto the beginning of the loop show: LOCATE 12, 13 'this next block prints out the menu COLOR 1 PRINT "1) INSTRUCTIONS" LOCATE 13, 13 COLOR 10 PRINT "2) NEW GAME" LOCATE 14, 13 COLOR 11 PRINT "3) PLAYERS -"; PLAYS; LOCATE 15, 13 COLOR 13 PRINT "4) GAME - "; GAME; LOCATE 16, 13 COLOR 12 PRINT "5) SKILL - "; LEVEL; GOTO int2 'goto label "int2" show2: IF LEVEL >= 16 THEN LET LEVEL = 1 'checks that the level isn't to high LOCATE 16, 13 'locate text coordinates COLOR 12 'text colour 12 - pinky PRINT "5) SKILL - "; LEVEL; 'print the skill level GOTO int2 'goto label "int2" startg: SCREEN 9 'change to screen mode 9 RETURN SUB BLACKDART 'this sub draws a dart silloutte just before the final dart is put down, 'so that its colours aren't changed SHARED DX, DY 'give sub access to variables NY = DY + 35 'coordinates for black dart NX = DX + 0 CIRCLE (NX, NY), 0 'move cursor to spot AMN = 5 'set variables AM = 5 DRAW "C0 F10 U10" 'draw first part of dart in black DO 'beginning of loop DRAW "C0 H1 D10 H1 U10" 'draw second part of dart in black AMN = AMN - 1 LOOP UNTIL AMN = 0 DO 'beginning of second loop DRAW "C0 G1 D10 G1 U10" 'draw third part of dart in black AM = AM - 1 LOOP UNTIL AM = 0 DRAW "E10 C0 U25 D20 L1 U10 R2 D10 L1 D5" 'draw final part in black END SUB SUB DRAWBOARD 'this sub draws the dartboard - i.e right part of screen except info boxes CLS 'clears screen A = 5 B = 63 CX = 480 'i.e - CircleX / CircleY CY = 165 ' green = 2 'colour values ' red = 4 ' light blue = 11 ' grey = 7 ' brown = 6 SCREEN 9 'sets screen mode 9 DRAW "C5 U300 D600" 'draws divider CIRCLE (CX, CY), 125, 2 'draws outer double circle in green CIRCLE (CX, CY), 115, 2 'draws inner double circle in green PAINT (490, 78), 2 'paints the whole double circle in green CIRCLE (CX, CY), 125 'draws over the outer double circle in white CIRCLE (CX, CY), 115, 6 'draws over the inner double circle in brown CIRCLE (CX, CY), 11, 6 'draws the outer bull circle in brown PAINT (490, 110), 6 'paints the whole singles section brown :- 'N.B - no treble circles yet CIRCLE (CX, CY), 115, 8 'paints the inner doubles circle in dark grey CIRCLE (CX, CY), 11, 8 'paibts the outer bull circle in dark grey LINE (518, 78)-(440, 252), 8 'draws the to-be remaining dartboard lines LINE (440, 78)-(518, 252), 8 'in dark grey LINE (380, 112)-(580, 218), 8 LINE (580, 112)-(380, 218), 8 LINE (361, 137)-(598, 194), 8 LINE (598, 137)-(361, 194), 8 DRAW "C8 M480,165 U91 D182 U91 L124 R248 L124 F73 H146 F73 E73 G146 E73" 'draws the diagonal lines on the dartboard in dark grey (above) PAINT (400, 158), 8 'paints the different stripes of the board in PAINT (400, 110), 8 'grey PAINT (460, 110), 8 PAINT (500, 130), 8 PAINT (550, 130), 8 PAINT (570, 180), 8 PAINT (530, 200), 8 PAINT (490, 200), 8 PAINT (460, 200), 8 PAINT (405, 200), 8 CIRCLE (CX, CY), 115 'draws over the inner double circle in white CIRCLE (CX, CY), 11 'draws over the outer bull circle in white CIRCLE (CX, CY), 6 'draws the inner bull circle in white CIRCLE (CX, CY), 70, 4 'draws the outer treble circle in red CIRCLE (CX, CY), 60, 4 'draws the inner treble circle in red PAINT (475, 118), 4 'paints the whole treble ring in red CIRCLE (CX, CY), 70 'draws the outer treble circle in white CIRCLE (CX, CY), 60 'draws the inner treble circle in white DRAW "C15 M480,165 U91 D182 U91 L124 R248 L124 F73 H146 F73 E73 G146 E73" 'draws the diagonal lines on the dartboard in white (above) LINE (518, 78)-(440, 252) 'draws the remaining dartboard lines LINE (440, 78)-(518, 252) LINE (380, 112)-(580, 218) LINE (580, 112)-(380, 218) LINE (361, 137)-(598, 194) LINE (598, 137)-(361, 194) CIRCLE (CX, CY), 11, 1 'draws the outer bull circle in dark blue CIRCLE (CX, CY), 6, 7 'draws the inner bull circle in grey PAINT (CX, CY), 7 'paints the inner bull circle in grey CIRCLE (CX, CY), 6, 1 'draws the inner bull circle in dark blue PAINT (472, 165), 1 'paints the outer bull in dark blue CIRCLE (CX, CY), 6 'draws the inner bull circle in white CIRCLE (CX, CY), 11 'draws the outer bull circle in white LOCATE A, B 'locates the variables A and B PRINT "20" 'prints the letters "20" A = A + 1 'from now on, the letters are printed out B = B + 5 'around the board LOCATE A, B PRINT "1" A = A + 1 B = B + 4 LOCATE A, B PRINT "18" A = A + 2 B = B + 4 LOCATE A, B PRINT "4" A = A + 2 B = B + 1 LOCATE A, B PRINT "13" A = A + 3 B = B + 1 LOCATE A, B PRINT "6" A = A + 2 B = B - 3 LOCATE A, B PRINT "10" A = A + 2 B = B - 3 LOCATE A, B PRINT "15" A = A + 1 B = B - 3 LOCATE A, B PRINT "2" A = A + 1 B = B - 6 LOCATE A, B PRINT "17" B = B - 6 LOCATE A, B PRINT "3" A = A - 1 B = B - 5 LOCATE A, B PRINT "19" A = A - 1 B = B - 4 LOCATE A, B PRINT "7" A = A - 2 B = B - 3 LOCATE A, B PRINT "16" A = A - 2 B = B - 2 LOCATE A, B PRINT "8" A = A - 3 LOCATE A, B PRINT "11" A = A - 2 B = B + 2 LOCATE A, B PRINT "14" A = A - 2 B = B + 3 LOCATE A, B PRINT "9" A = A - 1 B = B + 3 LOCATE A, B PRINT "12" A = A - 1 B = B + 7 LOCATE A, B PRINT "5" CIRCLE (CX, CY), 157, 5 'draws the outer board circle in pink PAINT (330, 280), 5 'paints the second half of the screen pink DRAW "BM320,200 C15 U300 D600" 'draws divider 'CIRCLE (CX, CY), 157 'draws the outer board circle in white 'try deleting it to change out of circle END SUB SUB DRAWDETAILS 'this sub draws all of the information box outlines DRAW "C9 BM431,313 U25 R96 D25 L96" 'draws the bottom right box PAINT (432, 312), 9 DRAW "C0 BM436,308 U15 R86 D15 L86" PAINT (437, 307), 0 DRAW "C15 BM431,313 U25 R96 D25 L96" DRAW "C15 BM436,308 U15 R86 D15 L86" DRAW "C12 BM49,311 U35 R96 D35 L96" 'draws player 1's score box PAINT (50, 310), 12 DRAW "C15 BM49,311 U35 R96 D35 L96" LOCATE 21, 8 PRINT " PLAYER 1 " DRAW "C13 BM169,311 U35 R96 D35 L96" 'draws player 2's score box PAINT (170, 310), 13 DRAW "C15 BM169,311 U35 R96 D35 L96" LOCATE 21, 23 PRINT " PLAYER 2 " DRAW "C10 BM133,36 R64 D25 L64 U25" 'draws the upper right box DRAW "C10 BM140,41 R50 D15 L50 U15" PAINT (134, 37), 10 DRAW "C15 BM133,36 R64 D25 L64 U25" DRAW "C15 BM140,41 R50 D15 L50 U15" DRAW "C11 BM380,8 R200 D25 L200 U25" 'draws the upper left box DRAW "C11 BM387,12 R186 D16 L186 U16" PAINT (381, 9), 11 DRAW "C0 BM387,12 R186 D16 L186 U16" PAINT (388, 13), 0 DRAW "C15 BM380,8 R200 D25 L200 U25" DRAW "C15 BM387,12 R186 D16 L186 U16" 'STOP END SUB SUB DRAWLEFT 'draws the floor and dartboard by the thrower on the left side of the screen DRAW "C10 BM10,266 R290" DRAW "C15 BU120 L10 U50 R10" END SUB SUB DRAWPLYR 'this sub draws the thrower on the left side of the screen SHARED G, K, M, DART 'get access to variables IF DART = 1 THEN SCREEN 9 'if it is first dart, then screen 9 LINE (95, 133)-(G, 115), 0 'draws the thrower's arm in black LINE (108, 133)-(K, 115), 0 CIRCLE (M, 113), 8, 0 'draws the hand in black DRAW "C15 BM50,100" 'moves the cursor DRAW "E1R1F2U2H1H2L3H1L4H1L4H1L2G1L1G1L4G1D1G1D2G1D2G1D2D3F1D3D5F1D1F1D1D2D3G2L1G1L2G2L2G1L2G2D1D2D4F1D2F1D5F1D10F1D10F1D10G1D2G2D3D4F1D3F1D5D5F1D5D10F1D10D10D5G1D2L1G1D3G1D3F1R2R5R10R5R5R5E1R2E1U2H1L2H1L5H1L5U10E1U1" DRAW "U10E1U10E1U5E1U5E2F2D10F1D5F1D5F1D5F1D5F1D5F1D5F1D3D1F1R10R10E1R2E1R2E1U2H1L2H1L5L5R2U2U5H1U5H1U10U10H1U10H1U54E1U5E1R5E1R5E1R5E1R5H1U3H1U5H1U3L5G1L10L5H1L5H1L5H2L3H1L3U5L1R4E1E1U1H1U5E1R5E1H3U1H2U1H2U2E1U1E1" DRAW "BM86,135 C4 R5 E1 R2 BM88,147 R3 E1 R3 E1 R4 E1 R5 E2 U6 H1 U1" '(above) draws the main body etc LINE (95, 133)-(90, 115), 4 'draws the arm in red LINE (108, 133)-(103, 115), 4 CIRCLE (97, 113), 8, 4 'draws the hand in red END SUB SUB GOODSCORE 'this sub makes the score flash in the top left box, it it's good SHARED TOTAL, CPU 'get access to variables DONE = 6 'the loop amount DO 'beginning of loop RANDOMIZE TIMER 'randomize the score colour (0-15) A = INT(RND * 15) LOCATE 4, 19 'locate position COLOR A 'change to randomized colour PRINT ""; TOTAL; 'print the score in the chosen colour FOR dly = 1 TO CPU 'pause using variable "CPU" NEXT dly SOUND 500, 1 'the 2 sounds you hear SOUND 400, 1 DONE = DONE - 1 'let the loop amount equal 1 less LOOP UNTIL DONE = 0 'exit loop if "DONE" equals 0 COLOR 15 'text colour 15 IF SCORE = 150 THEN LOCATE 2, 50: PRINT " HAT TRICK!": SLEEP 1 'print in top right box END SUB SUB HITBOARD 'this sub produces the sound when the dart hits the board. I know it is 'pretty pointless to do it as a procedure, but it's easier to use, so what 'the hell? SOUND 50, .5 'the hitboard sound END SUB SUB INSTRUCTIONS 'this sub displays the instructions on the screen...all pretty basic stuff SCREEN 13 'change screen mode to no. 13 - VGA? PRINT "" PRINT "" COLOR 4 'change text color to 4 - red PRINT " DARTS" PRINT "" PRINT "" COLOR 14 'change text color to 14 - yellow PRINT "First of all, you must move the cursor" PRINT "on the dartboard, by using the keypad." PRINT "Then press space to start the thrower's" PRINT "arm. You must then press space when the" PRINT "throwers hand is as far right as possi-" PRINT "ble. The further away the thrower's hand" PRINT "is, the the worse your shot will be." PRINT "" PRINT "" COLOR 15 'change text color to 15 - white PRINT "The skill option on the menu not only" PRINT "decides how good the computer is, but" PRINT "also decides how big your penalty is if" PRINT "you do not stop the hand on the right." PRINT "" PRINT "" COLOR 13 'change text color to 13 - pinky PRINT " email DANIELL@WHICH.NET" PRINT "" PRINT "" SOUND 200, 1 'plays a pointless sound SLEEP 'wait for button to be pressed CLS 'clear screen END SUB SUB OUTSOUND 'this is the sound when there is a bounce out, again it's pretty pointless SOUND 200, .5 'here is the sound END SUB