_Title "Lucky Numbers - Coded by Donald L. Foster Jr."
CardColor(1) = 3: CardColor(2) = 4: CardColor(3) = 5: CardColor(4) = 6
fontpath$
= Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"fontpath1$
= Environ$("SYSTEMROOT") + "\fonts\Arial.ttf"
GetPlayers:
' Setup Deck of Cards
DeckCards = Players * 20
Placed: X
= Int(Rnd * DeckCards
) + 1:
If Placed
(X
) = 0 Then Placed
(X
) = 1: DeckCard
(X
) = Z: DeckColor
(X
) = Y
Else GoTo Placed
' Get Board X, Y Positions
X = 186: Board = 1
W = 186
U = X - 122
V = W - 122
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
U = U + 81
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
X = X + 363
X = 186: Board = 1
U = X - 122
V = W - 122
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
U = U + 81
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
X = X + 363
X = 186: W = 186: Board = 1
U = X - 122
V = W - 122
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
U = U + 81
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
X = X + 363: W = W + 363
' Draw Board
V = BoardCenterX(Z): U = BoardCenterY(Z)
Line (V
- 175, U
- 175)-(V
+ 175, U
+ 175), 1, BF
X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = 0: X4 = 0: DrawCard X1, X2, X3, X4
' Setup Table Locations
X = 1: V = 360
U = 800
TableX(X) = U: TableY(X) = V
X = X + 1: U = U + 81
V = V + 81
Locate 45, 760:
Print "Use Michael's Variation? Y or N";
GetVariation:
' Add Starting Cursors for Michael's Variation
Locate 45, 750:
Print " Place Starting Card on Your Board ";
V = BoardCenterX(Z): U = BoardCenterY(Z)
Line (V
- 176, U
- 176)-(V
+ 176, U
+ 176), 15, B
V = BoardX(Z, Y, Y): U = BoardY(Z, Y, Y)
If BoardCard
(Z
, Y
, Y
) = 0 Then Line (V
- 39, U
- 39)-(V
+ 39, U
+ 39), 15, B
Line (V
- 39, U
- 39)-(V
+ 39, U
+ 39), 1, B
X1 = 881: X2 = 110: X3 = Z: X4 = CardColor(Z): DrawCard X1, X2, X3, X4
Card = DeckCard(DeckCards): CardColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1 = 881: X2 = 350: X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4
PlaceStartingCard:
GoSub ReleaseButton:
Line (841, 310)-(921, 390), 0, BF
X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4
Line (BoardX
(Z
, Y
, X
) - 39, BoardY
(Z
, Y
, X
) - 39)-(BoardX
(Z
, Y
, X
) + 39, BoardY
(Z
, Y
, X
) + 39), 1, B
Line (BoardCenterX
(Z
) - 176, BoardCenterY
(Z
) - 176)-(BoardCenterX
(Z
) + 176, BoardCenterY
(Z
) + 176), 0, B
BoardCard
(Z
, Y
, X
) = Card: BoardColor
(Z
, Y
, X
) = CardColor:
GoTo EndPlaceCard
EndPlaceCard:
' Get Hold Cards
HoldCard(Y, Z) = DeckCard(DeckCards): HoldColor(Y, Z) = DeckColor(DeckCards): DeckCards = DeckCards - 1
' Sort Hold Cards
LowCard = 100
If HoldCard
(Z
, X
) < LowCard
And Sorted
(Z
, X
) = 0 Then LowCard
= HoldCard
(Z
, X
): CardColor
= HoldColor
(Z
, X
): T
= X
Sorted(Z, T) = 1: X1 = BoardX(Z, Y, Y): X2 = BoardY(Z, Y, Y): X3 = LowCard: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4
BoardCard(Z, Y, Y) = LowCard: BoardColor(Z, Y, Y) = CardColor
Player = 1: Winner = 0
StartGame:
DrawPile = 0: Table = 0: Occupied = 0
' Draw Player Cursor
Line (BoardCenterX
(Player
) - 176, BoardCenterY
(Player
) - 176)-(BoardCenterX
(Player
) + 176, BoardCenterY
(Player
) + 176), 15, B
Line (BoardCenterX
(Player
) - 177, BoardCenterY
(Player
) - 177)-(BoardCenterX
(Player
) + 177, BoardCenterY
(Player
) + 177), 15, B
X1 = 881: X2 = 110: X3 = Player: X4 = CardColor(Player): DrawCard X1, X2, X3, X4
' Display Deck
X1
= 821: X2
= 240: X3
= 100: X4
= 0: DrawCard X1
, X2
, X3
, X4:
Line (777, 196)-(865, 284), 15, B
'Draw Cursor Around Table If Not Empty
Line (756, 316)-(1006, 646), 15, B
ChooseAPlay:
' Draw a Card From the Deck
GoSub ReleaseButton:
Line (777, 196)-(865, 284), 0, B:
Line (756, 316)-(1006, 646), 15, B
PlayCard = DeckCard(DeckCards): PlayColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1
= 941: X2
= 240: X3
= PlayCard: X4
= CardColor
(PlayColor
): DrawCard X1
, X2
, X3
, X4:
GoTo PlayDeckCard
' Choose Table Cards
PlayDeckCard:
ChoosePlay:
' Place Card on Table
GoSub ReleaseButton:
Line (897, 196)-(985, 284), 0, BF:
Line (756, 316)-(1006, 646), 0, B:
TableCards = TableCards + 1: TableCard(TableCards) = PlayCard: TableColor(TableCards) = PlayColor:
X1
= TableX
(TableCards
): X2
= TableY
(TableCards
): X3
= PlayCard: X4
= CardColor
(PlayColor
): DrawCard X1
, X2
, X3
, X4:
GoTo EndTurn
' Place Card on Board
GoSub ReleaseButton: Row
= Z: Column
= Y: DrawPile
= 1: Table
= 0: Routine
= 1:
GoTo CheckBoardPosition
ChooseTableCard:
Locate 45, 750:
Print " Or Draw a Card From the Deck ";
GetTableCard:
' Choose a Card From the Table
GoSub ReleaseButton:
Line (756, 316)-(1006, 646), 0, B:
Line (777, 196)-(865, 284), 0, B
Line (TableX
(Z
) - 41, TableY
(Z
) - 41)-(TableX
(Z
) + 41, TableY
(Z
) + 41), 15, B
PlayCard
= TableCard
(Z
): PlayColor
= TableColor
(Z
): Position
= Z: Table
= 1: DrawPile
= 0:
GoTo ChooseBoardPosition
' Choose Draw a Card From the Deck
GoSub ReleaseButton:
Line (777, 196)-(865, 284), 0, B:
Line (756, 316)-(1006, 646), 15, B
PlayCard = DeckCard(DeckCards): PlayColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1
= 941: X2
= 240: X3
= PlayCard: X4
= CardColor
(PlayColor
): DrawCard X1
, X2
, X3
, X4:
GoTo PlayDeckCard
ChooseBoardPosition:
GetBoardPosition:
' Reselect Card on Table
GoSub ReleaseButton:
Line (TableX
(Position
) - 41, TableY
(Position
) - 41)-(TableX
(Position
) + 41, TableY
(Position
) + 41), 0, B
Line (777, 196)-(865, 284), 15, B:
Line (756, 316)-(1006, 646), 15, B:
GoTo ChooseTableCard
' Place Card on Board
GoSub ReleaseButton: Row
= Z: Column
= Y:: Routine
= 2:
GoTo CheckBoardPosition
CheckBoardPosition:
If BoardCard
(Player
, Row
, Column
) > 0 Then Occupied
= 1: OldCard
= BoardCard
(Player
, Row
, Column
): OldColor
= BoardColor
(Player
, Row
, Column
)
X = 1: X1 = 0: X2 = 0: X3 = 0: X4 = 0
If BoardCard
(Player
, Row
- X
, Column
) = 0 Then X
= X
+ 1:
GoTo Up
Else If PlayCard
> BoardCard
(Player
, Row
- X
, Column
) Then X1
= 1 X1 = 1
X = 1
If BoardCard
(Player
, Row
+ X
, Column
) = 0 Then X
= X
+ 1:
GoTo Dn
Else If PlayCard
< BoardCard
(Player
, Row
+ X
, Column
) Then X2
= 1 X2 = 1
X = 1
If BoardCard
(Player
, Row
, Column
- X
) = 0 Then X
= X
+ 1:
GoTo Lt
Else If PlayCard
> BoardCard
(Player
, Row
, Column
- X
) Then X3
= 1 X3 = 1
X = 1
If BoardCard
(Player
, Row
, Column
+ X
) = 0 Then X
= X
+ 1:
GoTo Rt
Else If PlayCard
< BoardCard
(Player
, Row
, Column
+ X
) Then X4
= 1 X4 = 1
CanPlay = 0
CanPlay = 1
' Place Card on Board
' Move Card to the Board
BoardCard(Player, Row, Column) = PlayCard: BoardColor(Player, Row, Column) = PlayColor
X1 = BoardX(Player, Row, Column): X2 = BoardY(Player, Row, Column): X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4
' Move Card from Draw Pile
If DrawPile
= 1 Then Line (897, 196)-(985, 284), 0, BF
' Move Card from Table
Line (TableX
(Position
) - 41, TableY
(Position
) - 41)-(TableX
(Position
) + 41, TableY
(Position
) + 41), 0, BF
While Position
< TableCards
TableCard(Position) = TableCard(Position + 1): TableColor(Position) = TableColor(Position + 1)
Line (TableX
(Position
+ 1) - 41, TableY
(Position
+ 1) - 41)-(TableX
(Position
+ 1) + 41, TableY
(Position
+ 1) + 41), 0, BF
X1 = TableX(Position): X2 = TableY(Position): X3 = TableCard(Position): X4 = CardColor(TableColor(Position)): DrawCard X1, X2, X3, X4
Position = Position + 1
TableCards = TableCards - 1
' Move Old Card to Table
TableCards = TableCards + 1: TableCard(TableCards) = OldCard: TableColor(TableCards) = OldColor
X1 = TableX(TableCards): X2 = TableY(TableCards): X3 = OldCard: X4 = CardColor(OldColor): DrawCard X1, X2, X3, X4
EndTurn:
' Check for Winner
X = 0
If BoardCard
(Player
, Z
, Y
) > 0 Then X
= X
+ 1
Locate 43, 750:
Print " Player"; Player;
"is the Winner! ";
Line (BoardCenterX
(Player
) - 176, BoardCenterY
(Player
) - 176)-(BoardCenterX
(Player
) + 176, BoardCenterY
(Player
) + 176), 0, B
Line (BoardCenterX
(Player
) - 177, BoardCenterY
(Player
) - 177)-(BoardCenterX
(Player
) + 177, BoardCenterY
(Player
) + 177), 0, B
If Player
= Players
Then Player
= 1 Else Player
= Player
+ 1
ReleaseButton:
Sub DrawCard
(X1
, X2
, X3
, X4
)
fontpath$
= Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"
Line (X1
- 34, X2
- 26)-(X1
- 34, X2
+ 26), 2:
Line (X1
+ 34, X2
- 26)-(X1
+ 34, X2
+ 26), 2:
Line (X1
- 26, X2
- 34)-(X1
+ 26, X2
- 34), 2:
Line (X1
- 26, X2
+ 34)-(X1
+ 26, X2
+ 34), 2 Circle (X1
- 26, X2
- 26), 8, 2, 1.5, 3.0:
Circle (X1
+ 26, X2
- 26), 8, 2, 0, 1.6:
Circle (X1
- 26, X2
+ 26), 8, 2, 3.0, 4.8:
Circle (X1
+ 26, X2
+ 26), 8, 2, 4.5,
Line (X1
- 25, X2
- 22)-(X1
- 25, X2
+ 22), 15:
Line (X1
+ 25, X2
- 22)-(X1
+ 25, X2
+ 22), 15:
Line (X1
- 22, X2
- 25)-(X1
+ 22, X2
- 25), 15:
Line (X1
- 22, X2
+ 25)-(X1
+ 22, X2
+ 25), 15 Circle (X1
- 22, X2
- 22), 3, 15, 1.5, 3.0:
Circle (X1
+ 22, X2
- 22), 3, 15, 0, 1.6:
Circle (X1
- 22, X2
+ 22), 3, 15, 3.0, 4.8:
Circle (X1
+ 22, X2
+ 22), 3, 15, 4.5, 0