Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Doubles Wild Board Game
#1
Quote:Hello All,

Doubles Wild is a 2 to 4 player strategy board game with some luck.

Object of the game: The player scoring the most 3 in a rows at the end of the is the winner.
The ends when the current player taking their turn has no balls left to play.
If the game ends in a tie, the board is cleared and those players who tied, starts another game and the first player to get 1 or more 3 in a row wins.

The wooden board consist of 81 dimples where balls can be placed, 9 X 9 board. Around the outside of the dimples are row and column numbers from 3 to 11. Just outside the rows and column numbers are piece storage cutouts to hold each player's pieces. Outside the storage areas are peg holes to indicate how many 3 in a row each player has with peg in the first hole indicating none.
In a 2 player game, each player has 24 balls. Player 1 uses the blue balls and player 2 uses the red ones. With 3 players, each player has 18 pieces each. Player 3 plays the purple balls. With 4 players, each player has 12 balls and player 4 uses the green balls.

A turn consist of the player rolling 4 dice, 2 red and 2 blue. The red dice are added together and the total represents the red rows on the sides of the board. The blue dice are also added together with the total representing then blue columns at the top and bottom of the board. Example: Player rolls a red 5 & 4, blue 2 & 4. That would be Row 9, column 6.

A square cursor surrounds the numbers that's representing the rows and columns. There is also a round cursor at that board location if that position is playable. If that location already has the current player's piece on it or if an opponents piece is part of a 3 in a row at that position, that location is blocked and can not be played there. If the location is empty, the player may place their ball there. If an opponent has a piece there and it is not part of a 3 in a row, the player can declare a battle for that position.

If the player rolls doubles of the red or blue dice, they can place their piece at any playable location on the other row or column that not doubles. Example: If a player rolls double red 4's and a blue 3 and 5, the play may place their piece at any playable row on column 8 and vice versa. If the player rolls doubles on the red and blue dice, the player can place their piece at any playable location on the board. A ball is placed on the board by clicking at that location.
Each player, if chooses, may re-roll 1 or both pairs of dice once per turn. The player may re-roll 1 pair or all dice. If after the second roll, that position is blocked, that player ends their turn. If the location is empty, they must place their piece there. If the location is occupied by an opponent and not part of a 3 in a row, that player must engage a battle for that position.

Once battle is engaged, the battle board appears on right side of the screen. Both players use 3 dice each in the battle. The player that engaged the battle is the Attacker and uses the red dice. The other player is the Defender and uses the blue dice. The best of 3 rolls wins the battle. If the players tie after 3 rolls, the Defender wins the battle. At the start of the battle, all dice are blank. Both player uses the "R O L L D I C E" button to roll their dice. The begins with the Attacker rolling first, then the Defender. The second and third rolls done the same. The Attacker choose which dice they wish to keep by clicking on the dice and a cursor will surround that dice. If clicked again, it will be de-selected. The players may choose 1, 2 ,3 or none of the dice to keep. The Attacker always rolls first. If the Defender wins the battle, their ball remains at that location and if the Attacker wins, their ball will replace the Defenders ball.

At the end of each turn, all 3 in a rows will be calculated and the player's peg position will be updated.

Hope you enjoy playing.

Donald

   

   

   

Code: (Select All)
_Title "Doubles Wild - Designed by Andy Daniel 2001 - Programmed by Donald L. Foster Jr. 2019"

Screen _NewImage(1440, 900, 32)

Randomize Timer

'_PALETTECOLOR 1, _RGB32(109, 39, 0) ' background
'_PALETTECOLOR 2, _RGB32(205, 134, 66) ' LT Square
'_PALETTECOLOR 3, _RGB32(184, 104, 36) ' MED Piece
'_PALETTECOLOR 4, _RGB32(154, 74, 6) ' DK Piece

Background&& = _RGB(109, 39, 0)
Board&& = _RGB(204, 124, 56)
DkBoard&& = _RGB(154, 74, 6)
LtBoard&& = _RGB(235, 164, 96)
White&& = _RGB(255, 255, 255)
Black&& = _RGB(0, 0, 0)
BlueDice&& = _RGB(0, 70, 215)
RedDice&& = _RGB(210, 0, 0)
BlueBall&& = _RGB(0, 0, 200)
RedBall&& = _RGB(200, 0, 0)
YellowBall&& = _RGB(128, 0, 128)
GreenBall&& = _RGB(0, 110, 0)

Dim BoardX(11, 11), BoardY(11, 11) As Integer
Dim BoardPlayer(11, 11), Playable(11, 11) As Integer
Dim PlayerPegX(4, 35), PlayerPegY(4, 35) As Integer
Dim StorageX(4, 24), StorageY(4, 24) As Integer
Dim RowX(11, 2), RowY(11, 2), ColumnX(11, 2), ColumnY(11, 2) As Integer
Dim Blocked(11, 11) As Integer

PlayerColor&&(1) = BlueBall&&
PlayerColor&&(2) = RedBall&&
PlayerColor&&(3) = YellowBall&&
PlayerColor&&(4) = GreenBall&&

Player = 1:

BattleMessage1$(1, 1) = "Attacker, Roll Your First Roll."
BattleMessage1$(2, 1) = "Defender, Roll Your First Roll."
BattleMessage1$(1, 2) = "Attacker, Choose Dice To Keep. "
BattleMessage1$(2, 2) = "Defender, Choose Dice To Keep. "
BattleMessage1$(1, 3) = "Attacker, Choose Dice To Keep. "
BattleMessage1$(2, 3) = "Defender, Choose Dice To Keep. "
BattleMessage2$(1, 1) = " "
BattleMessage2$(2, 1) = " "
BattleMessage2$(1, 2) = " Then Roll Your Second Roll. "
BattleMessage2$(2, 2) = " Then Roll Your Second Roll. "
BattleMessage2$(1, 3) = " Then Roll Your Third Roll. "
BattleMessage2$(2, 3) = " Then Roll Your Third Roll. "
BattleWinner$(1) = " Attacker Won The Battle!!! "
BattleWinner$(2) = " Defender Won The Battle!!! "
PressEnter$ = " Press <ENTER> To Continue. "

' Set Background Color
Cls , Background&&

Line (901, 10)-(1430, 890), Board&&, BF

' Draw DOUBLES WILD
Locate 1, 1: Print " D O U B L E S W I L D ";
W1 = 7: W2 = 0
For Z1 = 1 To 12
V2 = 0
For Y1 = 0 To 13
U2 = 0
For X1 = W1 To W1 + 9
If Point(X1, Y1) = White&& Then
If Z1 > 8 Then
If Y1 >= 0 And Y1 < 4 Then Color PlayerColor&&(1) Else If Y1 > 3 And Y1 < 7 Then Color PlayerColor&&(2) Else If Y1 > 6 And Y1 < 10 Then Color PlayerColor&&(3) Else Color PlayerColor&&(4)
Else
Color White&&
End If
Line (950 + U2 + W2, 20 + V2)-(952 + U2 + W2, 22 + V2), , BF
End If
U2 = U2 + 3
Next
V2 = V2 + 3
Next
W1 = W1 + 16: If Z1 > 8 Then W2 = W2 + 30 Else W2 = W2 + 40
Next
Line (0, 0)-(200, 20), Background&&, BF
Color Black&&: X = 0: For Z = 1 To 6: Circle (983 + X, 41), 4: Paint (983 + X, 41): X = X + 40: Next

' Draw Board
PSet (10, 870), Board&&: Draw "U860R860D860L860F20R860NH20U860H20"
Paint (100, 860), Board&&: Paint (100, 880), DkBoard&&, Board&&: Paint (880, 100), DkBoard&&, Board&&
X = 200
For Z = 11 To 3 Step -1
V = 200
For Y = 3 To 11
X1 = V: X2 = X: GoSub DrawDimple
BoardX(Z, Y) = V: BoardY(Z, Y) = X
V = V + 60
Next
X = X + 60
Next

' Draw Numbers on the Board
Color White&&, Board&&: Locate 5, 150: Print " 3 4 5 6 7 8 9 10 11 ";
W1 = 1191: W2 = 0: T2 = 0
For Z1 = 1 To 9
V2 = 0
For Y1 = 65 To 78
U2 = 0
For X1 = W1 To W1 + 17
If Point(X1, Y1) = White&& Then
If Z1 > 7 Then S2 = 7 Else S2 = 0
Line (177 + W2 + U2, 134 + V2)-(178 + W2 + U2, 135 + V2), BlueDice&&, BF: ColumnX(Z1 + 2, 1) = 200 + T2: ColumnY(Z1 + 2, 1) = 145
Line (177 + W2 + U2, 724 + V2)-(178 + W2 + U2, 725 + V2), BlueDice&&, BF: ColumnX(Z1 + 2, 2) = 200 + T2: ColumnY(Z1 + 2, 2) = 735
Line (122 + U2 + S2, 667 + V2 - T2)-(123 + U2 + S2, 668 + V2 - T2), RedDice&&, BF: RowX(Z1 + 2, 1) = 146: RowY(Z1 + 2, 1) = 665 - T2 + 13
Line (709 + U2 + S2, 667 + V2 - T2)-(710 + U2 + S2, 668 + V2 - T2), RedDice&&, BF: RowX(Z1 + 2, 2) = 733: RowY(Z1 + 2, 2) = 665 - T2 + 13
End If
U2 = U2 + 2
Next
V2 = V2 + 2
Next
W1 = W1 + 24: T2 = T2 + 60: If Z1 = 7 Then W2 = W2 + 66 Else W2 = W2 + 60
Next
Line (1180, 60)-(1410, 80), Board&&, BF

' Setup Storage Spaces
Color LtBoard&&
Circle (150, 83), 40, , 1.50, 4.80: Circle (730, 83), 40, , 4.60, 1.60
Circle (83, 150), 40, , 0, 3.10: Circle (797, 150), 40, , 0, 3.10
Circle (83, 730), 40, , 3.10, 0: Circle (797, 730), 40, , 3.10, 0
Circle (150, 797), 40, , 1.50, 4.80: Circle (730, 797), 40, , 4.60, 1.60
Line (150, 43)-(730, 43): Line (150, 123)-(730, 123)
Line (150, 757)-(730, 757): Line (150, 837)-(730, 837)
Line (43, 150)-(43, 730): Line (123, 150)-(123, 730)
Line (757, 150)-(757, 730): Line (837, 150)-(837, 730)
Paint (400, 60): Paint (400, 800): Paint (80, 400): Paint (800, 400)


Line (911, 70)-(1420, 880), White&&, B

Color Black&&, Board&&: Locate 7, 133: Print "How Many Players? ( 2 to 4 )";

For Z = 1 To 15: A$ = InKey$: Next
GetPlayers: A$ = InKey$: If A$ = "" GoTo GetPlayers Else If Val(A$) > 1 And Val(A$) < 5 Then Players = Val(A$) Else GoTo GetPlayers

Color Black&&, Board&&: Locate 7, 133: Print " ";

GoSub PlaceBalls: GoSub UpdatePegs




StartTurn:
BattleEngaged = 0: Roll = 1

' Draw Player Indicator
X1 = 1165: X2 = 180: X3 = Player: GoSub DrawBall
Color Black&&, Board&&: Locate 14, 143: Print "Player"; Player

RollDice:
Color Black&&, Board&&: Locate 42, 141: Print "R O L L: "; Roll;

' Check for End of Game
If Pieces(Player) = 0 Then
Color Black&&, Board&&: Locate 52, 120: Print " Player"; Player; "You Have No Pieces Left to Play. ";
Color Black&&, Board&&: Locate 54, 120: Print " Press <ENTER> to Continue. ";
For Z = 1 To 15: A$ = InKey$: Next
ENTER: A$ = InKey$: If A$ = "" GoTo ENTER Else If Asc(A$) <> 13 GoTo ENTER
For Z = 50 To 52 Step 2: Locate Z, 120: Print String$(55, 32);: Next
WinningScore = 0
For Z = 1 To Players
If Score(Z) > WinningScore Then WinningScore = Score(Z)
Next
Winners = 0
For Z = 1 To Players
If Score(Z) = WinningScore Then Winners = Winners + 1: Winner(Winners) = Z: Winner = Z
Next
If Winners > 1 Then
Color Black&&, Board&&: Locate 52, 120: Print " The Game Ended in a Tie. First 3 In A Row Wins!!! ";
Color Black&&, Board&&: Locate 54, 120: Print " Press <ENTER> to Start the Next Round. ";
For Z = 1 To 15: A$ = InKey$: Next
ENTER1: A$ = InKey$: If A$ = "" GoTo ENTER1 Else If Asc(A$) <> 13 GoTo ENTER1
Line (30, 16)-(860, 36), Board&&, BF: Line (30, 844)-(860, 864), Board&&, BF
GoSub ClearBoard: GoSub PlaceBalls: NextTurn = 1: Roll = 1
Score(1) = 0: Score(2) = 0: Score(3) = 0: Score(4) = 0: GoSub UpdatePegs
Counter = 1: Player = Winner(1): GoTo StartTurn
Else

X1 = 1165: X2 = 180: X3 = Winner: GoSub DrawBall
Color Black&&, Board&&: Locate 14, 143: Print "Player"; Winner;
Color Black&&, Board&&: Locate 52, 120: Print " Player"; Winner; "is the Winner!!! ";
Color Black&&, Board&&: Locate 54, 120: Print " Play Another Game? ( Y or N ) ";
For Z = 1 To 15: A$ = InKey$: Next
GetYorN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo GetYorN
End If
End If


' Draw All 4 Dice Cubes
X2 = 359: For Z = 1 To 2: X1 = 1010: For Y = 1 To 2: X4 = Z: DiceX(Z, Y) = X1: DiceY(Z, Y) = X2: GoSub DrawDice: X1 = X1 + 128: Next: X2 = X2 + 128: Next

GoSub DrawButtons: GoSub ResetButtons

' Roll Dice
For Z = 1 To 12
For Y = 1 To 2
For X = 1 To 2
If Roll > 1 And RollDice(Y) = 0 GoTo RollLoop
X3 = Int(Rnd * 6) + 1: Dice(Y, X) = X3
X4 = Y: X1 = DiceX(Y, X): X2 = DiceY(Y, X): GoSub DrawDots
_Delay .05
RollLoop:
Next
Next
Next

SetupRowColumn:
If Dice(1, 1) = Dice(1, 2) Then Row = 0 Else Row = Dice(1, 1) + Dice(1, 2)
If Dice(2, 1) = Dice(2, 2) Then Column = 0 Else Column = Dice(2, 1) + Dice(2, 2)

' Place Cursors at Row and Column if not Wild
Color White&&
If Row > 0 Then
Line (RowX(Row, 1) - 19, RowY(Row, 1) - 19)-(RowX(Row, 1) + 19, RowY(Row, 1) + 19), , B
Line (RowX(Row, 2) - 19, RowY(Row, 2) - 19)-(RowX(Row, 2) + 19, RowY(Row, 2) + 19), , B
End If

If Column > 0 Then
Line (ColumnX(Column, 1) - 19, ColumnY(Column, 1) - 19)-(ColumnX(Column, 1) + 19, ColumnY(Column, 1) + 19), , B
Line (ColumnX(Column, 2) - 19, ColumnY(Column, 2) - 19)-(ColumnX(Column, 2) + 19, ColumnY(Column, 2) + 19), , B
End If

Playable = 0
If Row = 0 And Column = 0 Then
For Z = 3 To 11
For Y = 3 To 11
If BoardPlayer(Z, Y) <> Player And Blocked(Z, Y) = 0 Then Circle (BoardX(Z, Y), BoardY(Z, Y)), 27, White&&: Playable(Z, Y) = 1: Playable = 1
Next
Next
If Playable = 1 Then Color Black&&, Board&&: Locate 52, 120: Print " Place Your Ball On Any Playable Position on the Board. ";
ElseIf Row = 0 Then
For Z = 3 To 11
If BoardPlayer(Z, Column) <> Player And Blocked(Z, Column) = 0 Then Circle (BoardX(Z, Column), BoardY(Z, Y)), 27, White&&: Playable(Z, Column) = 1: Playable = 1
Next
If Playable = 1 Then Color Black&&, Board&&: Locate 52, 120: Print " Place Your Ball on Any Playable Row on Column "; LTrim$(Str$(Column)); ". ";
If Playable = 0 Then Color Black&&, Board&&: Locate 52, 120: Print " There are No Playable Rows on Column "; LTrim$(Str$(Column)); ". ";
ElseIf Column = 0 Then
For Z = 3 To 11
If BoardPlayer(Row, Z) <> Player And Blocked(Row, Z) = 0 Then Circle (BoardX(Row, Z), BoardY(Row, Z)), 27, White&&: Playable(Row, Z) = 1: Playable = 1
Next
If Playable = 1 Then Color Black&&, Board&&: Locate 52, 120: Print " Place Your Ball on Any Playable Column on Row "; LTrim$(Str$(Row)); ". ";
If Playable = 0 Then Color Black&&, Board&&: Locate 52, 120: Print " There are No Playable Columns on Row"; LTrim$(Str$(Row)); ". ";
Else
If BoardPlayer(Row, Column) <> Player And Blocked(Row, Column) = 0 Then Circle (BoardX(Row, Column), BoardY(Row, Column)), 27, White&&: Playable(Row, Column) = 1: Playable = 1
If Playable = 1 Then
If BoardPlayer(Row, Column) <> 0 And BoardPlayer(Row, Column) <> Player Then
Color Black&&, Board&&: Locate 52, 120: Print "You May Battle the Player at Position Row "; LTrim$(Str$(Row)); ", Column "; LTrim$(Str$(Column)); ". ";
Else
Color Black&&, Board&&: Locate 52, 120: Print " You May Place Your Ball at Position Row "; LTrim$(Str$(Row)); ", Column "; LTrim$(Str$(Column)); ". ";
End If
End If
If Playable = 0 Then Color Black&&, Board&&: Locate 52, 120: Print " The Position at Row "; LTrim$(Str$(Row)); ", Column"; Column; "is Blocked. ";
End If

If Roll = 1 Then Color Black&&, Board&&: Locate 54, 120: Print " Or Roll One or Both Pairs of Dice. ";
If Roll = 2 Then
If Playable = 0 Then
Color Black&&, Board&&: Locate 54, 120: Print " Press <ENTER> to Continue. ";
For Z = 1 To 15: A$ = InKey$: Next
Continue: A$ = InKey$: If A$ = "" GoTo Continue Else If Asc(A$) <> 13 GoTo Continue
GoSub RemoveCursors: GoTo EndTurn
Else
Color Black&&, Board&&: Locate 54, 120: Print " ";
End If
End If

GetMoveInput:
Do While _MouseInput
' Check Red Dice KEEP / ROLL Button
If _MouseX > 1261 And _MouseX < 1336 And _MouseY > 336 And _MouseY < 380 And _MouseButton(1) = -1 And Roll = 1 Then
GoSub MouseButtonRelease: Color Black&&, LtBoard&&: Locate 23, 160
If RedDiceButton = 0 Then RedDiceButton = 1: Print "R O L L"; Else RedDiceButton = 0: Print "K E E P";
GoSub UpdateRollButton: GoTo GetMoveInput
End If

' Check Blue Dice KEEP / ROLL Button
If _MouseX > 1261 And _MouseX < 1336 And _MouseY > 446 And _MouseY < 508 And _MouseButton(1) = -1 And Roll = 1 Then
GoSub MouseButtonRelease: Color Black&&, LtBoard&&: Locate 31, 160
If BlueDiceButton = 0 Then BlueDiceButton = 1: Print "R O L L"; Else BlueDiceButton = 0: Print "K E E P";
GoSub UpdateRollButton: GoTo GetMoveInput
End If

' Check Roll Dice Button
If _MouseX > 1094 And _MouseX < 1236 And _MouseY > 577 And _MouseY < 619 And _MouseButton(1) = -1 And DiceRollButton = 1 And Roll = 1 Then
GoSub MouseButtonRelease: Roll = Roll + 1: Color Black&&, Board&&: Locate 42, 141: Print "R O L L: "; Roll;
For Z = 1 To 20
For Y = 1 To 2
If RedDiceButton = 1 Then X3 = Int(Rnd * 6) + 1: Dice(1, Y) = X3: X4 = 1: X1 = DiceX(1, Y): X2 = DiceY(1, Y): GoSub DrawDots
If BlueDiceButton = 1 Then X3 = Int(Rnd * 6) + 1: Dice(2, Y) = X3: X4 = 2: X1 = DiceX(2, Y): X2 = DiceY(2, Y): GoSub DrawDots
_Delay .05
Next
Next
GoSub ResetButtons: GoSub RemoveCursors: GoTo SetupRowColumn
End If

' Check Board Locations and Place Ball
For Z = 3 To 11
For Y = 3 To 11
If _MouseX > BoardX(Z, Y) - 20 And _MouseX < BoardX(Z, Y) + 20 And _MouseY > BoardY(Z, Y) - 20 And _MouseY < BoardY(Z, Y) + 20 And _MouseButton(1) = -1 And Playable(Z, Y) = 1 Then
Row = Z: Column = Y: GoSub MouseButtonRelease: GoSub ResetButtons: GoSub RemoveCursors
If BoardPlayer(Z, Y) <> 0 And BoardPlayer(Z, Y) <> Player Then Circle (BoardX(Z, Y), BoardY(Z, Y)), 27, White&&: GoSub BattleEngaged: GoTo EndMoveInput
Paint (StorageX(Player, Pieces(Player)), StorageY(Player, Pieces(Player))), LtBoard&&: Pieces(Player) = Pieces(Player) - 1
BoardPlayer(Z, Y) = Player: X1 = BoardX(Z, Y): X2 = BoardY(Z, Y): X3 = Player: GoSub DrawBall: GoTo EndMoveInput
End If
Next
Next
Loop
GoTo GetMoveInput

EndMoveInput:
' Check for Player's Three in a Rows
Score(Player) = 0
For Z = 3 To 11
For Y = 3 To 9
If BoardPlayer(Z, Y) = Player And BoardPlayer(Z, Y + 1) = Player And BoardPlayer(Z, Y + 2) = Player Then Score(Player) = Score(Player) + 1: Blocked(Z, Y) = 1: Blocked(Z, Y + 1) = 1: Blocked(Z, Y + 2) = 1
If BoardPlayer(Y, Z) = Player And BoardPlayer(Y + 1, Z) = Player And BoardPlayer(Y + 2, Z) = Player Then Score(Player) = Score(Player) + 1: Blocked(Y, Z) = 1: Blocked(Y + 1, Z) = 1: Blocked(Y + 2, Z) = 1
Next
Next
For Z = 3 To 9
For Y = 3 To 9
If BoardPlayer(Z, Y) = Player And BoardPlayer(Z + 1, Y + 1) = Player And BoardPlayer(Z + 2, Y + 2) = Player Then Score(Player) = Score(Player) + 1: Blocked(Z, Y) = 1: Blocked(Z + 1, Y + 1) = 1: Blocked(Z + 2, Y + 2) = 1
If BoardPlayer(Z, Y + 2) = Player And BoardPlayer(Z + 1, Y + 1) = Player And BoardPlayer(Z + 2, Y) = Player Then Score(Player) = Score(Player) + 1: Blocked(Z, Y + 2) = 1: Blocked(Z + 1, Y + 1) = 1: Blocked(Z + 2, Y) = 1
Next
Next

GoSub UpdatePegs

EndTurn:
Roll = 1: GoSub ResetButtons

If NextTurn = 1 Then
If Score(Player) > 0 Then
X1 = 1165: X2 = 180: X3 = Player: GoSub DrawBall
Color Black&&, Board&&: Locate 14, 143: Print "Player"; Winner(1)
Color Black&&, Board&&: Locate 52, 120: Print " Player"; Player; "is the Winner!!! ";
Color Black&&, Board&&: Locate 54, 120: Print " Play Another Game? ( Y or N ) ";
For Z = 1 To 15: A$ = InKey$: Next
YorN: A$ = UCase$(InKey$): If A$ = "" GoTo YorN
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo YorN
End If
If Counter = Winners Then Counter = 1 Else Counter = Counter + 1
Player = Winner(Counter)
Else
If Player = Players Then Player = 1 Else Player = Player + 1
End If

GoTo StartTurn


MouseButtonRelease:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo MouseButtonRelease


DrawBall:
Color PlayerColor&&(X3)
Circle (X1, X2), 20: Paint (X1, X2)
Circle (X1 - 6, X2 - 6), 3, White&&: Paint (X1 - 6, X2 - 6), White&&

Return


PlaceBalls:
If Players = 2 Then
Pieces(1) = 24: Pieces(2) = 24
X = 0: V = 24
For Z = 1 To 23 Step 2
X3 = 2: X1 = 153 + X: X2 = 66: GoSub DrawBall: StorageX(2, V) = X1: StorageY(2, V) = X2
X1 = 178 + X: X2 = 100: GoSub DrawBall: StorageX(2, V - 1) = X1: StorageY(2, V - 1) = X2
X3 = 1: X1 = 178 + X: X2 = 814: GoSub DrawBall: StorageX(1, Z + 1) = X1: StorageY(1, Z + 1) = X2
X1 = 153 + X: X2 = 780: GoSub DrawBall: StorageX(1, Z) = X1: StorageY(1, Z) = X2
X = X + 50: V = V - 2
_Delay .025
Next
ElseIf Players = 3 Then
Pieces(1) = 16: Pieces(2) = 16: Pieces(3) = 16
X = 0: V = 16
For Z = 1 To 15 Step 2
X3 = 2: X1 = 161 + X: X2 = 66: GoSub DrawBall: StorageX(2, V) = X1: StorageY(2, V) = X2
X1 = 198 + X: X2 = 100: GoSub DrawBall: StorageX(2, V - 1) = X1: StorageY(2, V - 1) = X2
X3 = 1: X1 = 198 + X: X2 = 814: GoSub DrawBall: StorageX(1, Z + 1) = X1: StorageY(1, Z + 1) = X2
X1 = 161 + X: X2 = 780: GoSub DrawBall: StorageX(1, Z) = X1: StorageY(1, Z) = X2
X3 = 3: X1 = 66: X2 = 198 + X: GoSub DrawBall: StorageX(3, Z + 1) = X1: StorageY(3, Z + 1) = X2
X1 = 100: X2 = 161 + X: GoSub DrawBall: StorageX(3, Z) = X1: StorageY(3, Z) = X2
X = X + 75: V = V - 2
_Delay .025
Next
Else
X = 0: V = 12
Pieces(1) = 12: Pieces(2) = 12: Pieces(3) = 12: Pieces(4) = 12
For Z = 1 To 12
X3 = 2: X1 = 154 + X: X2 = 83: GoSub DrawBall: StorageX(2, V) = X1: StorageY(2, V) = X2
X3 = 1: X1 = 154 + X: X2 = 797: GoSub DrawBall: StorageX(1, Z) = X1: StorageY(1, Z) = X2
X3 = 3: X1 = 83: X2 = 154 + X: GoSub DrawBall: StorageX(3, Z) = X1: StorageY(3, Z) = X2
X3 = 4: X1 = 797: X2 = 154 + X: GoSub DrawBall: StorageX(4, V) = X1: StorageY(4, V) = X2
X = X + 52: V = V - 1
_Delay .025
Next
End If
Return


ClearBoard:
For Z = 3 To 11
For Y = 3 To 11
BoardPlayer(Z, Y) = 0: Blocked(Z, Y) = 0: Playable(Z, Y) = 0: X1 = BoardX(Z, Y): X2 = BoardY(Z, Y): Color Board&&: Paint (X1, X2): GoSub DrawDimple
Next
Next
Return


DrawDimple:
Circle (X1, X2), 15, LtBoard&&: Paint (X1, X2), LtBoard&&

Return


UpdatePegs:
' Setup Peg Hole Locations
X = 0: V = 0
If Players = 2 And NextTurn = 0 Then X5 = 40: X6 = 840: r = 7 Else X5 = 160: X6 = 720: r = 5
For Z = 1 To r
W = 0
For Y = 1 To 5
PlayerPegX(1, V) = X5 + W + X: PlayerPegY(1, V) = 854
PlayerPegX(2, V) = X6 - W - X: PlayerPegY(2, V) = 26
PlayerPegX(3, V) = 26: PlayerPegY(3, V) = 160 + W + X
PlayerPegX(4, V) = 854: PlayerPegY(4, V) = 720 - W - X
W = W + 20: V = V + 1
Next
X = X + 120
Next


For Z = 1 To 4
If r = 7 And Z < 3 Then s = 34 Else s = 24
For Y = 0 To s
If Score(Z) = Y And Z <= Players Then T = 1: Color White&& Else T = 0: Color DkBoard&&
If NextTurn = 1 Then
If T = 1 Then
X = 0
For W = 1 To Winners
If Z = Winner(W) Then X = 1
Next
If X = 0 Then Color DkBoard&&
End If
End If
Circle (PlayerPegX(Z, Y), PlayerPegY(Z, Y)), 5: Paint (PlayerPegX(Z, Y), PlayerPegY(Z, Y))
_Delay .01
Next
Next
Return


UpdateRollButton:
If Roll = 1 Then
If RedDiceButton = 1 Or BlueDiceButton = 1 Then DiceRollButton = 1: Color Black&&, LtBoard&& Else RollDiceButton = 0: Color White&&, LtBoard&&
Else
Color White&&, LtBoard&&
End If
Locate 38, 138: Print "R O L L D I C E";
Return


ResetButtons:
RedDiceButton = 0: BlueDiceButton = 0: RollDiceButton = 0
Color Black&&, LtBoard&&: Locate 23, 160: Print "K E E P";
Color Black&&, LtBoard&&: Locate 31, 160: Print "K E E P";
Color White&&, LtBoard&&: Locate 38, 138: Print "R O L L D I C E";
Return


DrawButtons:
' Draw ROLL DICE Button
Color LtBoard&&: Circle (1095, 598), 20, , 1.5, 4.8: Circle (1235, 598), 20, , 4.6, 1.6
Line (1095, 578)-(1235, 578): Line (1095, 618)-(1235, 618): Paint (1165, 583)

' Draw Red Dice KEEP / Roll Button
Color LtBoard&&: Circle (1262, 359), 20, , 1.5, 4.8: Circle (1335, 359), 20, , 4.6, 1.6
Line (1262, 339)-(1335, 339): Line (1262, 379)-(1335, 379): Paint (1290, 344)

' Draw Blue Dice KEEP / ROLL Button
Color LtBoard&&: Circle (1262, 487), 20, , 1.5, 4.8: Circle (1335, 487), 20, , 4.6, 1.6
Line (1262, 467)-(1335, 467): Line (1262, 507)-(1335, 507): Paint (1290, 472)
Return


DrawDice:
If X4 = 1 Then Color RedDice&& Else Color BlueDice&&
Circle (X1 - 25, X2 - 25), 10, , 1.50, 3.10: Circle (X1 + 25, X2 - 25), 10, , 0, 1.6
Circle (X1 - 25, X2 + 25), 10, , 3.1, 4.75: Circle (X1 + 25, X2 + 25), 10, , 4.5, 0
Line (X1 - 25, X2 - 35)-(X1 + 25, X2 - 35): Line (X1 - 25, X2 + 35)-(X1 + 25, X2 + 35)
Line (X1 - 35, X2 - 25)-(X1 - 35, X2 + 25): Line (X1 + 35, X2 - 25)-(X1 + 35, X2 + 25)
Paint (X1, X2)
Return


DrawDots:
If X4 = 1 Then Color RedDice&& Else Color BlueDice&&
Line (X1 - 25, X2 - 25)-(X1 + 25, X2 + 25), , BF: Color White&&
If X3 = 1 Or X3 = 3 Or X3 = 5 Then Circle (X1, X2), 5: Paint (X1, X2)
If X3 > 1 Then Circle (X1 - 18, X2 - 18), 5: Paint (X1 - 18, X2 - 18): Circle (X1 + 18, X2 + 18), 5: Paint (X1 + 18, X2 + 18)
If X3 > 3 Then Circle (X1 + 18, X2 - 18), 5: Paint (X1 + 18, X2 - 18): Circle (X1 - 18, X2 + 18), 5: Paint (X1 - 18, X2 + 18)
If X3 = 6 Then Circle (X1 - 18, X2), 5: Paint (X1 - 18, X2): Circle (X1 + 18, X2), 5: Paint (X1 + 18, X2)
Return

RemoveCursors:
Color Board&&: Playable = 0
For r = 11 To 3 Step -1: For s = 3 To 11: Playable(r, s) = 0: Circle (BoardX(r, s), BoardY(r, s)), 27, Board&&: Next: Next
For r = 3 To 11
For s = 1 To 2
Line (RowX(r, s) - 19, RowY(r, s) - 19)-(RowX(r, s) + 19, RowY(r, s) + 19), , B
Line (ColumnX(r, s) - 19, ColumnY(r, s) - 19)-(ColumnX(r, s) + 19, ColumnY(r, s) + 19), , B
Next
Next
Return


BattleEngaged:
Line (912, 71)-(1419, 879), Board&&, BF

AttackerPlayer = Player: DefenderPlayer = BoardPlayer(Row, Column)
Color White&&, Board&&: Locate 7, 127: Print "B A T T L E E N G A G E D";

Color White&&, Board&&: Locate 13, 138: Print "A T T A C K E R :";
Color PlayerColor&&(AttackerPlayer): X1 = 1165: X2 = 240: X3 = AttackerPlayer: GoSub DrawBall
Color Black&&, Board&&: Locate 18, 143: Print "Player"; AttackerPlayer;

Color White&&, Board&&: Locate 38, 138: Print "D E F E N D E R :";
Color PlayerColor&&(DefenderPlayer): X1 = 1165: X2 = 639: X3 = DefenderPlayer: GoSub DrawBall
Color Black&&, Board&&: Locate 43, 143: Print "Player"; DefenderPlayer;

X2 = 350: For Z = 1 To 2: X1 = 1045: For Y = 1 To 3: X4 = Z: BattleDiceX(Z, Y) = X1: BattleDiceY(Z, Y) = X2: GoSub DrawDice: X1 = X1 + 120: Next: X2 = X2 + 178: Next

Color LtBoard&&: Circle (1095, 439), 20, , 1.5, 4.8: Circle (1235, 439), 20, , 4.6, 1.6
Line (1095, 419)-(1235, 419): Line (1095, 459)-(1235, 459): Paint (1165, 439)
Color Black&&, LtBoard&&: Locate 28, 138: Print "R O L L D I C E";

For BattleRoll = 1 To 3
Color Black&&, Board&&: Locate 49, 134: Print "B A T T L E R O L L # ";: Print BattleRoll;
For BattlePlayer = 1 To 2
Color White&&, Board&&: Locate 52, 132: Print BattleMessage1$(BattlePlayer, BattleRoll);
Color White&&, Board&&: Locate 54, 132: Print BattleMessage2$(BattlePlayer, BattleRoll);

If BattlePlayer = 1 Then AttackerColor&& = Background&&: DefenderColor&& = Board&& Else AttackerColor&& = Board&&: DefenderColor&& = Background&&
Line (995, 300)-(1335, 400), AttackerColor&&, B: Line (995, 478)-(1335, 578), DefenderColor&&, B

GetRollDice:
Do While _MouseInput
' Check Roll Dice Button
If _MouseX > 1094 And _MouseX < 1236 And _MouseY > 418 And _MouseY < 460 And _MouseButton(1) = -1 Then GoSub MouseButtonRelease: GoTo BattleRoll
' Check Select Dice
If BattleRoll > 1 Then
For Dice = 1 To 3
If _MouseX > BattleDiceX(BattlePlayer, Dice) - 36 And _MouseX < BattleDiceX(BattlePlayer, Dice) + 36 And _MouseY > BattleDiceY(BattlePlayer, Dice) - 36 And _MouseY < BattleDiceY(BattlePlayer, Dice) + 36 And _MouseButton(1) = -1 Then SelectedDice = Dice: GoSub MouseButtonRelease: GoTo SelectDice
Next
End If
Loop
GoTo GetRollDice

SelectDice:
If SelectedDice(BattlePlayer, SelectedDice) = 1 Then SelectedDice(BattlePlayer, SelectedDice) = 0: Color Board&& Else SelectedDice(BattlePlayer, SelectedDice) = 1: Color White&&
Line (BattleDiceX(BattlePlayer, SelectedDice) - 42, BattleDiceY(BattlePlayer, SelectedDice) - 42)-(BattleDiceX(BattlePlayer, SelectedDice) + 42, BattleDiceY(BattlePlayer, SelectedDice) + 42), , B
GoTo GetRollDice

BattleRoll:
For Z = 1 To 20
For Y = 1 To 3
If BattleRoll > 1 And SelectedDice(BattlePlayer, Y) = 1 GoTo EndRollLoop
X3 = Int(Rnd * 6) + 1: BattleDice(BattlePlayer, Y) = X3
X4 = BattlePlayer: X1 = BattleDiceX(BattlePlayer, Y): X2 = BattleDiceY(BattlePlayer, Y): GoSub DrawDots
_Delay .05
EndRollLoop:
Next
Next

For Z = 1 To 3
SelectedDice(BattlePlayer, Z) = 0
Line (BattleDiceX(BattlePlayer, Z) - 42, BattleDiceY(BattlePlayer, Z) - 42)-(BattleDiceX(BattlePlayer, Z) + 42, BattleDiceY(BattlePlayer, Z) + 42), Board&&, B
Next

EndBattleLoop:
Next
Next

BattleTotal(1) = 0: BattleTotal(2) = 0: For Z = 1 To 2: For Y = 1 To 3: BattleTotal(Z) = BattleTotal(Z) + BattleDice(Z, Y): Next: Next

If BattleTotal(1) > BattleTotal(2) Then BattleWinner = 1 Else BattleWinner = 2

Color White&&, Board&&: Locate 52, 132: Print BattleWinner$(BattleWinner);
Color White&&, Board&&: Locate 54, 132: Print PressEnter$;

For Z = 1 To 15: A$ = InKey$: Next
WinnerEnter: A$ = InKey$: If A$ = "" GoTo WinnerEnter Else If Asc(A$) <> 13 GoTo WinnerEnter

If BattleWinner = 1 Then
BoardPlayer(Row, Column) = Player: X1 = BoardX(Row, Column): X2 = BoardY(Row, Column): X3 = AttackerPlayer: GoSub DrawBall
Paint (StorageX(Player, Pieces(Player)), StorageY(Player, Pieces(Player))), LtBoard&&: Pieces(Player) = Pieces(Player) - 1
End If

Line (912, 71)-(1419, 879), Board&&, BF: Circle (BoardX(Row, Column), BoardY(Row, Column)), 27, Board&&
Return
Reply




Users browsing this thread: 1 Guest(s)