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

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



Input Board Game in QB64 - Donald Foster - 11-06-2014 03:30 PM

Hello everyone,

I’ve completed writing Input Board Game in QB64. I originally wrote it over 25 years ago on the Tandy 2000 with Keyboard Input. This version I attempted to use Mouse Input. So, this the first Mouse Input game I ever made. I have Included a B&W copy of the Rules of the game I got from the Internet. I’ll make a Color scan and upload it later. I’ll also include a photo of the actual board game.

The Instructions button is not working properly at this time, but I’ve included a scan.

All comments are welcome. Hope you enjoy playing the game!


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


SCREEN _NEWIMAGE(1010, 734, 256)

_PALETTECOLOR 1, _RGB32(255, 0, 0) '     Red
_PALETTECOLOR 2, _RGB32(0, 0, 255) '     Blue
_PALETTECOLOR 3, _RGB32(240, 225, 195) ' Moccasin
_PALETTECOLOR 4, _RGB32(130, 130, 130) ' Grey
_PALETTECOLOR 5, _RGB32(254, 254, 254) ' White
_PALETTECOLOR 6, _RGB32(160, 82, 45) '   Sienna
_PALETTECOLOR 7, _RGB32(210, 180, 140)
_PALETTECOLOR 8, _RGB32(244, 164, 96)

CLEAR

DIM PlayingSpace(12), PlayingSpaceX(12), PlayingSpaceY(12), PlayingSpacePlayer(12), PlayingSpacePiece(12), PlayingSpacePosition(12), NextSpace(12), Piece(12), Position(12)
DIM a(12), b(12), LastMove(12), FirsPosition(12)

LINE (0, 0)-(1010, 734), 0, BF

Cursor$ = "R114D114L114U114D1R113D112L112U111R111D110L110U110"
Player = 1: Opponant = 2
PieceCount(1) = 6: PieceCount(2) = 6
StorageBin(1) = 0: StorageBin(2) = 0

DATA 1,7,11,9,6,1,4,10,9,5,2,4,8,12,5,2,7,8,12,6,3,5,7,11,6,3,4,10,8,9
DATA 12,6,2,4,7,12,9,3,4,8,11,9,5,1,8,11,6,5,1,7,10,8,6,2,7,10,9,3,5,4
FOR z = 1 TO 2: FOR y = 1 TO 6: FOR x = 1 TO 5: READ PiecePattern(z, y, x): NEXT: NEXT: NEXT
FOR z = 1 TO 2: FOR y = 1 TO 6: RackSpacePlayed(z, y) = 0: NEXT: NEXT

' Draw Game Board
LINE (0, 0)-(1010, 688), 3, BF
PSET (252, 155), 7: DRAW "R505D377L505U377D1R504D375L503U375"

' Draw INPUT Emblem
FOR z = 1 TO 14
    LINE (838 + z, 691)-(823 + z, 731), 15
    LINE (854 + z, 691)-(839 + z, 731), 15
    LINE (876 + z, 691)-(861 + z, 731), 15
    LINE (892 + z, 691)-(877 + z, 731), 15
    LINE (914 + z, 691)-(899 + z, 731), 15
    LINE (930 + z, 691)-(915 + z, 731), 15
    LINE (952 + z, 691)-(937 + z, 731), 15
    LINE (977 + z, 696)-(962 + z, 731), 15
NEXT
FOR z = 1 TO 33
    LINE (968 + z, 691)-(964 + z, 702), 15
NEXT
LINE (930, 720)-(942, 731), 15, BF
LINE (860, 691)-(877, 702), 15, BF
LINE (898, 691)-(915, 702), 15, BF
CIRCLE (875, 702), 12, 0, 0, 1.5
PAINT (887, 692), 0
CIRCLE (932, 720), 12, 0, 3.0, 4.5
PAINT (921, 729), 0
LINE (895, 708)-(916, 719), 15, BF
CIRCLE (908, 705), 15, 0, 4.5, 1.5
PAINT (924, 692), 0
PAINT (910, 725), 0
PAINT (919, 717), 0
PAINT (919, 716), 0
PSET (904, 719), 15

' Draw Buttons
LOCATE 45, 18: PRINT "Instructions       Start New Game        EXIT  Game";

' Draw Storage Bin
x = 0
FOR z = 1 TO 3
    LINE (272, 32)-(272, 118), 7: LINE (287, 18)-(595, 18), 7: LINE (606, 32)-(606, 119), 7: LINE (285, 134)-(595, 134), 7
    CIRCLE (287, 33), 15, 7, 1.5, 3.0: CIRCLE (287, 119), 15, 7, 3.0, 4.7: CIRCLE (591, 33), 15, 7, 0, 1.5: CIRCLE (591, 119), 15, 7, 4.5, 0
    CIRCLE (591, 33), 8, 7, 0, 1.7: LINE (275, 25)-(591, 25), 7: LINE (599, 33)-(599, 131), 7: PAINT (601, 50), 7

    LINE (736, 567)-(736, 655), 7: LINE (417, 553)-(721, 553), 7: LINE (416, 669)-(721, 669), 7: LINE (402, 567)-(402, 655), 7
    CIRCLE (721, 568), 15, 7, 0, 1.7: CIRCLE (721, 654), 15, 7, 4.7, 0: CIRCLE (417, 568), 15, 7, 1.5, 3.2: CIRCLE (417, 654), 15, 7, 3.0, 4.7
    CIRCLE (721, 568), 8, 7, 0, 1.7: LINE (405, 560)-(721, 560), 7: LINE (729, 568)-(729, 665), 7: PAINT (731, 575), 7

    StorageBinX(1, z) = 678 - x: StorageBinY(1) = 611
    StorageBinX(2, z) = 330 + x: StorageBinY(2) = 76
    x = x + 109
NEXT


' Draw Rack Space
x = 0
FOR z = 1 TO 6
    RackSpaceY(1, z) = 59 + x: RackSpaceY(2, z) = 629 - x
    a = 58: b = RackSpaceY(1, z): C = 1: D = z: GOSUB DrawPiece
    a = 952: b = RackSpaceY(2, z): C = 2: D = z: GOSUB DrawPiece
    x = x + 114
NEXT
RackSpaceX(1) = 59: RackSpaceX(2) = 951

' Draw Playing Space
x = 0: v = 1
FOR z = 1 TO 4
    w = 0
    FOR y = 1 TO 3
        PlayingSpaceX(v) = 311 + x: PlayingSpaceY(v) = 214 + w
        a = 311 + x: b = 214 + w
        GOSUB DrawEmptySpace
        IF z = 1 THEN CIRCLE (311 + x, 214 + w), 13, 1: PAINT (311 + x, 214 + w), 1
        IF z = 4 THEN CIRCLE (311 + x, 214 + w), 13, 2: PAINT (311 + x, 214 + w), 2
        w = w + 129: v = v + 1
    NEXT
    x = x + 129
NEXT

' Draw Entering Space
x = 0: FOR z = 1 TO 3: EnteringSpaceX(1, z) = 311 - x: EnteringSpaceX(2, z) = 698 + x: x = x + 30: NEXT
EnteringSpaceY(1) = 611: EnteringSpaceY(2) = 76
a = 311: b = 611: GOSUB DrawEmptySpace
a = 698: b = 76: GOSUB DrawEmptySpace

x = 0
FOR z = 1 TO 33
    CIRCLE (170, 35 + x), 4, 7, 1.5, 4.5: CIRCLE (230, 35 + x), 4, 7, 4.5, 1.5
    LINE (169, 31 + x)-(231, 31 + x), 7: LINE (169, 39 + x)-(231, 39 + x), 7
    PSET (166, 37 + x), 7: DRAW "E4R63": PAINT (180, 32 + x), 7
    CIRCLE (780, 202 + x), 4, 7, 1.5, 4.5: CIRCLE (840, 202 + x), 4, 7, 4.5, 1.5
    LINE (779, 198 + x)-(841, 198 + x), 7: LINE (779, 206 + x)-(841, 206 + x), 7
    PSET (776, 204 + x), 7: DRAW "E4R63": PAINT (790, 199 + x), 7
    x = x + 14
NEXT
LINE (240, 0)-(248, 530), 7, BF: LINE (119, 524)-(248, 532), 7, BF: LINE (119, 0)-(160, 523), 7, BF
LINE (761, 158)-(769, 688), 7, BF: LINE (761, 155)-(891, 163), 7, BF: LINE (850, 164)-(891, 688), 7, BF

StartGame:
LOCATE 45, 3: PRINT "Player"; Player;
x = 0: v = 14
FOR z = 1 TO 14
    FOR y = 1 TO v
        LINE (837 - y - x, 691)-(822 - y - x, 731), Player
    NEXT
    x = x + 16: v = v - 1
NEXT

' Draw Buttons
x = 0: FOR z = 1 TO 3: LINE (115 + x, 696)-(253 + x, 726), Player, B: x = x + 160: NEXT

EnteringSpaceCounter(1) = 0: EnteringSpaceCounter(2) = 0
PlayerColor(1) = 1: PlayerColor(2) = 2
FOR z = 1 TO 2: FOR y = 1 TO 6: RackSpacePiece(z, y) = z: NEXT: NEXT
FOR z = 1 TO 2: FOR y = 1 TO 3: EnteringSpacePiece(z, y) = 0: NEXT: NEXT
FOR z = 1 TO 12: NextSpace(z) = 0: NEXT

MouseInput:
RackPiece = 0: Space = 0: NextSpace = 0: Piece = 0: Position = 0: Position = 0: EndGame = 0: CanPlay = 0

DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)

    ' Check Rack Space Condition
    FOR z = 1 TO 6
        a1 = RackSpaceX(Player) - 54: a2 = RackSpaceX(Player) + 54: a3 = RackSpaceY(Player, z) - 54: a4 = RackSpaceY(Player, z) + 54
        IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) * (EnteringSpaceCount(Player) < 3) * (RackSpacePlayed(Player, z) = 0) THEN
            RackPiece = z
        END IF
    NEXT

    ' Check Rack Space Mouse Click
    IF (mouseLeftButton = -1) * (RackPiece > 0) * (RackSpacePlayed(Player, RackPiece) = 0) THEN
        LINE (RackSpaceX(Player) - 54, RackSpaceY(Player, RackPiece) - 54)-(RackSpaceX(Player) + 54, RackSpaceY(Player, RackPiece) + 54), 3, BF
        EnteringSpaceCount(Player) = EnteringSpaceCount(Player) + 1
        EnteringSpace(Player, EnteringSpaceCount(Player)) = RackPiece
        RackSpacePlayed(Player, RackPiece) = 1
        a = EnteringSpaceX(Player, EnteringSpaceCount(Player)): b = EnteringSpaceY(Player): C = Player: D = RackPiece: GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    ' Check Entering Space Condition
    a1 = EnteringSpaceX(Player, EnteringSpaceCount(Player)) - 54: a2 = EnteringSpaceX(Player, EnteringSpaceCount(Player)) + 54
    a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
    IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN
        Piece = EnteringSpace(Player, EnteringSpaceCount(Player))
        Position = PiecePattern(Player, Piece, 1)
    END IF

    ' Check Entering Space Mouse Click
    IF (mouseLeftButton = -1) * (PlayingSpacePlayer(Position) <> Player) * (Position > 0) THEN
        IF PlayingSpacePlayer(Position) = Opponant THEN D = PlayingSpacePiece(Position): GOSUB PlacePieceinStorageBin
        PlayingSpacePiece(Position) = Piece
        PlayingSpacePlayer(Position) = Player
        PlayingSpacePosition(Position) = 1
        EnteringSpace(Player, EnteringSpaceCount(Player)) = 0
        EnteringSpaceCount(Player) = EnteringSpaceCount(Player) - 1
        GOSUB RemoveEnteringSpacePieces
        a = PlayingSpaceX(Position): b = PlayingSpaceY(Position): C = Player: D = Piece: GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    ' Get Playing Space Piece Information
    FOR z = 1 TO 12
        IF (mouseX >= PlayingSpaceX(z) - 54) * (mouseX <= PlayingSpaceX(z) + 54) * (mouseY >= PlayingSpaceY(z) - 54) * (mouseY <= PlayingSpaceY(z) + 54) * (PlayingSpacePlayer(z) = Player) THEN
            Space = z
            Piece(z) = PlayingSpacePiece(z)
            Position(z) = PlayingSpacePosition(z)
            IF Position(z) = 5 THEN LastMove(z) = 1 ELSE LastMove(z) = 0
            IF (Position(z) < 5) * (PlayingSpacePlayer(PiecePattern(Player, Piece(z), Position(z) + 1)) <> Player) THEN
                NextSpace(z) = PiecePattern(Player, Piece(z), Position(z) + 1)
                CanPlay=1
            END IF
        END IF
    NEXT

    ' Check Playing Space Mouse Click
    IF (mouseLeftButton = -1) * (PlayingSpacePlayer(Space) = Player)*(CanPlay=1) THEN
        Piece = PlayingSpacePiece(Space)
        Position = PlayingSpacePosition(Space)
        NextSpace = PiecePattern(Player, Piece, Position + 1)
        IF LastMove(Space) = 1 THEN
            Piece = PlayingSpacePiece(Space)
            PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), Player: DRAW Cursor$
            IF PlayingSpacePlayer(PiecePattern(Player, Piece, 1)) <> Player THEN
                PSET (PlayingSpaceX(PiecePattern(Player, Piece, 1)) - 57, PlayingSpaceY(PiecePattern(Player, Piece, 1)) - 57), Player: DRAW Cursor$
                FirstPosition = PiecePattern(Player, Piece, 1)
            ELSE FirstPosition = 0
            END IF
            GOTO LastMoveMouseClick
        END IF

        IF PlayingSpacePlayer(NextSpace) <> Player THEN
            IF PlayingSpacePlayer(NextSpace) = Opponant THEN
                D = PlayingSpacePiece(NextSpace)
                GOSUB PlacePieceinStorageBin
            END IF
            PlayingSpacePlayer(NextSpace) = Player
            PlayingSpacePiece(NextSpace) = Piece
            PlayingSpacePosition(NextSpace) = Position + 1
            a = PlayingSpaceX(Space): b = PlayingSpaceY(Space): GOSUB DrawEmptySpace
            PlayingSpacePlayer(Space) = 0
            PlayingSpacePiece(Space) = 0
            PlayingSpacePosition(Space) = 0
            a = PlayingSpaceX(NextSpace): b = PlayingSpaceY(NextSpace): C = Player: D = Piece: GOSUB DrawPiece
            GOTO EndofTurn
        END IF
    END IF

    ' Show Entering Space Pieces
    FOR z = 1 TO EnteringSpaceCount(Player) - 1
        IF Player = 1 THEN a1 = EnteringSpaceX(Player, z) + 24: a2 = EnteringSpaceX(Player, z) + 54: a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
        IF Player = 2 THEN a1 = EnteringSpaceX(Player, z) - 24: a2 = EnteringSpaceX(Player, z) - 54: a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
        IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN Choice = z
    NEXT

    ' Show Entering Space Pieces Mouse Click
    IF (mouseLeftButton = -1) * (Choice > 0) THEN
        IF EnteringSpaceCount(Player) > 1 THEN ShowPiece(Player, 1) = 1 ELSE ShowPiece(Player, 1) = 0
        IF EnteringSpaceCount(Player) > 2 THEN ShowPiece(Player, 2) = 1 ELSE ShowPiece(Player, 2) = 0
        ButtonRelease = 0
        GOSUB ShowEnteringSpacePieces
    END IF

    ' Instruction Button
    IF (mouseLeftButton = -1) * (mouseX > 114) * (mouseX < 254) * (mouseY > 695) * (mouseY < 725) THEN
        GOSUB InstructionButton

    END IF

    ' New Game Button
    IF (mouseLeftButton = -1) * (mouseX > 274) * (mouseX < 414) * (mouseY > 695) * (mouseY < 725) THEN
        EndGame = 1
        GOTO EndGameButton
    END IF

    ' EXIT Game Button
    IF (mouseLeftButton = -1) * (mouseX > 434) * (mouseX < 574) * (mouseY > 695) * (mouseY < 725) THEN
        EndGame = 2
        GOTO EndGameButton
    END IF

LOOP
GOTO MouseInput

EndofTurn:
IF StorageBin(Opponant) = 6 THEN

[size=small][font=Monaco, Consolas, Courier, monospace]    LINE (114, 696)-(573, 726), 0, BF[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LOCATE 45, 12: PRINT "is the Winner! Play another Game?   Yes       No";[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LINE (363, 696)-(413, 726), Player, B: LINE (437, 696)-(489, 726), Player, B[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    AnotherGameInput:[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    DO WHILE _MOUSEINPUT[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseX = _MOUSEX[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseY = _MOUSEY[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseLeftButton = _MOUSEBUTTON(1)[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        IF (mouseLeftButton = -1) * (mouseX > 362) * (mouseX < 414) * (mouseY > 695) * (mouseY < 727) THEN RUN[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        IF (mouseLeftButton = -1) * (mouseX > 436) * (mouseX < 490) * (mouseY > 695) * (mouseY < 727) THEN END[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LOOP[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    GOTO AnotherGameInput[/font][/size]
[size=small]END IF[/size]
SWAP Player, Opponant
GOTO StartGame

SLEEP

DrawPiece:
LINE (a - 53, b - 41)-(a - 53, b + 41), 6: LINE (a + 53, b - 41)-(a + 53, b + 41), 6: LINE (a - 41, b - 53)-(a + 41, b - 53), 6: LINE (a - 41, b + 53)-(a + 41, b + 53), 6
CIRCLE (a + 41, b - 41), 12, 6, 0, 1.6: CIRCLE (a - 41, b - 41), 12, 6, 1.5, 3.0: CIRCLE (a - 41, b + 41), 12, 6, 3.0, 4.8: CIRCLE (a + 41, b + 41), 12, 6, 4.6, 0
PAINT (a, b), 6
LINE (a - 53, b - 41)-(a - 53, b + 41), 4: LINE (a + 53, b - 41)-(a + 53, b + 41), 4: LINE (a - 41, b - 53)-(a + 41, b - 53), 4: LINE (a - 41, b + 53)-(a + 41, b + 53), 4
CIRCLE (a + 41, b - 41), 12, 4, 0, 1.6: CIRCLE (a - 41, b - 41), 12, 4, 1.5, 3.0: CIRCLE (a - 41, b + 41), 12, 4, 3.0, 4.8: CIRCLE (a + 41, b + 41), 12, 4, 4.6, 0
PAINT (a, b), 4
LINE (a - 50, b - 37)-(a - 50, b + 37), 0: LINE (a + 50, b - 37)-(a + 50, b + 37), 0: LINE (a - 38, b - 46)-(a + 38, b - 46), 0: LINE (a - 38, b + 46)-(a + 38, b + 46), 0
CIRCLE (a + 40, b - 36), 10, 0, 0, 1.6: CIRCLE (a - 40, b - 36), 10, 0, 1.5, 3.0: CIRCLE (a - 40, b + 36), 10, 0, 3.0, 4.8: CIRCLE (a + 40, b + 36), 10, 0, 4.7, 0
PAINT (a, b), 0
x1 = 0: v1 = 1
FOR z1 = 1 TO 4
    w1 = 0
    FOR y1 = 1 TO 3
        LINE (a - 47 + x1, b - 35 + w1)-(a - 25 + x1, b - 13 + w1), C, BF
        a(v1) = a - 36 + x1: b(v1) = b - 24 + w1
        FOR u1 = 1 TO 5
            IF PiecePattern(C, D, u1) = v1 THEN CIRCLE (a(v1), b(v1)), 7, 15: IF u1 > 1 THEN PAINT (a(v1), b(v1)), 15
        NEXT
        w1 = w1 + 24: v1 = v1 + 1
    NEXT
    x1 = x1 + 24
NEXT
LINE (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1)))-(a(PiecePattern(C, D, 2)), b(PiecePattern(C, D, 2))), 15
LINE (a(PiecePattern(C, D, 2)), b(PiecePattern(C, D, 2)))-(a(PiecePattern(C, D, 3)), b(PiecePattern(C, D, 3))), 15
LINE (a(PiecePattern(C, D, 3)), b(PiecePattern(C, D, 3)))-(a(PiecePattern(C, D, 4)), b(PiecePattern(C, D, 4))), 15
LINE (a(PiecePattern(C, D, 4)), b(PiecePattern(C, D, 4)))-(a(PiecePattern(C, D, 5)), b(PiecePattern(C, D, 5))), 15
CIRCLE (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1))), 7, 5
PAINT (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1))), C, 5
RETURN

DrawEmptySpace:
LINE (a - 54, b - 54)-(a + 54, b + 54), 3, BF
LINE (a - 39, b - 48)-(a + 39, b + 48), 7, B
PSET (a + 32, b + 48), 7: DRAW "U93L67H3L1C15D95R6U89H6"
PAINT (a - 36, b), 15: PAINT (a + 36, b), 7
IF (Space > 0) * (Space < 4) THEN CIRCLE (a, b), 13, 1: PAINT (a, b), 1
IF (Space > 9) * (Space < 13) THEN CIRCLE (a, b), 13, 2: PAINT (a, b), 2
RETURN

RemoveEnteringSpacePieces:
IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
IF (Player = 1) * (EnteringSpaceCount(1) = 0) THEN a = 311: b = 611: GOSUB DrawEmptySpace
IF (Player = 2) * (EnteringSpaceCount(2) = 0) THEN a = 698: b = 76: GOSUB DrawEmptySpace
IF (EnteringSpaceCount(Player) > 0) THEN
    FOR z = 1 TO EnteringSpaceCount(Player)
        a = EnteringSpaceX(Player, z)
        b = EnteringSpaceY(Player)
        C = Player
        D = EnteringSpace(Player, z)
        GOSUB DrawPiece
    NEXT
END IF
RETURN

PlacePieceinStorageBin:
PieceCount(Opponant) = PieceCount(Opponant) - 1
StorageBin(Opponant) = StorageBin(Opponant) + 1
IF StorageBin(Opponant) > 3 THEN BinLocation = StorageBin(Opponant) - 3 ELSE BinLocation = StorageBin(Opponant)
a = StorageBinX(Opponant, BinLocation)
b = StorageBinY(Opponant)
C = Opponant
GOSUB DrawPiece

RETURN

LastMoveMouseClick:
DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)

    a1 = RackSpaceX(Player) - 54: a2 = RackSpaceX(Player) + 54: a3 = RackSpaceY(Player, Piece) - 54: a4 = RackSpaceY(Player, Piece) + 54
    IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN RackPiece = Piece ELSE RackPiece = 0

    IF (mouseLeftButton = -1) * (RackPiece > 0) THEN
        FirstPosition = PiecePattern(Player, Piece, 1)
        PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), 3: DRAW Cursor$
        PSET (PlayingSpaceX(FirstPosition) - 57, PlayingSpaceY(FirstPosition) - 57), 3: DRAW Cursor$
        PlayingSpacePlayer(Space) = 0
        PlayingSpacePiece(Space) = 0
        PlayingSpacePosition(Space) = 0
        a = PlayingSpaceX(Space): b = PlayingSpaceY(Space)
        GOSUB DrawEmptySpace
        RackSpacePlayed(Player, RackPiece) = 0
        a = RackSpaceX(Player): b = RackSpaceY(Player, Piece): C = Player: D = Piece
        GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    z = FirstPosition
    IF (mouseX >= PlayingSpaceX(z) - 54) * (mouseX <= PlayingSpaceX(z) + 54) * (mouseY >= PlayingSpaceY(z) - 54) * (mouseY <= PlayingSpaceY(z) + 54) THEN Selected = 1 ELSE Selected = 0

    IF (mouseLeftButton = -1) * (Selected = 1) THEN
        IF PlayingSpacePlayer(FirstPosition) = Opponant THEN
            D = PlayingSpacePiece(FirstPosition)
            GOSUB PlacePieceinStorageBin
        END IF
        PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), 3: DRAW Cursor$
        PlayingSpacePlayer(Space) = 0
        PlayingSpacePiece(Space) = 0
        PlayingSpacePosition(Space) = 0
        a = PlayingSpaceX(Space): b = PlayingSpaceY(Space)
        FirstPosition = PiecePattern(Player, Piece, 1): GOSUB DrawEmptySpace
        PlayingSpacePlayer(FirstPosition) = Player
        PlayingSpacePiece(FirstPosition) = Piece
        PlayingSpacePosition(FirstPosition) = 1
        a = PlayingSpaceX(FirstPosition): b = PlayingSpaceY(FirstPosition): C = Player: D = Piece: GOSUB DrawPiece
        PSET (PlayingSpaceX(FirstPosition) - 57, PlayingSpaceY(FirstPosition) - 57), 3: DRAW Cursor$
        GOTO EndofTurn
    END IF
LOOP
GOTO LastMoveMouseClick


ShowEnteringSpacePieces:
IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
FOR z = 1 TO Choice
    a = EnteringSpaceX(Player, z)
    b = EnteringSpaceY(Player)
    C = Player
    D = EnteringSpace(Player, z)
    GOSUB DrawPiece
NEXT

MouseButtonRelease:
DO WHILE _MOUSEINPUT
    mouseLeftButton = _MOUSEBUTTON(1)
    IF mouseLeftButton = 0 THEN
        IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
        IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
        FOR z = 1 TO EnteringSpaceCount(Player)
            a = EnteringSpaceX(Player, z)
            b = EnteringSpaceY(Player)
            C = Player
            D = EnteringSpace(Player, z)
            GOSUB DrawPiece
        NEXT
        Choice = 0
        RETURN
    END IF
LOOP
GOTO MouseButtonRelease

InstructionButton:
SHELL "Inside Moves Board Game Rules.pdf"
RETURN

EndGameButton:
LINE (114, 696)-(573, 726), 0, BF
LOCATE 45, 27: PRINT "End This Game?       Yes       No";
LINE (363, 696)-(413, 726), Player, B: LINE (437, 696)-(489, 726), Player, B
GetButtonInput:
DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)
    IF (mouseLeftButton = -1) * (mouseX > 362) * (mouseX < 414) * (mouseY > 695) * (mouseY < 727) THEN
        IF EndGame = 1 THEN RUN ELSE END
    END IF
    IF (mouseLeftButton = -1) * (mouseX > 436) * (mouseX < 490) * (mouseY > 695) * (mouseY < 727) THEN
        LINE (114, 696)-(573, 726), 0, BF
        LOCATE 45, 18: PRINT "Instructions       Start New Game        EXIT  Game";
        x = 0: FOR z = 1 TO 3: LINE (115 + x, 696)-(253 + x, 726), Player, B: x = x + 160: NEXT
        GOTO MouseInput
    END IF
LOOP
GOTO GetButtonInput
Donald
[attachment=298][attachment=299][attachment=300][attachment=301][attachment=298][attachment=303][attachment=304][attachment=305][attachment=306]