You are not logged in or registered. Please login or register to use the full functionality of this board...
The QB64 Edition
Exit Board Game in QB64 - Printable Version

+- The QB64 Edition (http://www.thejoyfulprogrammer.com/qb64/forum)
+ Thread: Exit Board Game in QB64 (/showthread.php?tid=200)



Exit Board Game in QB64 - Donald Foster - 11-29-2014 12:25 AM

Hello all, 

I've added another board game to the collection. Exit came out in mid 80's and I Originally wrote it about 30 years ago.
Here's my QB64 version of the game.

Hope you enjoy playing.

Donald

Code Snippet: [Select]
_TITLE "EXIT by Donald L. Foster Jr."


SCREEN _NEWIMAGE(1010, 737, 256)

RANDOMIZE TIMER

CLEAR

_PALETTECOLOR 1, _RGB32(255, 255, 255) '   White
_PALETTECOLOR 2, _RGB32(225, 125, 0) '     Orange
_PALETTECOLOR 3, _RGB32(0, 0, 120) '       Dark Blue
_PALETTECOLOR 4, _RGB32(0, 0, 180) '       Med Dark Blue
_PALETTECOLOR 5, _RGB32(51, 51, 255) '     Med Light Blue
_PALETTECOLOR 6, _RGB32(102, 102, 255) '   Light Blue
_PALETTECOLOR 7, _RGB32(153, 153, 255) '   Lightest Blue
_PALETTECOLOR 8, _RGB32(0, 0, 119) '       Shadow Color
_PALETTECOLOR 9, _RGB32(200, 200, 200) '   Grey
_PALETTECOLOR 10, _RGB32(153, 255, 255) '  Lt Cyan
_PALETTECOLOR 11, _RGB32(0, 204, 204) '    Cyan
_PALETTECOLOR 12, _RGB32(0, 153, 153) '    Dark Cyan
_PALETTECOLOR 13, _RGB32(120, 120, 120)

Player = 1: Opponant = 2: PreviousDirection = 0
PlayerColor(1) = 1: PlayerColor(2) = 2: PlayerColor(3) = 0
PieceColor(2, 3) = 1: PieceColor(2, 5) = 1: PieceColor(4, 3) = 1: PieceColor(4, 5) = 1: PieceColor(6, 3) = 1: PieceColor(6, 5) = 1
PieceColor(3, 2) = 2: PieceColor(3, 4) = 2: PieceColor(3, 6) = 2: PieceColor(5, 2) = 2: PieceColor(5, 4) = 2: PieceColor(5, 6) = 2
PieceColor(4, 4) = 3
FOR z = 1 TO 7: FOR y = 1 TO 7: BlockColor(z, y) = 5: NEXT: NEXT
BlockColor(1, 4) = 6: BlockColor(2, 2) = 6: BlockColor(2, 6) = 6: BlockColor(3, 3) = 6: BlockColor(3, 5) = 6: BlockColor(4, 1) = 6
BlockColor(4, 7) = 6: BlockColor(5, 3) = 6: BlockColor(5, 5) = 6: BlockColor(6, 2) = 6: BlockColor(6, 6) = 6: BlockColor(7, 4) = 6
StartPosition(2, 3) = 1: StartPosition(2, 5) = 1: StartPosition(3, 2) = 1: StartPosition(3, 6) = 1: StartPosition(4, 3) = 1: StartPosition(4, 4) = 1: StartPosition(4, 5) = 1: StartPosition(5, 2) = 1: StartPosition(5, 4) = 1: StartPosition(5, 6) = 1: StartPosition(6, 3) = 1: StartPosition(6, 5) = 1
PieceFlip(2, 3) = 1: PieceFlip(2, 5) = 1: PieceFlip(3, 2) = 1: PieceFlip(3, 6) = 1: PieceFlip(4, 3) = 1: PieceFlip(4, 4) = 1: PieceFlip(4, 5) = 1: PieceFlip(5, 2) = 1: PieceFlip(5, 4) = 1: PieceFlip(5, 6) = 1: PieceFlip(6, 3) = 1: PieceFlip(6, 5) = 1
AA(2, 1) = 1: AA(2, 3) = 1: AA(2, 5) = 1: AA(2, 7) = 1: AA(3, 1) = 2: AA(3, 4) = 1: AA(3, 7) = 2: AA(4, 2) = 1: AA(4, 4) = 2: AA(4, 6) = 1: AA(5, 2) = 2: AA(5, 4) = 3: AA(5, 6) = 2: AA(6, 1) = 1: AA(6, 4) = 4: AA(6, 7) = 1: AA(7, 1) = 2: AA(7, 3) = 1: AA(7, 5) = 1: AA(7, 7) = 2
AB(1, 6) = 1: AB(3, 6) = 1: AB(5, 6) = 1: AB(7, 6) = 1: AB(1, 5) = 2: AB(4, 5) = 1: AB(7, 5) = 2: AB(2, 4) = 1: AB(4, 4) = 2: AB(6, 4) = 1: AB(2, 3) = 2: AB(4, 3) = 3: AB(6, 3) = 2: AB(1, 2) = 1: AB(4, 2) = 4: AB(7, 2) = 1: AB(1, 1) = 2: AB(3, 1) = 1: AB(5, 1) = 1: AB(7, 1) = 2
AC(1, 2) = 1: AC(3, 2) = 1: AC(5, 2) = 1: AC(7, 2) = 1: AC(1, 3) = 2: AC(4, 3) = 1: AC(7, 3) = 2: AC(2, 4) = 1: AC(4, 4) = 2: AC(6, 4) = 1: AC(2, 5) = 2: AC(4, 5) = 3: AC(6, 5) = 2: AC(1, 6) = 1: AC(4, 6) = 4: AC(7, 6) = 1: AC(1, 7) = 2: AC(3, 7) = 1: AC(5, 7) = 1: AC(7, 7) = 2
AD(6, 1) = 1: AD(6, 3) = 1: AD(6, 5) = 1: AD(6, 7) = 1: AD(5, 1) = 2: AD(5, 4) = 1: AD(5, 7) = 2: AD(4, 2) = 1: AD(4, 4) = 2: AD(4, 6) = 1: AD(3, 2) = 2: AD(3, 4) = 3: AD(3, 6) = 2: AD(2, 1) = 1: AD(2, 4) = 4: AD(2, 7) = 1: AD(1, 1) = 2: AD(1, 3) = 1: AD(1, 5) = 1: AD(1, 7) = 2

BlockShadow$ = "G3D81R81E3L81U81"
LogoE$ = "R54D15L39D6R39D11L39D6R39D15L54U53"
LogoX$ = "F26G27R20E18F18R20H27E26L20G18H18L20"
LogoI$ = "R15D53L15U53"
LogoT$ = "R53D15L19D38L15U38L19U15"
Dice$(1) = "R12C15D30R6U30L6"
Dice$(2) = "C15R30D18L24D6R24D6L30U18R24U6L24U6"
Dice$(3) = "C15R30D30L30U6R24U6L18U6R18U6L24U6"
UpArrow$ = "F30L20D20L20U20L20NE30G4R20D20R20E4U16R16E4"
RightArrow$ = "G30U20L20U20R20U20NF30G4D16L16G4D20R20D20E4"
LeftArrow$ = "E30D20R20D20L20D20H30G4F30E4U16R16E4"
DownArrow$ = "E30L20U20L20D20L20F30G4H30E4R16U16E4"

LINE (0, 0)-(1010, 737), 15, BF

' Draw Board
LINE (84, 84)-(652, 652), 3, B
x = 0
FOR z = 1 TO 7
    v = 0
    FOR y = 1 TO 7
        LINE (85 + v, 85 + x)-(165 + v, 165 + x), BlockColor(z, y), BF
        IF BlockColor(z, y) = 6 THEN
            IF (z > 1) * (z < 7) * (y > 1) * (y < 7) THEN PSET (90 + v, 90 + x), 3: DRAW "R70D70L70U70D1R69D68L68U69"
        END IF
        PSET (85 + v, 85 + x), 3: DRAW "R80D80L80U80"
        IF PieceColor(z, y) > 0 THEN
            PieceX = 125 + v: PieceY = 125 + x: PieceColor = PlayerColor(PieceColor(z, y)): PieceFlip = 1: GOSUB DrawPiece
        END IF
        BlockX(z, y) = 125 + v: BlockY(z, y) = 125 + x
        v = v + 81
    NEXT
    x = x + 81
NEXT

' Draw Boundries
PSET (83, 83), 6: DRAW "R82U19L101D253L64D100R64D71R19U81R3U78L3U245": PAINT (81, 81), 6
PSET (83, 653), 6: DRAW "U82L19D101R253D64R100U64R71U19L81U3L78D3L245": PAINT (81, 655), 6
PSET (653, 83), 6: DRAW "D82R19U101L253U64L100D64L71D19R81D3R78U3R245": PAINT (655, 81), 6
PSET (653, 653), 6: DRAW "L82D19R101U253R64U100L64U71L19D81L3D78R3D245": PAINT (655, 655), 6

' Draw Piece Storage Wells
LINE (84, 333)-(160, 403), 3, BF: LINE (101, 333)-(142, 403), 4, BF: LINE (107, 333)-(136, 403), 5, BF: LINE (113, 333)-(130, 403), 6, BF: LINE (119, 333)-(124, 403), 7, BF
LINE (333, 84)-(403, 160), 3, BF: LINE (333, 101)-(403, 142), 4, BF: LINE (333, 107)-(403, 136), 5, BF: LINE (333, 113)-(403, 130), 6, BF: LINE (333, 119)-(403, 124), 7, BF
LINE (576, 333)-(652, 403), 3, BF: LINE (593, 333)-(635, 403), 4, BF: LINE (599, 333)-(629, 403), 5, BF: LINE (605, 333)-(623, 403), 6, BF: LINE (611, 333)-(617, 403), 7, BF
LINE (333, 576)-(403, 652), 3, BF: LINE (333, 593)-(403, 635), 4, BF: LINE (333, 599)-(403, 629), 5, BF: LINE (333, 605)-(403, 623), 6, BF: LINE (333, 611)-(403, 617), 7, BF
LINE (180, 180)-(232, 232), 3, BF: PSET (511, 564), 3: DRAW "H15E53F15G53": PAINT (530, 530), 3

'Draw Exits
LINE (40, 488)-(83, 572), 6, B: LINE (41, 489)-(83, 571), 3, BF: LINE (57, 491)-(83, 569), 5, BF
LINE (164, 40)-(248, 83), 6, B: LINE (165, 41)-(247, 83), 3, BF: LINE (167, 57)-(245, 83), 5, BF
LINE (488, 697)-(572, 654), 6, B: LINE (489, 696)-(571, 652), 3, BF: LINE (491, 653)-(569, 680), 5, BF
LINE (653, 164)-(696, 248), 6, B: LINE (653, 165)-(695, 247), 3, BF: LINE (653, 167)-(679, 245), 5, BF

' Draw Board Edges
PSET (64, 316), 6: DRAW "H50U253NF50R253F50": LINE (0, 316)-(14, 266), 6: LINE (316, 0)-(267, 14), 6
PSET (64, 418), 6: DRAW "G50D253NE50R253E50": LINE (0, 418)-(14, 468), 6: LINE (316, 736)-(266, 721), 6
PSET (671, 318), 6: DRAW "E50U253NG50L253G50": LINE (418, 0)-(468, 14), 6: LINE (736, 318)-(721, 267), 6
PSET (418, 671), 6: DRAW "F50R253NH50U253H50": LINE (418, 736)-(468, 721), 6: LINE (736, 418)-(721, 466), 6
PAINT (250, 30), 7, 6: PAINT (300, 30), 5, 6: PAINT (430, 30), 5, 6: PAINT (600, 30), 7, 6
PAINT (50, 150), 5, 6: PAINT (30, 300), 4, 6: PAINT (30, 430), 4, 6: PAINT (50, 650), 4, 6
PAINT (700, 50), 7, 6: PAINT (707, 305), 5, 6: PAINT (707, 440), 5, 6: PAINT (700, 500), 7, 6
PAINT (250, 707), 4, 6: PAINT (300, 707), 4, 6: PAINT (430, 707), 4, 6: PAINT (600, 707), 5, 6

' Draw Inside Board Shadows
PSET (86, 89), 8: DRAW "R75E3L78D3": PAINT (88, 88), 8
PSET (243, 57), 8: DRAW "D31R81D81R81E3L81U81L81U29L3": PAINT (244, 58), 8
PSET (410, 89), 8: DRAW "R237D80R32U3L29U80L240D3": PAINT (411, 88), 8
PSET (650, 249), 8: DRAW "G3D74R3U76G2D74R1U74"
PSET (569, 329), 8: DRAW "G3D81R81D238R3U241L81U81": PAINT (568, 335), 8
PSET (326, 573), 8: DRAW "G3D74R3U76G2D74R1U74"
PSET (86, 413), 8: DRAW "R75E3L78D3": PAINT (88, 412), 8
PSET (570, 654), 8: DRAW "G3D24R3U28": PAINT (569, 665), 8
PSET (83, 490), 8: DRAW "L28D3R24E3": PAINT (77, 491), 8

' Draw Block Shadows
FOR z = 2 TO 6
    FOR y = 2 TO 6
        IF BlockColor(z, y) = 6 THEN
            PSET (BlockX(z, y) - 41, BlockY(z, y) - 40), 8: DRAW BlockShadow$
            PAINT (BlockX(z, y) - 42, BlockY(z, y)), 8
        END IF
    NEXT
NEXT
LINE (BlockX(3, 5) - 40, BlockY(3, 5) - 40)-(BlockX(3, 5) + 40, BlockY(3, 5) + 40), 3, B: PAINT (BlockX(3, 5) + 38, BlockY(3, 5) - 38), 6, 3
LINE (BlockX(6, 2) - 40, BlockY(6, 2) - 40)-(BlockX(6, 2) + 40, BlockY(6, 2) + 40), 3, B: PAINT (BlockX(6, 2) + 38, BlockY(6, 2) - 38), 6, 3

' Draw Logo
PSET (804, 15), 0: DRAW LogoE$: PAINT (810, 20), 0
PSET (859, 15), 0: DRAW LogoX$: PAINT (870, 20), 0
PSET (934, 15), 0: DRAW LogoI$: PAINT (938, 20), 0
PSET (954, 15), 0: DRAW LogoT$: PAINT (960, 20), 0
LINE (783, 34)-(803, 49), 10, BF
x = 0
FOR z = 10 TO 12
    FOR y = 1 TO 20
        LINE (803 - x, 15)-(783 - x, 41), z
        LINE (803 - x, 68)-(783 - x, 41), z
        x = x + 1
    NEXT
NEXT

' Draw Game Option Buttons
COLOR 0, 15
LOCATE 9, 103: PRINT "Standard Play";
LOCATE 13, 102: PRINT "Advanced Option"
LINE (786, 120)-(949, 150), 0, B
LINE (786, 183)-(949, 213), 0, B

GetOptionInput:
DO WHILE _MOUSEINPUT
    MouseX = _MOUSEX
    MouseY = _MOUSEY
    MouseLeftButton = _MOUSEBUTTON(1)
    IF (MouseX > 785) * (MouseX < 950) * (MouseY > 119) * (MouseY < 151) * (MouseLeftButton = -1) THEN GameOption = 1: GOTO EndOption
    IF (MouseX > 785) * (MouseX < 950) * (MouseY > 182) * (MouseY < 214) * (MouseLeftButton = -1) THEN GameOption = 2: GOTO EndOption
LOOP
GOTO GetOptionInput

EndOption:
LINE (786, 120)-(949, 213), 15, BF
LOCATE 23, 102
IF GameOption = 1 THEN PRINT " Standard Play "; ELSE PRINT "Advanced Opttion";

' Draw Player Indicator Block
LINE (806, 95)-(929, 218), 6, BF: LINE (826, 115)-(909, 198), 3, BF: LINE (829, 121)-(903, 196), 5, BF

' Draw Arrow Blocks
LINE (766, 376)-(969, 579), 6, BF: LINE (786, 396)-(949, 559), 3, BF
x = 0
FOR z = 1 TO 2
    v = 0
    FOR y = 1 TO 2
        LINE (788 + v, 398 + x)-(866 + v, 476 + x), 5, BF
        v = v + 81
    NEXT
    x = x + 81
NEXT
PSET (788, 398), 8: DRAW "D4R155D155R4U159L159": PAINT (790, 400), 8

' Draw Dice Block
LINE (839, 261)-(891, 313), 0, BF

' Draw Exit Spaces
LINE (726, 617)-(1006, 721), 7, BF: LINE (731, 622)-(1001, 716), 3, BF
x = 0
FOR z = 1 TO 3
    LINE (739 + x, 630)-(817 + x, 708), 5, BF
    ExitSpaceX(z) = 778 + x: ExitSpaceY = 669
    x = x + 88
NEXT

StartTurn:
Move = 1: ExitTotal = 0: ExitPlayer = 0: ExitOpponant = 0
FOR z = 1 TO 3: ExitPiece(z) = 0: ExitFlip(z) = 0: NEXT

LOCATE 15, 105: PRINT "Player "; Player;

' Draw Player Indicator Piece

CIRCLE (867, 157), 36, PlayerColor(Player): PAINT (867, 157), PlayerColor(Player)
CIRCLE (867, 157), 25, 9,: CIRCLE (872, 152), 28, 9, 2.9, 4.9: PAINT (853, 176), 9

' Roll Dice
FOR z = 1 TO 20
    Dice = INT(RND * 3) + 1
    LINE (850, 272)-(880, 302), 0, BF
    PSET (850, 272), 0: DRAW Dice$(Dice)
    PAINT (865, 287), 15
    _DELAY .1
NEXT

Move:
LOCATE 21, 106: PRINT "Move#"; Move

' Draw Arrows
IF PreviousDirection <> 1 THEN ArrowColor = 15 ELSE ArrowColor = 7
PSET (830, 410), 3: DRAW UpArrow$: PAINT (830, 452), ArrowColor, 3: PAINT (830, 463), 3: PAINT (850, 442), 3
IF PreviousDirection <> 2 THEN ArrowColor = 15 ELSE ArrowColor = 7
PSET (936, 516), 3: DRAW RightArrow$: PAINT (906, 516), ArrowColor, 3: PAINT (904, 536), 3: PAINT (904, 496), 3
IF PreviousDirection <> 3 THEN ArrowColor = 15 ELSE ArrowColor = 7
PSET (802, 516), 3: DRAW LeftArrow$: PAINT (832, 516), ArrowColor, 3: PAINT (807, 526), 3: PAINT (840, 527), 3
IF PreviousDirection <> 4 THEN ArrowColor = 15 ELSE ArrowColor = 7
PSET (909, 462), 3: DRAW DownArrow$: PAINT (909, 423), ArrowColor, 3: PAINT (895, 454), 3: PAINT (897, 423), 3

GetMouseInput:
DO WHILE _MOUSEINPUT
    MouseX = _MOUSEX
    MouseY = _MOUSEY
    MouseLeftButton = _MOUSEBUTTON(1)

    ' Up Arrow
    IF (MouseX > 787) * (MouseX < 867) * (MouseY > 397) * (MouseY < 477) * (MouseLeftButton = -1) THEN
        IF PreviousDirection = 1 THEN GOTO GetMouseInput ELSE PreviousDirection = 1
        IF PieceColor(1, 2) > 0 THEN
            ExitTotal = ExitTotal + 1
            ExitPiece(ExitTotal) = PieceColor(1, 2)
            IF PieceColor(1, 2) = 3 THEN Winner = Player: GOTO Winner
            IF PieceColor(1, 2) = Player THEN ExitPlayer = ExitPlayer + 1 ELSE ExitOpponant = ExitOpponant + 1
            IF (GameOption = 2) * (PieceFlip(1, 2) = 2) * (PieceColor(1, 2) < 3) THEN ExitFlip(ExitTotal) = 1 ELSE ExitFlip(ExitTotal) = 2
            LINE (BlockX(1, 2) - 36, BlockY(1, 2) - 36)-(BlockX(1, 2) + 36, BlockY(1, 2) + 36), 5, BF
            PieceX = ExitSpaceX(ExitTotal)
            PieceY = ExitSpaceY
            PieceColor = PieceColor(1, 2)
            PieceFlip = ExitFlip(ExitTotal)
            GOSUB DrawPiece
            PieceColor(1, 2) = 0
            PieceFlip(1, 2) = 0
        END IF
        FOR z = 2 TO 7
            FOR y = 1 TO 7
                IF (BlockColor(z, y) = 6) + (PieceColor(z, y) = 0) THEN GOTO EndLoop1
                x = AA(z, y)
                Loop1:
                IF x > 0 THEN
                    IF (BlockColor(z - x, y) = 6) + (PieceColor(z - x, y) = 0) THEN
                        PieceColor(z - x, y) = PieceColor(z, y)
                        PieceFlip(z - x, y) = PieceFlip(z, y)
                        LINE (BlockX(z, y) - 36, BlockY(z, y) - 36)-(BlockX(z, y) + 36, BlockY(z, y) + 36), 5, BF
                        PieceX = BlockX(z - x, y)
                        PieceY = BlockY(z - x, y)
                        PieceColor = PlayerColor(PieceColor(z, y))
                        PieceFlip = PieceFlip(z, y)
                        PieceColor(z, y) = 0
                        PieceFlip(z, y) = 0
                        GOSUB DrawPiece
                    ELSE x = x - 1: GOTO Loop1
                    END IF
                END IF
                EndLoop1:
            NEXT
        NEXT
        GOTO EndTurn
    END IF

    ' Right Arrow
    IF (MouseX > 868) * (MouseX < 948) * (MouseY > 478) * (MouseY < 558) * (MouseLeftButton = -1) THEN
        IF PreviousDirection = 2 THEN GOTO GetMouseInput ELSE PreviousDirection = 2
        IF PieceColor(2, 7) > 0 THEN
            ExitTotal = ExitTotal + 1
            ExitPiece(ExitTotal) = PieceColor(2, 7)
            IF PieceColor(2, 7) = 3 THEN Winner = Player: GOTO Winner
            IF PieceColor(2, 7) = Player THEN ExitPlayer = ExitPlayer + 1 ELSE ExitOpponant = ExitOpponant + 1
            IF (GameOption = 2) * (PieceFlip(2, 7) = 2) * (PieceColor(2, 7) < 3) THEN ExitFlip(ExitTotal) = 1 ELSE ExitFlip(ExitTotal) = 2
            LINE (BlockX(2, 7) - 36, BlockY(2, 7) - 36)-(BlockX(2, 7) + 36, BlockY(2, 7) + 36), 5, BF
            PieceX = ExitSpaceX(ExitTotal)
            PieceY = ExitSpaceY
            PieceColor = PieceColor(2, 7)
            PieceFlip = ExitFlip(ExitTotal)
            GOSUB DrawPiece
            PieceColor(2, 7) = 0
            PieceFlip(2, 7) = 0
        END IF
        FOR z = 6 TO 1 STEP -1
            FOR y = 1 TO 7
                IF (BlockColor(y, z) = 6) + (PieceColor(y, z) = 0) THEN GOTO EndLoop2
                x = AB(y, z)
                Loop2:
                IF x > 0 THEN
                    IF PieceColor(y, z + x) = 0 THEN
                        PieceColor(y, z + x) = PieceColor(y, z)
                        PieceFlip(y, z + x) = PieceFlip(y, z)
                        LINE (BlockX(y, z) - 36, BlockY(y, z) - 36)-(BlockX(y, z) + 36, BlockY(y, z) + 36), 5, BF
                        PieceX = BlockX(y, z + x)
                        PieceY = BlockY(y, z + x)
                        PieceColor = PlayerColor(PieceColor(y, z + x))
                        PieceFlip = PieceFlip(y, z + x)
                        PieceColor(y, z) = 0
                        PieceFlip(y, z) = 0
                        GOSUB DrawPiece
                    ELSE x = x - 1: GOTO Loop2
                    END IF
                END IF
                EndLoop2:
            NEXT
        NEXT
        GOTO EndTurn
    END IF

    ' Left Arrow
    IF (MouseX > 787) * (MouseX < 867) * (MouseY > 478) * (MouseY < 558) * (MouseLeftButton = -1) THEN
        IF PreviousDirection = 3 THEN GOTO GetMouseInput ELSE PreviousDirection = 3
        IF PieceColor(6, 1) > 0 THEN
            ExitTotal = ExitTotal + 1
            ExitPiece(ExitTotal) = PieceColor(6, 1)
            IF PieceColor(6, 1) = 3 THEN Winner = Player: GOTO Winner
            IF PieceColor(6, 1) = Player THEN ExitPlayer = ExitPlayer + 1 ELSE ExitOpponant = ExitOpponant + 1
            IF (GameOption = 2) * (PieceFlip(6, 1) = 2) * (PieceColor(6, 1) < 3) THEN ExitFlip(ExitTotal) = 1 ELSE ExitFlip(ExitTotal) = 2
            LINE (BlockX(6, 1) - 36, BlockY(6, 1) - 36)-(BlockX(6, 1) + 36, BlockY(6, 1) + 36), 5, BF
            PieceX = ExitSpaceX(ExitTotal)
            PieceY = ExitSpaceY
            PieceColor = PieceColor(6, 1)
            PieceFlip = ExitFlip(ExitTotal)
            GOSUB DrawPiece
            PieceColor(6, 1) = 0
            PieceFlip(6, 1) = 0
        END IF
        FOR z = 2 TO 7
            FOR y = 1 TO 7
                IF (BlockColor(y, z) = 6) + (PieceColor(y, z) = 0) THEN GOTO EndLoop3
                x = AC(y, z)
                Loop3:
                IF x > 0 THEN
                    IF PieceColor(y, z - x) = 0 THEN
                        PieceColor(y, z - x) = PieceColor(y, z)
                        PieceFlip(y, z - x) = PieceFlip(y, z)
                        LINE (BlockX(y, z) - 36, BlockY(y, z) - 36)-(BlockX(y, z) + 36, BlockY(y, z) + 36), 5, BF
                        PieceX = BlockX(y, z - x)
                        PieceY = BlockY(y, z - x)
                        PieceColor = PlayerColor(PieceColor(y, z - x))
                        PieceFlip = PieceFlip(y, z - x)
                        PieceColor(y, z) = 0
                        PieceFlip(y, z) = 0
                        GOSUB DrawPiece
                    ELSE x = x - 1: GOTO Loop3
                    END IF
                END IF
                EndLoop3:
            NEXT
        NEXT
        GOTO EndTurn
    END IF

    ' Down Arrow
    IF (MouseX > 868) * (MouseX < 948) * (MouseY > 397) * (MouseY < 477) * (MouseLeftButton = -1) THEN
        IF PreviousDirection = 4 THEN GOTO GetMouseInput ELSE PreviousDirection = 4
        IF PieceColor(7, 6) > 0 THEN
            ExitTotal = ExitTotal + 1
            ExitPiece(ExitTotal) = PieceColor(7, 6)
            IF PieceColor(7, 6) = 3 THEN Winner = Player: GOTO Winner
            IF PieceColor(7, 6) = Player THEN ExitPlayer = ExitPlayer + 1 ELSE ExitOpponant = ExitOpponant + 1
            IF (GameOption = 2) * (PieceFlip(7, 6) = 2) * (PieceColor(7, 6) < 3) THEN ExitFlip(ExitTotal) = 1 ELSE ExitFlip(ExitTotal) = 2
            LINE (BlockX(7, 6) - 36, BlockY(7, 6) - 36)-(BlockX(7, 6) + 36, BlockY(7, 6) + 36), 5, BF
            PieceX = ExitSpaceX(ExitTotal)
            PieceY = ExitSpaceY
            PieceColor = PieceColor(7, 6)
            PieceFlip = ExitFlip(ExitTotal)
            GOSUB DrawPiece
            PieceColor(7, 6) = 0
            PieceFlip(7, 6) = 0
        END IF
        FOR z = 6 TO 1 STEP -1
            FOR y = 1 TO 7
                IF (BlockColor(z, y) = 6) + (PieceColor(z, y) = 0) THEN GOTO EndLoop4
                x = AD(z, y)
                Loop4:
                IF x > 0 THEN
                    IF PieceColor(z + x, y) = 0 THEN
                        PieceColor(z + x, y) = PieceColor(z, y)
                        PieceFlip(z + x, y) = PieceFlip(z, y)
                        LINE (BlockX(z, y) - 36, BlockY(z, y) - 36)-(BlockX(z, y) + 36, BlockY(z, y) + 36), 5, BF
                        PieceX = BlockX(z + x, y)
                        PieceY = BlockY(z + x, y)
                        PieceColor = PlayerColor(PieceColor(z + x, y))
                        PieceFlip = PieceFlip(z + x, y)
                        PieceColor(z, y) = 0
                        PieceFlip(z, y) = 0
                        GOSUB DrawPiece
                    ELSE x = x - 1: GOTO Loop4
                    END IF
                END IF
                EndLoop4:
            NEXT
        NEXT
        GOTO EndTurn
    END IF
LOOP
GOTO GetMouseInput

EndTurn:
IF Winner = 3 THEN GOTO Winner

IF Move < Dice THEN Move = Move + 1: GOTO Move

ExitPieces:
IF ExitTotal > 0 THEN
    FOR z = 1 TO ExitTotal
        IF (ExitOpponant > 0) * (ExitPiece(z) = Opponant) THEN Space = z: GOSUB PlaceExitPiece
        IF (ExitOpponant = 0) * (ExitPlayer > 0) * (ExitPiece(z) = Player) THEN Space = z: GOSUB PlaceExitPiece
    NEXT
ELSE GOTO CheckWinner
END IF
GOTO ExitPieces

CheckWinner:
PieceCount(1) = 0: PieceCount(2) = 0
FOR z = 1 TO 7
    FOR y = 1 TO 7
        IF (PieceColor > 0) * (PieceFlip(z, y) = 2) THEN
            PieceCount(PieceColor(z, y)) = PieceCount(PieceColor(z, y)) + 1
        END IF
    NEXT
NEXT
IF PieceCount(1) = 6 THEN Winner = 1
IF PieceCount(2) = 6 THEN Winner = 2
IF Winner > 0 THEN GOTO Winner

SWAP Player, Opponant

GOTO StartTurn

Winner:
IF Winner = 3 THEN Winner = Player
LINE (726, 617)-(1006, 721), 15, BF
LOCATE 43, 98: PRINT "Player"; Winner; "is the Winner!!";
LOCATE 45, 96: PRINT "Play Another Game? ( Y / N )";

PLAYAGAIN:
a$ = UCASE$(INKEY$)
IF a$ = "" THEN GOTO PLAYAGAIN
IF a$ = "Y" THEN RUN
IF a$ = "N" THEN END
GOTO PLAYAGAIN

DrawPiece:
CIRCLE (PieceX, PieceY), 36, PieceColor: PAINT (PieceX, PieceY), PieceColor
CIRCLE (PieceX, PieceY), 25, 9,: CIRCLE (PieceX + 6, PieceY - 6), 28, 9, 2.9, 4.9: PAINT (PieceX - 15, PieceY + 15), 9
IF PieceFlip = 2 THEN CIRCLE (PieceX, PieceY), 20, 3: PAINT (PieceX, PieceY), 3
RETURN

PlaceExitPiece:
PieceColor = ExitPiece(Space)
LOCATE 15, 105: PRINT "Player "; PieceColor;
PieceX = 867: PieceY = 157: PieceFlip = 1: GOSUB DrawPiece
PieceFlip = ExitFlip(Space)
LOCATE 38, 92: PRINT "Player"; PieceColor; "Place a Piece on the Board";
LINE (ExitSpaceX(Space) - 39, ExitSpaceY - 39)-(ExitSpaceX(Space) + 39, ExitSpaceY + 39), 15, B
GetExitInput:
DO WHILE _MOUSEINPUT
    MouseX = _MOUSEX
    MouseY = _MOUSEY
    MouseLeftButton = _MOUSEBUTTON(1)
    FOR z1 = 1 TO 7
        FOR y1 = 1 TO 7
            IF (MouseX > BlockX(z1, y1) - 39) * (MouseX < BlockX(z1, y1) + 39) * (MouseY > BlockY(z1, y1) - 39) * (MouseY < BlockY(z1, y1) + 39) * (MouseLeftButton = -1) * (BlockColor(z1, y1) = 5) * (PieceColor(z1, y1) = 0) THEN
                LINE (ExitSpaceX(Space) - 39, ExitSpaceY - 39)-(ExitSpaceX(Space) + 39, ExitSpaceY + 39), 5, BF
                LOCATE 38, 92: PRINT SPACE$(35);
                PieceColor(z1, y1) = PieceColor
                PieceFlip(z1, y1) = PieceFlip
                PieceX = BlockX(z1, y1)
                PieceY = BlockY(z1, y1)
                GOSUB DrawPiece
                ExitPiece(Space) = 0
                ExitFlip(Space) = 0
                ExitTotal = ExitTotal - 1
                IF PieceColor = Player THEN ExitPlayer = ExitPlayer - 1 ELSE ExitOpponant = ExitOpponant - 1
                RETURN
            END IF
        NEXT
    NEXT
LOOP
GOTO GetExitInput
[attachment=351]