11-24-2023, 01:59 AM
Dice Poker Board Game Rules.pdf (Size: 1.26 MB / Downloads: 77)
Dice Poker Description.pdf (Size: 124.56 KB / Downloads: 57)
Dice Poker Print ' n Play.pdf (Size: 385.29 KB / Downloads: 60)
Hello Everyone,
This is my take on the 2 - 3 player Dice Poker Board Game.
Code: (Select All)
_TITLE "Dice Poker - Programmed by Donald L. Foster Jr. - 2023"
RANDOMIZE TIMER: _MOUSESHOW "LINK"
SCREEN _NEWIMAGE(1305, 739, 256)
_PALETTECOLOR 1, _RGB32(177, 83, 0) ' Background Color
_PALETTECOLOR 2, _RGB32(205, 161, 67) ' Board Color
_PALETTECOLOR 3, _RGB32(176, 82, 0) ' Word Color
_PALETTECOLOR 5, _RGB32(120, 0, 0) ' Dice Color
_PALETTECOLOR 6, _RGB32(0, 44, 127) ' Player 1 Blue Piece Outer Color
_PALETTECOLOR 7, _RGB32(0, 64, 147) ' Player 1 Blue Piece Inner Color
_PALETTECOLOR 8, _RGB32(166, 78, 0) ' Player 2 Orange Piece Outer Color
_PALETTECOLOR 9, _RGB32(249, 100, 0) ' Player 2 Orange Piece Inner Color
_PALETTECOLOR 10, _RGB32(78, 0, 83) ' Player 3 Purple Piece Outer Color
_PALETTECOLOR 11, _RGB32(161, 0, 166) ' Player 3 Purple Piece Inner Color
DIM AS _UNSIGNED INTEGER V, X, Y, Z
DIM SHARED AS _UNSIGNED _BYTE Player, Players, FiveOfKind, Straight, FullHouse, Lucky7, Lucky11, Roll, CanPlay, StraightCount, FullHouseCount, StraightBouncer, FullHouseBouncer
DIM SHARED AS _UNSIGNED _BYTE PiecesPlayed, Dice, Die(5), Dice(5), Chosen(5), BoardSpace(9, 9), BoardRotation(9, 9), BoardPlayer(9, 9), BoardRun(9, 9), Playable(9, 9)
DIM SHARED AS _UNSIGNED INTEGER BoardX(9, 9), BoardY(9, 9), DiceX(5)
Player = 1: PiecesPlayed = 0
DATA 37,1,18,1,33,1,32,1,2,1,30,1,27,1,23,1,37,2: ' Row 1 Spaces
DATA 6,1,36,2,22,1,26,1,29,1,31,1,17,1,36,2,4,1: ' Row 2 Spaces
DATA 16,1,8,1,36,2,28,1,13,1,25,1,36,2,12,1,21,1: ' Row 3 Spaces
DATA 10,1,7,1,15,1,36,2,24,1,36,2,20,1,9,1,11,1: ' Row 4 Spaces
DATA 34,1,19,1,35,1,14,1,38,1,14,1,35,2,19,1,34,2: ' Row 5 Spaces
DATA 11,2,9,2,20,2,36,1,24,2,36,1,15,1,7,2,10,2: ' Row 6 Spaces
DATA 21,2,12,2,36,1,25,2,13,1,28,2,36,1,8,2,16,1: ' Row 7 Spaces
DATA 5,1,36,1,17,1,31,2,29,2,26,2,22,2,36,1,3,1: ' Row 8 Speces
DATA 37,3,23,2,27,2,30,2,1,1,32,2,33,2,18,1,37,4: ' Row 9 Spaces
FOR Z = 1 TO 5: DiceX(Z) = 799 + X: X = X + 108: NEXT
FOR Z = 1 TO 9: FOR Y = 1 TO 9: READ BoardSpace(Z, Y), BoardRotation(Z, Y): NEXT: NEXT
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
CLS , 1
' Draw Board
LINE (10, 10)-(729, 729), 0, BF
X = 53
FOR Z = 1 TO 9
V = 53
FOR Y = 1 TO 9
LINE (V - 37, X - 37)-(V + 37, X + 37), 2, BF
DrawBoardSpace V, X, BoardSpace(Z, Y), BoardRotation(Z, Y)
BoardX(Z, Y) = V: BoardY(Z, Y) = X
V = V + 79
NEXT
X = X + 79
NEXT
' Draw Game Title
COLOR 3, 1: font& = _LOADFONT(fontpath$, 60): _FONT font&: _PRINTSTRING (800, 200), "DICE POKER"
X = 0
FOR Z = 200 TO 265
V = 0
FOR Y = 800 TO 1140
IF POINT(Y, Z) = 3 THEN PSET (840 + V, 5 + X), 2
V = V + 1
NEXT
X = X + 1
NEXT
X = 0
FOR Z = 200 TO 265
V = 0
FOR Y = 800 TO 1140
IF POINT(Y, Z) = 3 THEN PSET (850 + V, 15 + X), 0
V = V + 1
NEXT
X = X + 1
NEXT
LINE (800, 200)-(1400, 288), 1, BF
' How Many Players?
COLOR 15, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (817, 200), " How Many Players? (2 or 3)"
Players: A$ = INKEY$: IF A$ = "" GOTO Players
IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
IF VAL(A$) < 2 OR VAL(A$) > 3 GOTO Players ELSE Players = VAL(A$)
LINE (817, 200)-(1220, 235), 1, BF
StartGame: Roll = 1: FOR Z = 1 TO 5: Die(Z) = 0: Dice(Z) = 0: Chosen(Z) = 0: NEXT
' Draw Player Indicator
DrawPiece 1029, 160, Player
font& = _LOADFONT(fontpath$, 20): _FONT font&
_PRINTSTRING (990, 215), "Player: " + STR$(Player)
DisPlayDice:
font& = _LOADFONT(fontpath$, 28): _FONT font&
FOR Y = 635 TO 705 STEP 35: _PRINTSTRING (780, Y), STRING$(300, 32): NEXT
COLOR 0, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (970, 445), "Roll: " + STR$(Roll)
' Clear Space for Roll Button
LINE (888, 525)-(1138, 575), 1, BF
' Display Roll Dice Button
IF Roll < 3 THEN
CIRCLE (913, 550), 25, 0, 1.5, 4.75: CIRCLE (1113, 550), 25, 0, 4.7, 1.7: LINE (913, 525)-(1113, 525), 0: LINE (913, 575)-(1113, 575), 0: PAINT (913, 550), 2, 0
COLOR 0, 2: font& = _LOADFONT(fontpath$, 24): _FONT font&: _PRINTSTRING (925, 539), "R O L L D I C E"
END IF
' Roll and Display Dice
X = 0
FOR Y = 1 TO 12
FOR Z = 1 TO 5:
DrawCursor DiceX(Z), 350, 2, 1
IF Chosen(Z) = 0 THEN Dice(Z) = INT(RND * 6) + 1: DrawDice DiceX(Z), 350, 2, Dice(Z)
NEXT
_DELAY .10
NEXT
ArrangeDice: CheckDicePatterns: CountPatterns: X = 0
FOR Z = 1 TO 9
FOR Y = 1 TO 9
Playable(Z, Y) = 0: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 2
' Check Remove Opponent's Piece
IF BoardSpace(Z, Y) <> 38 AND ((StraightBouncer = 1 AND Straight = 1) OR (FullHouseBouncer = 1 AND FullHouse = 1)) THEN
IF BoardPlayer(Z, Y) > 0 AND BoardPlayer(Z, Y) <> Player AND BoardRun(Z, Y) = 0 THEN X = 1: Playable(Z, Y) = 2: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0
END IF
EndLoop:
NEXT
NEXT
' Standard Move
CheckBoardPatterns
' Display End Turn Button
IF Roll = 3 AND CanPlay = 0 THEN
CIRCLE (913, 550), 25, 0, 1.5, 4.75: CIRCLE (1113, 550), 25, 0, 4.7, 1.7: LINE (913, 525)-(1113, 525), 0: LINE (913, 575)-(1113, 575), 0: PAINT (913, 550), 2, 0
COLOR 0, 2: font& = _LOADFONT(fontpath$, 24): _FONT font&: _PRINTSTRING (925, 539), "E N D T U R N"
END IF
COLOR 0, 1: font& = _LOADFONT(fontpath$, 28): _FONT font&
IF (FullHouseBouncer = 1 AND FullHouse = 1) OR (StraightBouncer = 1 AND Straight = 1) THEN X = 1 ELSE X = 0
IF X = 1 AND Roll < 3 THEN _PRINTSTRING (780, 635), "Choose Dice to Keep and Roll Again "
IF CanPlay = 0 AND X = 0 AND Roll = 3 THEN _PRINTSTRING (780, 670), " There are No Playable Spaces "
IF CanPlay = 1 AND X = 0 AND Roll < 3 THEN _PRINTSTRING (780, 670), "Choose Dice to Keep and Roll Again "
IF CanPlay = 1 AND X = 1 THEN _PRINTSTRING (780, 670), "Choose Opponent's Piece to Remove "
IF CanPlay = 0 AND X = 1 THEN _PRINTSTRING (780, 705), "Choose Opponent's Piece to Remove "
IF CanPlay = 0 AND X = 0 AND Roll < 3 THEN _PRINTSTRING (780, 705), "Choose Dice to Keep and Roll Again "
IF CanPlay = 0 AND X = 0 AND Roll = 3 THEN _PRINTSTRING (780, 705), " Click END TURN to Continue "
IF CanPlay = 1 AND FiveOfKind = 0 THEN _PRINTSTRING (780, 705), " Choose a Space to Place Your Piece "
IF CanPlay = 1 AND FiveOfKind = 1 THEN _PRINTSTRING (780, 705), "Place Your Piece On Any Open Space "
GetInput:
DO WHILE _MOUSEINPUT
' Choose Dice to Keep
FOR Z = 1 TO 5
IF _MOUSEX > DiceX(Z) - 51 AND _MOUSEX < DiceX(Z) + 51 AND _MOUSEY > 309 AND _MOUSEY < 391 AND _MOUSEBUTTON(1) = -1 AND Roll < 3 THEN
GOSUB ReleaseButton: IF Chosen(Z) = 0 THEN Chosen(Z) = 1: DrawCursor DiceX(Z), 350, 2, 0 ELSE Chosen(Z) = 0: DrawCursor DiceX(Z), 350, 2, 1
END IF
NEXT
' Choose Roll Dice Button
IF _MOUSEX > 900 AND _MOUSEX < 1126 AND _MOUSEY > 525 AND _MOUSEY < 575 AND _MOUSEBUTTON(1) = -1 THEN
GOSUB ReleaseButton: IF Roll < 3 THEN Roll = Roll + 1: GOTO DisPlayDice ELSE IF Roll = 3 AND CanPlay = 0 GOTO EndTurn
END IF
' Choose Board Position
FOR Z = 1 TO 9
FOR Y = 1 TO 9
IF _MOUSEX > BoardX(Z, Y) - 51 AND _MOUSEX < BoardX(Z, Y) + 51 AND _MOUSEY > BoardY(Z, Y) - 51 AND _MOUSEY < BoardY(Z, Y) + 51 AND _MOUSEBUTTON(1) = -1 THEN
GOSUB ReleaseButton: IF Playable(Z, Y) = 1 THEN BoardPlayer(Z, Y) = Player: DrawPiece BoardX(Z, Y), BoardY(Z, Y), Player: GOTO EndTurn
IF Playable(Z, Y) = 2 THEN
BoardPlayer(Z, Y) = 0: LINE (BoardX(Z, Y) - 37, BoardY(Z, Y) - 37)-(BoardX(Z, Y) + 37, BoardY(Z, Y) + 37), 2, BF
DrawBoardSpace BoardX(Z, Y), BoardY(Z, Y), BoardSpace(Z, Y), BoardRotation(Z, Y): GOTO EndTurn
END IF
ELSE
END IF
NEXT
NEXT
LOOP
A$ = INKEY$: IF A$ <> "" THEN IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
GOTO GetInput
EndTurn:
' Remove All Board Cursors
FOR Z = 1 TO 9: FOR Y = 1 TO 9: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 2: NEXT: NEXT
' Check for Winner
IF CheckWinner(Player) > 0 THEN DisplayWinner Player
' Get Next Player
IF Player = Players THEN Player = 1 ELSE Player = Player + 1
GOTO StartGame
ReleaseButton:
DO WHILE _MOUSEINPUT
IF _MOUSEBUTTON(1) = 0 THEN RETURN
LOOP
GOTO ReleaseButton
SUB DrawBoardSpace (X1, X2, Space, Rotation)
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
SELECT CASE Space
CASE 1 ' 1 Pair 1's
DrawDice X1 - 16, X2, 1, 1: DrawDice X1 + 16, X2, 1, 1
CASE 2 ' 1 Pair 2's
DrawDice X1 - 16, X2, 1, 2: DrawDice X1 + 16, X2, 1, 2
CASE 3 ' 1 Pair 3's
DrawDice X1 - 16, X2, 1, 3: DrawDice X1 + 16, X2, 1, 3
CASE 4 ' 1 Pair 4's
DrawDice X1 - 16, X2, 1, 4: DrawDice X1 + 16, X2, 1, 4
CASE 5 ' 1 Pair 5's
DrawDice X1 - 16, X2, 1, 5: DrawDice X1 + 16, X2, 1, 5
CASE 6 ' 1 Pair 6's
DrawDice X1 - 16, X2, 1, 6: DrawDice X1 + 16, X2, 1, 6
CASE 7 ' Three of a Kind 1's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1: DrawDice X1, X2 - 16, 1, 1
CASE 8 ' Three of a Kind 2's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1, X2 + 16, 1, 2
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2: DrawDice X1, X2 - 16, 1, 2
CASE 9 ' Three of a Kind 3's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1, X2 + 16, 1, 3
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3: DrawDice X1, X2 - 16, 1, 3
CASE 10 ' Three of a Kind 4's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1, X2 + 16, 1, 4
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4: DrawDice X1, X2 - 16, 1, 4
CASE 11 ' Three of a Kind 5's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1, X2 + 16, 1, 5
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5: DrawDice X1, X2 - 16, 1, 5
CASE 12 ' Three of a Kind 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1, X2 + 16, 1, 6
IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6: DrawDice X1, X2 - 16, 1, 6
CASE 13 ' Four of a Kind 1's
DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
CASE 14 ' Four of a Kind 2's
DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
CASE 15 ' Four of a Kind 3's
DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
CASE 16 ' Four of a Kind 4's
DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
CASE 17 ' Four of a Kind 5's
DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
CASE 18 ' Four of a Kind 6's
DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 19 ' 1 Pair 1's - 1 Pair 2's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
CASE 20 ' 1 Pair 1's - 1 Pair 3's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
CASE 21 ' 1 Pair 1's - 1 Pair 4's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
CASE 22 ' 1 Pair 1's - 1 Pair 5's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
CASE 23 ' 1 Pair 1's - 1 Pair 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 24 ' 1 Pair 2's - 1 Pair 3's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
CASE 25 ' 1 Pair 2's - 1 Pair 4's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
CASE 26 ' 1 Pair 2's - 1 Pair 5's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
CASE 27 ' 1 Pair 2's - 1 Pair 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 28 ' 1 Pair 3's - 1 Pair 4's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
CASE 29 ' 1 Pair 3's - 1 Pair 5's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
CASE 30 ' 1 Pair 3's - 1 Pair 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 31 ' 1 Pair 4's - 1 Pair 5's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
CASE 32 ' 1 Pair 4's - 1 Pair 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 33 ' 1 Pair 5's - 1 Pair 6's
IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6
CASE 34 ' Lucky 7
COLOR 3, 1: font& = _LOADFONT(fontpath$, 20): _FONT font&: _PRINTSTRING (1230, 14), "LUCKY"
COLOR 3, 1: font& = _LOADFONT(fontpath$, 50): _FONT font&: _PRINTSTRING (1247, 32), "7"
X = X1 - 30: W = X1 + 30
FOR Z = 14 TO 74
V = X2 + 30: U = X2 - 30
FOR Y = 1230 TO 1290
IF POINT(Y, Z) = 3 THEN
IF Z < 35 THEN T = 0 ELSE T = 4
IF Rotation = 1 THEN IF T = 4 THEN CIRCLE (X, V), 1, 4: PAINT (X, V), 4 ELSE PSET (X, V), T
IF Rotation = 2 THEN IF T = 4 THEN CIRCLE (W, U), 1, 4: PAINT (W, U), 4 ELSE PSET (W, U), T
END IF
V = V - 1: U = U + 1
NEXT
X = X + 1: W = W - 1
NEXT
LINE (1230, 14)-(1290, 74), 1, BF
CASE 35 ' Lucky 11
COLOR 3, 1: font& = _LOADFONT(fontpath$, 20): _FONT font&: _PRINTSTRING (1230, 14), "LUCKY"
COLOR 3, 1: font& = _LOADFONT(fontpath$, 50): _FONT font&: _PRINTSTRING (1232, 32), "11"
X = X1 - 30: W = X1 + 30
FOR Z = 14 TO 74
V = X2 + 30: U = X2 - 30
FOR Y = 1230 TO 1290
IF POINT(Y, Z) = 3 THEN
IF Z < 35 THEN T = 0 ELSE T = 4
IF Rotation = 1 THEN IF T = 4 THEN CIRCLE (X, V), 1, 4: PAINT (X, V), 4 ELSE PSET (X, V), 0
IF Rotation = 2 THEN IF T = 4 THEN CIRCLE (W, U), 1, 4: PAINT (W, U), 4 ELSE PSET (W, U), 0
END IF
V = V - 1: U = U + 1
NEXT
X = X + 1: W = W - 1
NEXT
LINE (1230, 14)-(1290, 74), 1, BF
CASE 36 ' Full House
IF Rotation = 1 THEN PSET (X1, X2), 2: DRAW "C0TA0BU30TA30L32TA0R55TA150R32TA0BD5P0,0R9U5R5D10U5BL2P0,0BD46L36D8R49U8L14BD2P0,0"
IF Rotation = 2 THEN PSET (X1, X2), 2: DRAW "C0TA0BD30TA30R32TA0L55TA150L30TA0BU5P0,0L9D5L5U10D5BR2P0,0BU46R38U8L49D8R14BU2P0,0"
COLOR 3, 1: font& = _LOADFONT(fontpath$, 16): _FONT font&: _PRINTSTRING (1244, 33), "FULL"
COLOR 3, 1: font& = _LOADFONT(fontpath$, 16): _FONT font&: _PRINTSTRING (1234, 48), "HOUSE"
X = 0
FOR Z = 14 TO 74
V = 0
FOR Y = 1230 TO 1290
IF POINT(Y, Z) = 3 THEN
IF Rotation = 1 THEN PSET (X1 - 30 + V, X2 - 30 + X), 4
IF Rotation = 2 THEN PSET (X1 + 30 - V, X2 + 30 - X), 4
END IF
V = V + 1
NEXT
X = X + 1
NEXT
LINE (1230, 14)-(1290, 74), 1, BF
CASE 37 ' Straight
COLOR 3, 1: font& = _LOADFONT(fontpath$, 11): _FONT font&: _PRINTSTRING (1220, 10), "STRAIGHT"
U = 0
FOR Z = 10 TO 30
V = 0
FOR Y = 1220 TO 1295
IF POINT(Y, Z) = 3 THEN
IF Rotation = 1 THEN CIRCLE (X1 + 21 - V + U, X2 + 30 - V - U), 1, 4: PAINT (X1 + 21 - V + U, X2 + 30 - V - U), 4
IF Rotation = 2 THEN CIRCLE (X1 + 31 - V - U, X2 - 21 + V - U), 1, 4: PAINT (X1 + 31 - V - U, X2 - 21 + V - U), 4
IF Rotation = 3 THEN CIRCLE (X1 - 31 + V + U, X2 + 21 - V + U), 1, 4: PAINT (X1 - 31 + V + U, X2 + 21 - V + U), 4
IF Rotation = 4 THEN CIRCLE (X1 - 21 + V - U, X2 - 31 + V + U), 1, 4: PAINT (X1 - 21 + V - U, X2 - 31 + V + U), 4
END IF
V = V + 1
NEXT
U = U + 1
NEXT
LINE (1220, 10)-(1295, 30), 1, BF
CASE 38 ' Free Space
COLOR 0, 2: font& = _LOADFONT(fontpath$, 13): _FONT font&: _PRINTSTRING (X1 - 14, X2 - 34), "FREE"
COLOR 0, 2: font& = _LOADFONT(fontpath$, 13): _FONT font&: _PRINTSTRING (X1 - 18, X2 + 24), "SPACE"
PSET (X1, X2), 2: DRAW "C0TA0BU9BR3TA15U11TA165U11TA45BL9TA15L11TA165L11TA45BD9TA15D11TA165D11TA45BR9TA15R11TA165R11"
DRAW "TA0BL1BU1TA60R11TA30L11TA0BL8TA60U11TA30D11TA0BD8TA60L11TA30R11TA0BR8TA60D11TA30U11": PAINT (X1, X2), 4, 0
END SELECT
END SUB
SUB DrawCursor (X1 AS INTEGER, X2 AS INTEGER, CursorSize AS _BYTE, CursorColor AS _BYTE)
IF CursorSize = 1 THEN PSET (X1 - 34, X2 - 34), CursorColor: DRAW "TA0R68D68L68U68H1R70D70L70U70H1R72D72L72U72H1R74D74L74U74"
IF CursorSize = 2 THEN PSET (X1 - 48, X2 - 48), CursorColor: DRAW "TA0R97D97L97U97H1R99D99L99U99H1R101D101L101U101"
END SUB
SUB DrawPiece (X1, X2, Player)
IF Player = 1 THEN CIRCLE (X1, X2), 32, 6: PAINT (X1, X2), 7, 6
IF Player = 2 THEN CIRCLE (X1, X2), 32, 8: PAINT (X1, X2), 9, 8
IF Player = 3 THEN CIRCLE (X1, X2), 32, 10: PAINT (X1, X2), 11, 10
END SUB
SUB DrawDice (X1, X2, DiceSize, Die)
IF DiceSize = 1 THEN
LINE (X1 - 14, X2 - 10)-(X1 - 14, X2 + 10), 0: LINE (X1 + 14, X2 - 10)-(X1 + 14, X2 + 10), 0
LINE (X1 - 10, X2 - 14)-(X1 + 10, X2 - 14), 0: LINE (X1 - 10, X2 + 14)-(X1 + 10, X2 + 14), 0
CIRCLE (X1 - 10, X2 - 10), 4, 0, 1.5, 3.0: CIRCLE (X1 + 10, X2 - 10), 4, 0, 0, 1.7: CIRCLE (X1 - 10, X2 + 10), 4, 0, 3.0, 4.9: CIRCLE (X1 + 10, X2 + 10), 4, 0, 4.5, 0
PAINT (X1, X2), 15, 0
IF Die = 1 OR Die = 3 OR Die = 5 THEN CIRCLE (X1, X2), 2, 0: PAINT (X1, X2), 0
IF Die > 1 THEN CIRCLE (X1 + 7, X2 - 7), 2, 0: PAINT (X1 + 7, X2 - 7), 0: CIRCLE (X1 - 7, X2 + 7), 2, 0: PAINT (X1 - 7, X2 + 7), 0
IF Die > 3 THEN CIRCLE (X1 - 7, X2 - 7), 2, 0: PAINT (X1 - 7, X2 - 7), 0: CIRCLE (X1 + 7, X2 + 7), 2, 0: PAINT (X1 + 7, X2 + 7), 0
IF Die = 6 THEN CIRCLE (X1 - 7, X2), 2, 0: PAINT (X1 - 7, X2), 0: CIRCLE (X1 + 7, X2), 2, 0: PAINT (X1 + 7, X2), 0
ELSE
LINE (X1 - 40, X2 - 40)-(X1 + 40, X2 + 40), 1, BF
LINE (X1 - 28, X2 - 40)-(X1 + 28, X2 - 40), 0: LINE (X1 - 28, X2 + 40)-(X1 + 28, X2 + 40), 0
LINE (X1 - 40, X2 - 28)-(X1 - 40, X2 + 28), 0: LINE (X1 + 40, X2 - 28)-(X1 + 40, X2 + 28), 0
CIRCLE (X1 - 28, X2 - 28), 12, 0, 1.5, 3.0: CIRCLE (X1 + 28, X2 - 28), 12, 0, 0, 1.7: CIRCLE (X1 - 28, X2 + 28), 12, 0, 3.2, 4.9: CIRCLE (X1 + 28, X2 + 28), 12, 0, 4.5, 0
PAINT (X1, X2), 15, 0: 'CIRCLE (X1, X2), 36, 4: PAINT (X1, X2), 4
IF Die = 1 OR Die = 3 OR Die = 5 THEN CIRCLE (X1, X2), 6, 0: PAINT (X1, X2), 0
IF Die > 1 THEN CIRCLE (X1 + 21, X2 - 21), 6, 0: PAINT (X1 + 21, X2 - 21), 0: CIRCLE (X1 - 21, X2 + 21), 6, 0: PAINT (X1 - 21, X2 + 21), 0
IF Die > 3 THEN CIRCLE (X1 - 21, X2 - 21), 6, 0: PAINT (X1 - 21, X2 - 21), 0: CIRCLE (X1 + 21, X2 + 21), 6, 0: PAINT (X1 + 21, X2 + 21), 0
IF Die = 6 THEN CIRCLE (X1 - 21, X2), 6, 0: PAINT (X1 - 21, X2), 0: CIRCLE (X1 + 21, X2), 6, 0: PAINT (X1 + 21, X2), 0
END IF
END SUB
SUB ArrangeDice
DIM AS _BYTE Arranged(5)
Position = 1: Arranged(1) = 0: Arranged(2) = 0: Arranged(3) = 0: Arranged(4) = 0: Arranged(5) = 0
FOR Z = 1 TO 6
FOR Y = 1 TO 5
IF Dice(Y) = Z AND Arranged(Y) = 0 THEN Die(Position) = Z: Arranged(Y) = 1: Position = Position + 1
NEXT
NEXT
END SUB
SUB CheckDicePatterns
FiveOfKind = 0: Straight = 0: FullHouse = 0: Lucky11 = 0: Lucky7 = 0
' Five of a Kind
IF Die(1) = Die(2) AND Die(2) = Die(3) AND Die(3) = Die(4) AND Die(4) = Die(5) THEN FiveOfKind = 1
' Straight
IF Die(1) = 1 AND Die(2) = 2 AND Die(3) = 3 AND Die(4) = 4 AND Die(5) = 5 THEN Straight = 1
IF Die(1) = 2 AND Die(2) = 3 AND Die(3) = 4 AND Die(4) = 5 AND Die(5) = 6 THEN Straight = 1
' Full House
IF Die(1) = Die(2) AND Die(2) <> Die(3) AND Die(3) = Die(4) AND Die(4) = Die(5) THEN FullHouse = 1
IF Die(1) = Die(2) AND Die(2) = Die(3) AND Die(3) <> Die(4) AND Die(4) = Die(5) THEN FullHouse = 1
' Lucky 11
IF Die(1) + Die(2) + Die(3) + Die(4) + Die(5) = 11 THEN Lucky11 = 1
' Lucky 7
IF Die(1) + Die(2) + Die(3) + Die(4) + Die(5) = 7 THEN Lucky7 = 1
END SUB
SUB CountPatterns
StraightCount = 0: FullHouseCount = 0: StraightBouncer = 0: FullHouseBouncer = 0
FOR Z = 1 TO 9
FOR Y = 1 TO 9
' Count Filled FullHouses
IF BoardSpace(Z, Y) = 36 AND BoardPlayer(Z, Y) > 0 THEN FullHouseCount = FullHouseCount + 1
' Count Filled Straights
IF BoardSpace(Z, Y) = 37 AND BoardPlayer(Z, Y) > 0 THEN StraightCount = StraightCount + 1
NEXT
NEXT
IF FullHouseCount = 12 THEN FullHouseBouncer = 1
IF StraightCount = 4 THEN StraightBouncer = 1
END SUB
SUB CheckBoardPatterns
Ones = 0: Twos = 0: Threes = 0: Fours = 0: Fives = 0: Sixes = 0: CanPlay = 0
' Count Hom Many Ones, Twos, Threes, Fours, Fives and Sixes
FOR Z = 1 TO 5
IF Die(Z) = 1 THEN Ones = Ones + 1
IF Die(Z) = 2 THEN Twos = Twos + 1
IF Die(Z) = 3 THEN Threes = Threes + 1
IF Die(Z) = 4 THEN Fours = Fours + 1
IF Die(Z) = 5 THEN Fives = Fives + 1
IF Die(Z) = 6 THEN Sixes = Sixes + 1
NEXT
FOR Z = 1 TO 9
FOR Y = 1 TO 9
IF BoardPlayer(Z, Y) = 0 AND BoardSpace(Z, Y) <> 38 AND FiveOfKind = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
IF BoardPlayer(Z, Y) = 0 THEN
SELECT CASE BoardSpace(Z, Y)
CASE 1 ' 1 Pair 1's
IF Ones > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 2 ' 1 Pair 2's
IF Twos > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 3 ' 1 Pair 3's
IF Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 4 ' 1 Pair 4's
IF Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 5 ' 1 Pair 5's
IF Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 6 ' 1 Pair 6's
IF Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 7 ' Three of a Kind 1's
IF Ones > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 8 ' Three of a Kind 2's
IF Twos > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 9 ' Three of a Kind 3's
IF Threes > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 10 ' Three of a Kind 4's
IF Fours > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 11 ' Three of a Kind 5's
IF Fives > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 12 ' Three of a Kind 6's
IF Sixes > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 13 ' Four of a Kind 1's
IF Ones > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 14 ' Four of a Kind 2's
IF Twos > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 15 ' Four of a Kind 3's
IF Threes > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 16 ' Four of a Kind 4's
IF Fours > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 17 ' Four of a Kind 5's
IF Fives > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 18 ' Four of a Kind 6's
IF Sixes > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 19 ' 1 Pair 1's - 1 Pair 2's
IF Ones > 1 AND Twos > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 20 ' 1 Pair 1's - 1 Pair 3's
IF Ones > 1 AND Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 21 ' 1 Pair 1's - 1 Pair 4's
IF Ones > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 22 ' 1 Pair 1's - 1 Pair 5's
IF Ones > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 23 ' 1 Pair 1's - 1 Pair 6's
IF Ones > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 24 ' 1 Pair 2's - 1 Pair 3's
IF Twos > 1 AND Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 25 ' 1 Pair 2's - 1 Pair 4's
IF Twos > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 26 ' 1 Pair 2's - 1 Pair 5's
IF Twos > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 27 ' 1 Pair 2's - 1 Pair 6's
IF Twos > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 28 ' 1 Pair 3's - 1 Pair 4's
IF Threes > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 29 ' 1 Pair 3's - 1 Pair 5's
IF Threes > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 30 ' 1 Pair 3's - 1 Pair 6's
IF Threes > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 31 ' 1 Pair 4's - 1 Pair 5's
IF Fours > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 32 ' 1 Pair 4's - 1 Pair 6's
IF Fours > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 33 ' 1 Pair 5's - 1 Pair 6's
IF Fives > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 34 ' Lucky 7
IF Lucky7 = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 35 ' Lucky 11
IF Lucky11 = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 36 ' Full House
IF FullHouse = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 37 ' Straight
IF Straight = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1
CASE 38 ' Free Space
END SELECT
END IF
NEXT
NEXT
END SUB
FUNCTION CheckWinner (Player)
DIM X(9): X1 = 0: X2 = 0: X3 = 0: X4 = 0: X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0
' Check for Duel Vertical Patterns
FOR Z = 1 TO 9
IF BoardPlayer(1, Z) = Player AND BoardPlayer(2, Z) = Player AND BoardPlayer(3, Z) = Player AND BoardPlayer(4, Z) = Player AND (BoardPlayer(5, Z) = Player OR BoardSpace(5, Z) = 38) AND BoardPlayer(6, Z) = Player AND BoardPlayer(7, Z) = Player AND BoardPlayer(8, Z) = Player AND BoardPlayer(9, Z) = Player THEN
X1 = 2
BoardRun(1, Z) = 1: CIRCLE (BoardX(1, Z), BoardY(1, Z)), 10, 15: PAINT (BoardX(1, Z), BoardY(1, Z)), 15
BoardRun(2, Z) = 1: CIRCLE (BoardX(2, Z), BoardY(2, Z)), 10, 15: PAINT (BoardX(2, Z), BoardY(2, Z)), 15
BoardRun(3, Z) = 1: CIRCLE (BoardX(3, Z), BoardY(3, Z)), 10, 15: PAINT (BoardX(3, Z), BoardY(3, Z)), 15
BoardRun(4, Z) = 1: CIRCLE (BoardX(4, Z), BoardY(4, Z)), 10, 15: PAINT (BoardX(4, Z), BoardY(4, Z)), 15
IF Z <> 5 THEN BoardRun(5, Z) = 1: CIRCLE (BoardX(4, Z), BoardY(5, Z)), 10, 15: PAINT (BoardX(5, Z), BoardY(5, Z)), 15
BoardRun(6, Z) = 1: CIRCLE (BoardX(6, Z), BoardY(6, Z)), 10, 15: PAINT (BoardX(6, Z), BoardY(6, Z)), 15
BoardRun(7, Z) = 1: CIRCLE (BoardX(7, Z), BoardY(7, Z)), 10, 15: PAINT (BoardX(7, Z), BoardY(7, Z)), 15
BoardRun(8, Z) = 1: CIRCLE (BoardX(8, Z), BoardY(8, Z)), 10, 15: PAINT (BoardX(8, Z), BoardY(8, Z)), 15
BoardRun(9, Z) = 1: CIRCLE (BoardX(9, Z), BoardY(9, Z)), 10, 15: PAINT (BoardX(9, Z), BoardY(9, Z)), 15
END IF
NEXT
' Check for Single Vertical Patterns
IF X1 = 0 THEN
FOR Z = 1 TO 9
FOR Y = 1 TO 5
IF (BoardPlayer(Y, Z) = Player OR BoardSpace(Y, Z) = 38) AND (BoardPlayer(Y + 1, Z) = Player OR BoardSpace(Y + 1, Z) = 38) AND (BoardPlayer(Y + 2, Z) = Player OR BoardSpace(Y + 2, Z) = 38) AND (BoardPlayer(Y + 3, Z) = Player OR BoardSpace(Y + 3, Z) = 38) AND (BoardPlayer(Y + 4, Z) = Player OR BoardSpace(Y + 4, Z) = 38) THEN
X(Z) = 1
IF Z = 5 AND Y = 5 GOTO EndLoop11 ELSE BoardRun(Y, Z) = 1: CIRCLE (BoardX(Y, Z), BoardY(Y, Z)), 10, 15: PAINT (BoardX(Y, Z), BoardY(Y, Z)), 15
EndLoop11: IF Z = 5 AND Y + 1 = 5 GOTO EndLoop12 ELSE BoardRun(Y + 1, Z) = 1: CIRCLE (BoardX(Y + 1, Z), BoardY(Y + 1, Z)), 10, 15: PAINT (BoardX(Y + 1, Z), BoardY(Y + 1, Z)), 15
EndLoop12: IF Z = 5 AND Y + 2 = 5 GOTO EndLoop13 ELSE BoardRun(Y + 2, Z) = 1: CIRCLE (BoardX(Y + 2, Z), BoardY(Y + 2, Z)), 10, 15: PAINT (BoardX(Y + 2, Z), BoardY(Y + 2, Z)), 15
EndLoop13: IF Z = 5 AND Y + 3 = 5 GOTO EndLoop14 ELSE BoardRun(Y + 3, Z) = 1: CIRCLE (BoardX(Y + 3, Z), BoardY(Y + 3, Z)), 10, 15: PAINT (BoardX(Y + 3, Z), BoardY(Y + 3, Z)), 15
EndLoop14: IF Z = 5 AND Y + 4 = 5 GOTO EndLoop15 ELSE BoardRun(Y + 4, Z) = 1: CIRCLE (BoardX(Y + 4, Z), BoardY(Y + 4, Z)), 10, 15: PAINT (BoardX(Y + 4, Z), BoardY(Y + 4, Z)), 15
EndLoop15:
END IF
NEXT
NEXT
X1 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
END IF
X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0
' Check for Duel Horizontal Patterns
FOR Z = 1 TO 9
IF BoardPlayer(Z, 1) = Player AND BoardPlayer(Z, 2) = Player AND BoardPlayer(Z, 3) = Player AND BoardPlayer(Z, 4) = Player AND (BoardPlayer(Z, 5) = Player OR BoardSpace(Z, 5) = 38) AND BoardPlayer(Z, 6) = Player AND BoardPlayer(Z, 7) = Player AND BoardPlayer(Z, 8) = Player AND BoardPlayer(Z, 9) = Player THEN
X2 = 2
BoardRun(Z, 1) = 1: CIRCLE (BoardX(Z, 1), BoardY(Z, 1)), 10, 15: PAINT (BoardX(Z, 1), BoardY(Z, 1)), 15
BoardRun(Z, 2) = 1: CIRCLE (BoardX(Z, 2), BoardY(Z, 2)), 10, 15: PAINT (BoardX(Z, 2), BoardY(Z, 2)), 15
BoardRun(Z, 3) = 1: CIRCLE (BoardX(Z, 3), BoardY(Z, 3)), 10, 15: PAINT (BoardX(Z, 3), BoardY(Z, 3)), 15
BoardRun(Z, 4) = 1: CIRCLE (BoardX(Z, 4), BoardY(Z, 4)), 10, 15: PAINT (BoardX(Z, 4), BoardY(Z, 4)), 15
IF Z <> 5 THEN BoardRun(Z, 5) = 1: CIRCLE (BoardX(Z, 5), BoardY(Z, 5)), 10, 15: PAINT (BoardX(Z, 5), BoardY(Z, 5)), 15
BoardRun(Z, 6) = 1: CIRCLE (BoardX(Z, 6), BoardY(Z, 6)), 10, 15: PAINT (BoardX(Z, 6), BoardY(Z, 6)), 15
BoardRun(Z, 7) = 1: CIRCLE (BoardX(Z, 7), BoardY(Z, 7)), 10, 15: PAINT (BoardX(Z, 7), BoardY(Z, 7)), 15
BoardRun(Z, 8) = 1: CIRCLE (BoardX(Z, 8), BoardY(Z, 8)), 10, 15: PAINT (BoardX(Z, 8), BoardY(Z, 8)), 15
BoardRun(Z, 9) = 1: CIRCLE (BoardX(Z, 9), BoardY(Z, 9)), 10, 15: PAINT (BoardX(Z, 9), BoardY(Z, 9)), 15
END IF
NEXT
' Check for Single Horizontal Patterns
IF X2 = 0 THEN
FOR Z = 1 TO 9
FOR Y = 1 TO 5
IF (BoardPlayer(Z, Y) = Player OR BoardSpace(Z, Y) = 38) AND (BoardPlayer(Z, Y + 1) = Player OR BoardSpace(Z, Y + 1) = 38) AND (BoardPlayer(Z, Y + 2) = Player OR BoardSpace(Z, Y + 2) = 38) AND (BoardPlayer(Z, Y + 3) = Player OR BoardSpace(Z, Y + 3) = 38) AND (BoardPlayer(Z, Y + 4) = Player OR BoardSpace(Z, Y + 4) = 38) THEN
X(Z) = 1
IF Z = 5 AND Y = 5 GOTO EndLoop21 ELSE BoardRun(Z, Y) = 1: CIRCLE (BoardX(Z, Y), BoardY(Z, Y)), 10, 15: PAINT (BoardX(Z, Y), BoardY(Z, Y)), 15
EndLoop21: IF Z = 5 AND Y + 1 = 5 GOTO EndLoop22 ELSE BoardRun(Z, Y + 1) = 1: CIRCLE (BoardX(Z, Y + 1), BoardY(Z, Y + 1)), 10, 15: PAINT (BoardX(Z, Y + 1), BoardY(Z, Y + 1)), 15
EndLoop22: IF Z = 5 AND Y + 2 = 5 GOTO EndLoop23 ELSE BoardRun(Z, Y + 2) = 1: CIRCLE (BoardX(Z, Y + 2), BoardY(Z, Y + 2)), 10, 15: PAINT (BoardX(Z, Y + 2), BoardY(Z, Y + 2)), 15
EndLoop23: IF Z = 5 AND Y + 3 = 5 GOTO EndLoop24 ELSE BoardRun(Z, Y + 3) = 1: CIRCLE (BoardX(Z, Y + 3), BoardY(Z, Y + 3)), 10, 15: PAINT (BoardX(Z, Y + 3), BoardY(Z, Y + 3)), 15
EndLoop24: IF Z = 5 AND Y + 4 = 5 GOTO EndLoop25 ELSE BoardRun(Z, Y + 4) = 1: CIRCLE (BoardX(Z, Y + 4), BoardY(Z, Y + 4)), 10, 15: PAINT (BoardX(Z, Y + 4), BoardY(Z, Y + 4)), 15
EndLoop25:
END IF
NEXT
NEXT
X2 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
END IF
X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0
' Check for Duel Diagonal 1 Pattern
IF BoardPlayer(1, 1) = Player AND BoardPlayer(2, 2) = Player AND BoardPlayer(3, 3) = Player AND BoardPlayer(4, 4) = Player AND BoardPlayer(6, 6) = Player AND BoardPlayer(7, 7) = Player AND BoardPlayer(8, 8) = Player AND BoardPlayer(9, 9) = Player THEN
X3 = 2
BoardRun(1, 1) = 1: CIRCLE (BoardX(1, 1), BoardY(1, 1)), 10, 15: PAINT (BoardX(1, 1), BoardY(1, 1)), 15
BoardRun(2, 2) = 1: CIRCLE (BoardX(2, 2), BoardY(2, 2)), 10, 15: PAINT (BoardX(2, 2), BoardY(2, 2)), 15
BoardRun(3, 3) = 1: CIRCLE (BoardX(3, 3), BoardY(3, 3)), 10, 15: PAINT (BoardX(3, 3), BoardY(3, 3)), 15
BoardRun(4, 4) = 1: CIRCLE (BoardX(4, 4), BoardY(4, 4)), 10, 15: PAINT (BoardX(4, 4), BoardY(4, 4)), 15
BoardRun(6, 6) = 1: CIRCLE (BoardX(6, 6), BoardY(6, 6)), 10, 15: PAINT (BoardX(6, 6), BoardY(6, 6)), 15
BoardRun(7, 7) = 1: CIRCLE (BoardX(7, 7), BoardY(7, 7)), 10, 15: PAINT (BoardX(7, 7), BoardY(7, 7)), 15
BoardRun(8, 8) = 1: CIRCLE (BoardX(8, 8), BoardY(8, 8)), 10, 15: PAINT (BoardX(8, 8), BoardY(8, 8)), 15
BoardRun(9, 9) = 1: CIRCLE (BoardX(9, 9), BoardY(9, 9)), 10, 15: PAINT (BoardX(9, 9), BoardY(9, 9)), 15
END IF
' Check for Single Diagonal 1 Patterns
IF X3 = 0 THEN
IF BoardPlayer(1, 5) = Player AND BoardPlayer(2, 6) = Player AND BoardPlayer(3, 7) = Player AND BoardPlayer(4, 8) = Player AND BoardPlayer(5, 9) = Player THEN
X(1) = 1
BoardRun(1, 5) = 1: CIRCLE (BoardX(1, 5), BoardY(1, 5)), 10, 15: PAINT (BoardX(1, 5), BoardY(1, 5)), 15
BoardRun(2, 6) = 1: CIRCLE (BoardX(2, 6), BoardY(2, 6)), 10, 15: PAINT (BoardX(2, 6), BoardY(2, 6)), 15
BoardRun(3, 7) = 1: CIRCLE (BoardX(3, 7), BoardY(3, 7)), 10, 15: PAINT (BoardX(3, 7), BoardY(3, 7)), 15
BoardRun(4, 8) = 1: CIRCLE (BoardX(4, 8), BoardY(4, 8)), 10, 15: PAINT (BoardX(4, 8), BoardY(4, 8)), 15
BoardRun(5, 9) = 1: CIRCLE (BoardX(5, 9), BoardY(5, 9)), 10, 15: PAINT (BoardX(5, 9), BoardY(5, 9)), 15
END IF
FOR Z = 0 TO 1
IF BoardPlayer(1 + Z, 4 + Z) = Player AND BoardPlayer(2 + Z, 5 + Z) = Player AND BoardPlayer(3 + Z, 6 + Z) = Player AND BoardPlayer(4 + Z, 7 + Z) = Player AND BoardPlayer(5 + Z, 8 + Z) = Player THEN
X(2) = 1
BoardRun(Z + 1, Z + 4) = 1: CIRCLE (BoardX(Z + 1, Z + 4), BoardY(Z + 1, Z + 4)), 10, 15: PAINT (BoardX(Z + 1, Z + 4), BoardY(Z + 1, Z + 4)), 15
BoardRun(Z + 2, Z + 5) = 1: CIRCLE (BoardX(Z + 2, Z + 5), BoardY(Z + 2, Z + 5)), 10, 15: PAINT (BoardX(Z + 2, Z + 5), BoardY(Z + 2, Z + 5)), 15
BoardRun(Z + 3, Z + 6) = 1: CIRCLE (BoardX(Z + 3, Z + 6), BoardY(Z + 3, Z + 6)), 10, 15: PAINT (BoardX(Z + 3, Z + 6), BoardY(Z + 3, Z + 6)), 15
BoardRun(Z + 4, Z + 7) = 1: CIRCLE (BoardX(Z + 4, Z + 7), BoardY(Z + 4, Z + 7)), 10, 15: PAINT (BoardX(Z + 4, Z + 7), BoardY(Z + 4, Z + 7)), 15
BoardRun(Z + 5, Z + 8) = 1: CIRCLE (BoardX(Z + 5, Z + 8), BoardY(Z + 5, Z + 8)), 10, 15: PAINT (BoardX(Z + 5, Z + 8), BoardY(Z + 5, Z + 8)), 15
END IF
NEXT
FOR Z = 0 TO 2
IF BoardPlayer(1 + Z, 3 + Z) = Player AND BoardPlayer(2 + Z, 4 + Z) = Player AND BoardPlayer(3 + Z, 5 + Z) = Player AND BoardPlayer(4 + Z, 6 + Z) = Player AND BoardPlayer(5 + Z, 7 + Z) = Player THEN
X(3) = 1
BoardRun(Z + 1, Z + 3) = 1: CIRCLE (BoardX(Z + 1, Z + 3), BoardY(Z + 1, Z + 3)), 10, 15: PAINT (BoardX(Z + 1, Z + 3), BoardY(Z + 1, Z + 3)), 15
BoardRun(Z + 2, Z + 4) = 1: CIRCLE (BoardX(Z + 2, Z + 4), BoardY(Z + 2, Z + 4)), 10, 15: PAINT (BoardX(Z + 2, Z + 4), BoardY(Z + 2, Z + 4)), 15
BoardRun(Z + 3, Z + 5) = 1: CIRCLE (BoardX(Z + 3, Z + 5), BoardY(Z + 3, Z + 5)), 10, 15: PAINT (BoardX(Z + 3, Z + 5), BoardY(Z + 3, Z + 5)), 15
BoardRun(Z + 4, Z + 6) = 1: CIRCLE (BoardX(Z + 4, Z + 6), BoardY(Z + 4, Z + 6)), 10, 15: PAINT (BoardX(Z + 4, Z + 6), BoardY(Z + 4, Z + 6)), 15
BoardRun(Z + 5, Z + 7) = 1: CIRCLE (BoardX(Z + 5, Z + 7), BoardY(Z + 5, Z + 7)), 10, 15: PAINT (BoardX(Z + 5, Z + 7), BoardY(Z + 5, Z + 7)), 15
END IF
NEXT
FOR Z = 0 TO 3
IF BoardPlayer(1 + Z, 2 + Z) = Player AND BoardPlayer(2 + Z, 3 + Z) = Player AND BoardPlayer(3 + Z, 4 + Z) = Player AND BoardPlayer(4 + Z, 5 + Z) = Player AND BoardPlayer(5 + Z, 6 + Z) = Player THEN
X(4) = 1
BoardRun(Z + 1, Z + 2) = 1: CIRCLE (BoardX(Z + 1, Z + 2), BoardY(Z + 1, Z + 2)), 10, 15: PAINT (BoardX(Z + 1, Z + 2), BoardY(Z + 1, Z + 2)), 15
BoardRun(Z + 2, Z + 3) = 1: CIRCLE (BoardX(Z + 2, Z + 3), BoardY(Z + 2, Z + 3)), 10, 15: PAINT (BoardX(Z + 2, Z + 3), BoardY(Z + 2, Z + 3)), 15
BoardRun(Z + 3, Z + 4) = 1: CIRCLE (BoardX(Z + 3, Z + 4), BoardY(Z + 3, Z + 4)), 10, 15: PAINT (BoardX(Z + 3, Z + 4), BoardY(Z + 3, Z + 4)), 15
BoardRun(Z + 4, Z + 5) = 1: CIRCLE (BoardX(Z + 4, Z + 5), BoardY(Z + 4, Z + 5)), 10, 15: PAINT (BoardX(Z + 4, Z + 5), BoardY(Z + 4, Z + 5)), 15
BoardRun(Z + 5, Z + 6) = 1: CIRCLE (BoardX(Z + 5, Z + 6), BoardY(Z + 5, Z + 6)), 10, 15: PAINT (BoardX(Z + 5, Z + 6), BoardY(Z + 5, Z + 6)), 15
END IF
NEXT
FOR Z = 1 TO 5
IF (BoardPlayer(Z, Z) = Player OR BoardSpace(Z, Z) = 38) AND (BoardPlayer(Z + 1, Z + 1) = Player OR BoardSpace(Z + 1, Z + 1) = 38) AND (BoardPlayer(Z + 2, Z + 2) = Player OR BoardSpace(Z + 2, Z + 2) = 38) AND (BoardPlayer(Z + 3, Z + 3) = Player OR BoardSpace(Z + 3, Z + 3) = 38) AND (BoardPlayer(Z + 4, Z + 4) = Player OR BoardSpace(Z + 4, Z + 4) = 38) THEN
X(5) = 1
IF BoardSpace(Z, Z) <> 38 THEN BoardRun(Z, Z) = 1: CIRCLE (BoardX(Z, Z), BoardY(Z, Z)), 10, 15: PAINT (BoardX(Z, Z), BoardY(Z, Z)), 15
IF BoardSpace(Z + 1, Z + 1) <> 38 THEN BoardRun(Z + 1, Z + 1) = 1: CIRCLE (BoardX(Z + 1, Z + 1), BoardY(Z + 1, Z + 1)), 10, 15: PAINT (BoardX(Z + 1, Z + 1), BoardY(Z + 1, Z + 1)), 15
IF BoardSpace(Z + 2, Z + 2) <> 38 THEN BoardRun(Z + 2, Z + 2) = 1: CIRCLE (BoardX(Z + 2, Z + 2), BoardY(Z + 2, Z + 2)), 10, 15: PAINT (BoardX(Z + 2, Z + 2), BoardY(Z + 2, Z + 2)), 15
IF BoardSpace(Z + 3, Z + 3) <> 38 THEN BoardRun(Z + 3, Z + 3) = 1: CIRCLE (BoardX(Z + 3, Z + 3), BoardY(Z + 3, Z + 3)), 10, 15: PAINT (BoardX(Z + 3, Z + 3), BoardY(Z + 3, Z + 3)), 15
IF BoardSpace(Z + 4, Z + 4) <> 38 THEN BoardRun(Z + 4, Z + 4) = 1: CIRCLE (BoardX(Z + 4, Z + 4), BoardY(Z + 4, Z + 4)), 10, 15: PAINT (BoardX(Z + 4, Z + 4), BoardY(Z + 4, Z + 4)), 15
END IF
NEXT
FOR Z = 0 TO 3
IF BoardPlayer(2 + Z, 1 + Z) = Player AND BoardPlayer(3 + Z, 2 + Z) = Player AND BoardPlayer(4 + Z, 3 + Z) = Player AND BoardPlayer(5 + Z, 4 + Z) = Player AND BoardPlayer(6 + Z, 5 + Z) = Player THEN
X(6) = 1
BoardRun(Z + 2, Z + 1) = 1: CIRCLE (BoardX(Z + 2, Z + 1), BoardY(Z + 2, Z + 1)), 10, 15: PAINT (BoardX(Z + 2, Z + 1), BoardY(Z + 2, Z + 1)), 15
BoardRun(Z + 3, Z + 2) = 1: CIRCLE (BoardX(Z + 3, Z + 2), BoardY(Z + 3, Z + 2)), 10, 15: PAINT (BoardX(Z + 3, Z + 2), BoardY(Z + 3, Z + 2)), 15
BoardRun(Z + 4, Z + 3) = 1: CIRCLE (BoardX(Z + 4, Z + 3), BoardY(Z + 4, Z + 3)), 10, 15: PAINT (BoardX(Z + 4, Z + 3), BoardY(Z + 4, Z + 3)), 15
BoardRun(Z + 5, Z + 4) = 1: CIRCLE (BoardX(Z + 5, Z + 4), BoardY(Z + 5, Z + 4)), 10, 15: PAINT (BoardX(Z + 5, Z + 4), BoardY(Z + 5, Z + 4)), 15
BoardRun(Z + 6, Z + 5) = 1: CIRCLE (BoardX(Z + 6, Z + 5), BoardY(Z + 6, Z + 5)), 10, 15: PAINT (BoardX(Z + 6, Z + 5), BoardY(Z + 6, Z + 5)), 15
END IF
NEXT
FOR Z = 0 TO 2
IF BoardPlayer(3 + Z, 1 + Z) = Player AND BoardPlayer(4 + Z, 2 + Z) = Player AND BoardPlayer(5 + Z, 3 + Z) = Player AND BoardPlayer(6 + Z, 4 + Z) = Player AND BoardPlayer(7 + Z, 5 + Z) = Player THEN
X(7) = 1
BoardRun(Z + 3, Z + 1) = 1: CIRCLE (BoardX(Z + 3, Z + 1), BoardY(Z + 3, Z + 1)), 10, 15: PAINT (BoardX(Z + 3, Z + 1), BoardY(Z + 3, Z + 1)), 15
BoardRun(Z + 4, Z + 2) = 1: CIRCLE (BoardX(Z + 4, Z + 2), BoardY(Z + 4, Z + 2)), 10, 15: PAINT (BoardX(Z + 4, Z + 2), BoardY(Z + 4, Z + 2)), 15
BoardRun(Z + 5, Z + 3) = 1: CIRCLE (BoardX(Z + 5, Z + 3), BoardY(Z + 5, Z + 3)), 10, 15: PAINT (BoardX(Z + 5, Z + 3), BoardY(Z + 5, Z + 3)), 15
BoardRun(Z + 6, Z + 4) = 1: CIRCLE (BoardX(Z + 6, Z + 4), BoardY(Z + 6, Z + 4)), 10, 15: PAINT (BoardX(Z + 6, Z + 4), BoardY(Z + 6, Z + 4)), 15
BoardRun(Z + 7, Z + 5) = 1: CIRCLE (BoardX(Z + 7, Z + 5), BoardY(Z + 7, Z + 5)), 10, 15: PAINT (BoardX(Z + 7, Z + 5), BoardY(Z + 7, Z + 5)), 15
END IF
NEXT
FOR Z = 0 TO 1
IF BoardPlayer(4 + Z, 1 + Z) = Player AND BoardPlayer(5 + Z, 2 + Z) = Player AND BoardPlayer(6 + Z, 3 + Z) = Player AND BoardPlayer(7 + Z, 4 + Z) = Player AND BoardPlayer(8 + Z, 5 + Z) = Player THEN
X(8) = 1
BoardRun(Z + 4, Z + 1) = 1: CIRCLE (BoardX(Z + 4, Z + 1), BoardY(Z + 4, Z + 1)), 10, 15: PAINT (BoardX(Z + 4, Z + 1), BoardY(Z + 4, Z + 1)), 15
BoardRun(Z + 5, Z + 2) = 1: CIRCLE (BoardX(Z + 5, Z + 2), BoardY(Z + 5, Z + 2)), 10, 15: PAINT (BoardX(Z + 5, Z + 2), BoardY(Z + 5, Z + 2)), 15
BoardRun(Z + 6, Z + 3) = 1: CIRCLE (BoardX(Z + 6, Z + 3), BoardY(Z + 6, Z + 3)), 10, 15: PAINT (BoardX(Z + 6, Z + 3), BoardY(Z + 6, Z + 3)), 15
BoardRun(Z + 7, Z + 4) = 1: CIRCLE (BoardX(Z + 7, Z + 4), BoardY(Z + 7, Z + 4)), 10, 15: PAINT (BoardX(Z + 7, Z + 4), BoardY(Z + 7, Z + 4)), 15
BoardRun(Z + 8, Z + 5) = 1: CIRCLE (BoardX(Z + 8, Z + 5), BoardY(Z + 8, Z + 5)), 10, 15: PAINT (BoardX(Z + 8, Z + 5), BoardY(Z + 8, Z + 5)), 15
END IF
NEXT
IF BoardPlayer(5, 1) = Player AND BoardPlayer(6, 2) = Player AND BoardPlayer(7, 3) = Player AND BoardPlayer(8, 4) = Player AND BoardPlayer(9, 5) = Player THEN
X(9) = 1
BoardRun(5, 1) = 1: CIRCLE (BoardX(5, 1), BoardY(5, 1)), 10, 15: PAINT (BoardX(5, 1), BoardY(5, 1)), 15
BoardRun(6, 2) = 1: CIRCLE (BoardX(6, 2), BoardY(6, 2)), 10, 15: PAINT (BoardX(6, 2), BoardY(6, 2)), 15
BoardRun(7, 3) = 1: CIRCLE (BoardX(7, 3), BoardY(7, 3)), 10, 15: PAINT (BoardX(7, 3), BoardY(7, 3)), 15
BoardRun(8, 4) = 1: CIRCLE (BoardX(8, 4), BoardY(8, 4)), 10, 15: PAINT (BoardX(8, 4), BoardY(8, 4)), 15
BoardRun(9, 5) = 1: CIRCLE (BoardX(9, 5), BoardY(9, 5)), 10, 15: PAINT (BoardX(9, 5), BoardY(9, 5)), 15
END IF
X3 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
END IF
X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0
' Check for Duel Diagonal 2 Pattern
IF BoardPlayer(1, 9) = Player AND BoardPlayer(2, 8) = Player AND BoardPlayer(3, 7) = Player AND BoardPlayer(4, 6) = Player AND BoardPlayer(6, 4) = Player AND BoardPlayer(7, 3) = Player AND BoardPlayer(8, 2) = Player AND BoardPlayer(9, 1) = Player THEN
X4 = 2
BoardRun(1, 9) = 1: CIRCLE (BoardX(1, 9), BoardY(1, 9)), 10, 15: PAINT (BoardX(1, 9), BoardY(1, 9)), 15
BoardRun(2, 8) = 1: CIRCLE (BoardX(2, 8), BoardY(2, 8)), 10, 15: PAINT (BoardX(2, 8), BoardY(2, 8)), 15
BoardRun(3, 7) = 1: CIRCLE (BoardX(3, 7), BoardY(3, 7)), 10, 15: PAINT (BoardX(3, 7), BoardY(3, 7)), 15
BoardRun(4, 6) = 1: CIRCLE (BoardX(4, 6), BoardY(4, 6)), 10, 15: PAINT (BoardX(4, 6), BoardY(4, 6)), 15
BoardRun(6, 4) = 1: CIRCLE (BoardX(6, 4), BoardY(6, 4)), 10, 15: PAINT (BoardX(6, 4), BoardY(6, 4)), 15
BoardRun(7, 3) = 1: CIRCLE (BoardX(7, 3), BoardY(7, 3)), 10, 15: PAINT (BoardX(7, 3), BoardY(7, 3)), 15
BoardRun(8, 2) = 1: CIRCLE (BoardX(8, 2), BoardY(8, 2)), 10, 15: PAINT (BoardX(8, 2), BoardY(8, 2)), 15
BoardRun(9, 1) = 1: CIRCLE (BoardX(9, 1), BoardY(9, 1)), 10, 15: PAINT (BoardX(9, 1), BoardY(9, 1)), 15
END IF
' Check for Single Diagonal 2 Patterns
IF X4 = 0 THEN
IF BoardPlayer(1, 5) = Player AND BoardPlayer(2, 4) = Player AND BoardPlayer(3, 3) = Player AND BoardPlayer(4, 2) = Player AND BoardPlayer(5, 1) = Player THEN
X(1) = 1
BoardRun(1, 5) = 1: CIRCLE (BoardX(1, 5), BoardY(1, 5)), 10, 15: PAINT (BoardX(1, 5), BoardY(1, 5)), 15
BoardRun(2, 4) = 1: CIRCLE (BoardX(2, 4), BoardY(2, 4)), 10, 15: PAINT (BoardX(2, 4), BoardY(2, 4)), 15
BoardRun(3, 3) = 1: CIRCLE (BoardX(3, 3), BoardY(3, 3)), 10, 15: PAINT (BoardX(3, 3), BoardY(3, 3)), 15
BoardRun(4, 2) = 1: CIRCLE (BoardX(4, 2), BoardY(4, 2)), 10, 15: PAINT (BoardX(4, 2), BoardY(4, 2)), 15
BoardRun(5, 1) = 1: CIRCLE (BoardX(5, 1), BoardY(5, 1)), 10, 15: PAINT (BoardX(5, 1), BoardY(5, 1)), 15
END IF
FOR Z = 0 TO 1
IF BoardPlayer(0 + Z, 7 - Z) = Player AND BoardPlayer(1 + Z, 6 - Z) = Player AND BoardPlayer(2 + Z, 5 - Z) = Player AND BoardPlayer(3 + Z, 4 - Z) = Player AND BoardPlayer(4 + Z, 3 - Z) = Player THEN
X(2) = 1
BoardRun(0 + Z, 7 - Z) = 1: CIRCLE (BoardX(0 + Z, 7 - Z), BoardY(0 + Z, 7 - Z)), 10, 15: PAINT (BoardX(0 + Z, 7 - Z), BoardY(0 + Z, 7 - Z)), 15
BoardRun(1 + Z, 6 - Z) = 1: CIRCLE (BoardX(1 + Z, 6 - Z), BoardY(1 + Z, 6 - Z)), 10, 15: PAINT (BoardX(1 + Z, 6 - Z), BoardY(1 + Z, 6 - Z)), 15
BoardRun(2 + Z, 5 - Z) = 1: CIRCLE (BoardX(2 + Z, 5 - Z), BoardY(2 + Z, 5 - Z)), 10, 15: PAINT (BoardX(2 + Z, 5 - Z), BoardY(2 + Z, 5 - Z)), 15
BoardRun(3 + Z, 4 - Z) = 1: CIRCLE (BoardX(3 + Z, 4 - Z), BoardY(3 + Z, 4 - Z)), 10, 15: PAINT (BoardX(3 + Z, 4 - Z), BoardY(3 + Z, 4 - Z)), 15
BoardRun(4 + Z, 3 - Z) = 1: CIRCLE (BoardX(4 + Z, 3 - Z), BoardY(4 + Z, 3 - Z)), 10, 15: PAINT (BoardX(4 + Z, 3 - Z), BoardY(4 + Z, 3 - Z)), 15
END IF
NEXT
FOR Z = 0 TO 2
IF BoardPlayer(0 + Z, 8 - Z) = Player AND BoardPlayer(1 + Z, 7 - Z) = Player AND BoardPlayer(2 + Z, 6 - Z) = Player AND BoardPlayer(3 + Z, 5 - Z) = Player AND BoardPlayer(4 + Z, 4 - Z) = Player THEN
X(3) = 1
BoardRun(0 + Z, 8 - Z) = 1: CIRCLE (BoardX(0 + Z, 8 - Z), BoardY(0 + Z, 8 - Z)), 10, 15: PAINT (BoardX(0 + Z, 8 - Z), BoardY(0 + Z, 8 - Z)), 15
BoardRun(1 + Z, 7 - Z) = 1: CIRCLE (BoardX(1 + Z, 7 - Z), BoardY(1 + Z, 7 - Z)), 10, 15: PAINT (BoardX(1 + Z, 7 - Z), BoardY(1 + Z, 7 - Z)), 15
BoardRun(2 + Z, 6 - Z) = 1: CIRCLE (BoardX(2 + Z, 6 - Z), BoardY(2 + Z, 6 - Z)), 10, 15: PAINT (BoardX(2 + Z, 6 - Z), BoardY(2 + Z, 6 - Z)), 15
BoardRun(3 + Z, 5 - Z) = 1: CIRCLE (BoardX(3 + Z, 5 - Z), BoardY(3 + Z, 5 - Z)), 10, 15: PAINT (BoardX(3 + Z, 5 - Z), BoardY(3 + Z, 5 - Z)), 15
BoardRun(4 + Z, 4 - Z) = 1: CIRCLE (BoardX(4 + Z, 4 - Z), BoardY(4 + Z, 4 - Z)), 10, 15: PAINT (BoardX(4 + Z, 4 - Z), BoardY(4 + Z, 4 - Z)), 15
END IF
NEXT
FOR Z = 0 TO 3
IF BoardPlayer(0 + Z, 9 - Z) = Player AND BoardPlayer(1 + Z, 8 - Z) = Player AND BoardPlayer(2 + Z, 7 - Z) = Player AND BoardPlayer(3 + Z, 6 - Z) = Player AND BoardPlayer(4 + Z, 5 - Z) = Player THEN
X(4) = 1
BoardRun(0 + Z, 9 - Z) = 1: CIRCLE (BoardX(0 + Z, 9 - Z), BoardY(0 + Z, 9 - Z)), 10, 15: PAINT (BoardX(0 + Z, 9 - Z), BoardY(0 + Z, 9 - Z)), 15
BoardRun(1 + Z, 8 - Z) = 1: CIRCLE (BoardX(1 + Z, 8 - Z), BoardY(1 + Z, 8 - Z)), 10, 15: PAINT (BoardX(1 + Z, 8 - Z), BoardY(1 + Z, 8 - Z)), 15
BoardRun(2 + Z, 7 - Z) = 1: CIRCLE (BoardX(2 + Z, 7 - Z), BoardY(2 + Z, 7 - Z)), 10, 15: PAINT (BoardX(2 + Z, 7 - Z), BoardY(2 + Z, 7 - Z)), 15
BoardRun(3 + Z, 6 - Z) = 1: CIRCLE (BoardX(3 + Z, 6 - Z), BoardY(3 + Z, 6 - Z)), 10, 15: PAINT (BoardX(3 + Z, 6 - Z), BoardY(3 + Z, 6 - Z)), 15
BoardRun(4 + Z, 5 - Z) = 1: CIRCLE (BoardX(4 + Z, 5 - Z), BoardY(4 + Z, 5 - Z)), 10, 15: PAINT (BoardX(4 + Z, 5 - Z), BoardY(4 + Z, 5 - Z)), 15
END IF
NEXT
FOR Z = 1 TO 5
IF (BoardPlayer(Z, 10 - Z) = Player OR BoardSpace(Z, 10 - Z) = 38) AND (BoardPlayer(1 + Z, 9 - Z) = Player OR BoardSpace(1 + Z, 9 - Z) = 38) AND (BoardPlayer(2 + Z, 8 - Z) = Player OR BoardSpace(2 + Z, 8 - Z) = 38) AND (BoardPlayer(3 + Z, 7 - Z) = Player OR BoardSpace(3 + Z, 7 - Z) = 38) AND (BoardPlayer(4 + Z, 6 - Z) = Player OR BoardSpace(4 + Z, 6 - Z) = 38) THEN
X(5) = 1
IF BoardSpace(Z, 10 - Z) <> 38 THEN BoardRun(Z, 10 - Z) = 1: CIRCLE (BoardX(Z, 10 - Z), BoardY(Z, 10 - Z)), 10, 15: PAINT (BoardX(Z, 10 - Z), BoardY(Z, 10 - Z)), 15
IF BoardSpace(1 + Z, 9 - Z) <> 38 THEN BoardRun(1 + Z, 9 - Z) = 1: CIRCLE (BoardX(1 + Z, 9 - Z), BoardY(1 + Z, 9 - Z)), 10, 15: PAINT (BoardX(1 + Z, 9 - Z), BoardY(1 + Z, 9 - Z)), 15
IF BoardSpace(2 + Z, 8 - Z) <> 38 THEN BoardRun(2 + Z, 8 - Z) = 1: CIRCLE (BoardX(2 + Z, 8 - Z), BoardY(2 + Z, 8 - Z)), 10, 15: PAINT (BoardX(2 + Z, 8 - Z), BoardY(2 + Z, 8 - Z)), 15
IF BoardSpace(3 + Z, 7 - Z) <> 38 THEN BoardRun(3 + Z, 7 - Z) = 1: CIRCLE (BoardX(3 + Z, 7 - Z), BoardY(3 + Z, 7 - Z)), 10, 15: PAINT (BoardX(3 + Z, 7 - Z), BoardY(3 + Z, 7 - Z)), 15
IF BoardSpace(4 + Z, 6 - Z) <> 38 THEN BoardRun(4 + Z, 6 - Z) = 1: CIRCLE (BoardX(4 + Z, 6 - Z), BoardY(4 + Z, 6 - Z)), 10, 15: PAINT (BoardX(4 + Z, 6 - Z), BoardY(4 + Z, 6 - Z)), 15
END IF
NEXT
FOR Z = 0 TO 3
IF BoardPlayer(2 + Z, 9 - Z) = Player AND BoardPlayer(3 + Z, 8 - Z) = Player AND BoardPlayer(4 + Z, 7 - Z) = Player AND BoardPlayer(5 + Z, 6 - Z) = Player AND BoardPlayer(6 + Z, 5 - Z) = Player THEN
X(6) = 1
BoardRun(2 + Z, 9 - Z) = 1: CIRCLE (BoardX(2 + Z, 9 - Z), BoardY(2 + Z, 9 - Z)), 10, 15: PAINT (BoardX(2 + Z, 9 - Z), BoardY(2 + Z, 9 - Z)), 15
BoardRun(3 + Z, 8 - Z) = 1: CIRCLE (BoardX(3 + Z, 8 - Z), BoardY(3 + Z, 8 - Z)), 10, 15: PAINT (BoardX(3 + Z, 8 - Z), BoardY(3 + Z, 8 - Z)), 15
BoardRun(4 + Z, 7 - Z) = 1: CIRCLE (BoardX(4 + Z, 7 - Z), BoardY(4 + Z, 7 - Z)), 10, 15: PAINT (BoardX(4 + Z, 7 - Z), BoardY(4 + Z, 7 - Z)), 15
BoardRun(5 + Z, 6 - Z) = 1: CIRCLE (BoardX(5 + Z, 6 - Z), BoardY(5 + Z, 6 - Z)), 10, 15: PAINT (BoardX(5 + Z, 6 - Z), BoardY(5 + Z, 6 - Z)), 15
BoardRun(6 + Z, 5 - Z) = 1: CIRCLE (BoardX(6 + Z, 5 - Z), BoardY(6 + Z, 5 - Z)), 10, 15: PAINT (BoardX(6 + Z, 5 - Z), BoardY(6 + Z, 5 - Z)), 15
END IF
NEXT
FOR Z = 0 TO 2
IF BoardPlayer(3 + Z, 9 - Z) = Player AND BoardPlayer(4 + Z, 8 - Z) = Player AND BoardPlayer(5 + Z, 7 - Z) = Player AND BoardPlayer(5 + Z, 6 - Z) = Player AND BoardPlayer(7 + Z, 5 - Z) = Player THEN
X(7) = 1
BoardRun(3 + Z, 9 - Z) = 1: CIRCLE (BoardX(3 + Z, 9 - Z), BoardY(3 + Z, 9 - Z)), 10, 15: PAINT (BoardX(3 + Z, 9 - Z), BoardY(3 + Z, 9 - Z)), 15
BoardRun(4 + Z, 8 - Z) = 1: CIRCLE (BoardX(4 + Z, 8 - Z), BoardY(4 + Z, 8 - Z)), 10, 15: PAINT (BoardX(4 + Z, 8 - Z), BoardY(4 + Z, 8 - Z)), 15
BoardRun(5 + Z, 7 - Z) = 1: CIRCLE (BoardX(5 + Z, 7 - Z), BoardY(5 + Z, 7 - Z)), 10, 15: PAINT (BoardX(5 + Z, 7 - Z), BoardY(5 + Z, 7 - Z)), 15
BoardRun(6 + Z, 6 - Z) = 1: CIRCLE (BoardX(6 + Z, 6 - Z), BoardY(6 + Z, 6 - Z)), 10, 15: PAINT (BoardX(6 + Z, 6 - Z), BoardY(6 + Z, 6 - Z)), 15
BoardRun(7 + Z, 5 - Z) = 1: CIRCLE (BoardX(7 + Z, 5 - Z), BoardY(7 + Z, 5 - Z)), 10, 15: PAINT (BoardX(7 + Z, 5 - Z), BoardY(7 + Z, 5 - Z)), 15
END IF
NEXT
FOR Z = 0 TO 1
IF BoardPlayer(4 + Z, 9 - Z) = Player AND BoardPlayer(5 + Z, 8 - Z) = Player AND BoardPlayer(6 + Z, 7 - Z) = Player AND BoardPlayer(7 + Z, 6 - Z) = Player AND BoardPlayer(8 + Z, 5 - Z) = Player THEN
X(8) = 1
BoardRun(4 + Z, 9 - Z) = 1: CIRCLE (BoardX(4 + Z, 9 - Z), BoardY(4 + Z, 9 - Z)), 10, 15: PAINT (BoardX(4 + Z, 9 - Z), BoardY(4 + Z, 9 - Z)), 15
BoardRun(5 + Z, 8 - Z) = 1: CIRCLE (BoardX(5 + Z, 8 - Z), BoardY(5 + Z, 8 - Z)), 10, 15: PAINT (BoardX(5 + Z, 8 - Z), BoardY(5 + Z, 8 - Z)), 15
BoardRun(6 + Z, 7 - Z) = 1: CIRCLE (BoardX(5 + Z, 7 - Z), BoardY(6 + Z, 7 - Z)), 10, 15: PAINT (BoardX(6 + Z, 7 - Z), BoardY(6 + Z, 7 - Z)), 15
BoardRun(7 + Z, 6 - Z) = 1: CIRCLE (BoardX(7 + Z, 6 - Z), BoardY(7 + Z, 6 - Z)), 10, 15: PAINT (BoardX(7 + Z, 6 - Z), BoardY(7 + Z, 6 - Z)), 15
BoardRun(8 + Z, 5 - Z) = 1: CIRCLE (BoardX(8 + Z, 5 - Z), BoardY(8 + Z, 5 - Z)), 10, 15: PAINT (BoardX(8 + Z, 5 - Z), BoardY(8 + Z, 5 - Z)), 15
END IF
NEXT
IF BoardPlayer(5, 9) = Player AND BoardPlayer(6, 8) = Player AND BoardPlayer(7, 7) = Player AND BoardPlayer(8, 6) = Player AND BoardPlayer(9, 5) = Player THEN
X(9) = 1
BoardRun(5, 9) = 1: CIRCLE (BoardX(5, 9), BoardY(5, 9)), 10, 15: PAINT (BoardX(5, 9), BoardY(5, 9)), 15
BoardRun(6, 8) = 1: CIRCLE (BoardX(6, 8), BoardY(6, 8)), 10, 15: PAINT (BoardX(6, 8), BoardY(6, 8)), 15
BoardRun(7, 7) = 1: CIRCLE (BoardX(7, 7), BoardY(7, 7)), 10, 15: PAINT (BoardX(7, 7), BoardY(7, 7)), 15
BoardRun(8, 6) = 1: CIRCLE (BoardX(8, 6), BoardY(8, 6)), 10, 15: PAINT (BoardX(8, 6), BoardY(8, 6)), 15
BoardRun(9, 5) = 1: CIRCLE (BoardX(9, 5), BoardY(9, 5)), 10, 15: PAINT (BoardX(9, 5), BoardY(9, 5)), 15
END IF
X4 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
END IF
IF X1 + X2 + X3 + X4 > 1 THEN CheckWinner = Player ELSE CheckWinner = 0
END FUNCTION
SUB DisplayWinner (Player)
LINE (DiceX(1) - 55, 295)-(DiceX(5) + 55, 595), 1, BF
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
COLOR 15, 1: font& = _LOADFONT(fontpath$, 28): _FONT font&:
_PRINTSTRING (780, 670), " Player " + STR$(Player) + " is the Winner! "
_PRINTSTRING (780, 705), " Play Another Game? (Y or N) "
YorN: A$ = UCASE$(INKEY$): IF A$ = "" GOTO YorN
IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
IF A$ = "Y" THEN RUN
IF A$ = "N" THEN SYSTEM
GOTO YorN
END SUB