Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lucky Numbers Board Game
#1
[Image: index.php?action=dlattach;topic=4327.0;attach=14585]


Hello Everyone,

Lucky Numbers is a 2 to 4 strategy board game played with individual boards and decks of cards based on the number of players. There is a solo play version, however, I did not not include it here. Each board has spaces 4 across by 4 down to hold numbered cards. Each deck of cards are numbered from 1 to 20 and there is a deck of cards for each number of players. In example: 2 decks of cards for 2 players, 3 decks of cards for 3 players and 4 decks of cards for 4 players. The object of the game is to be the first player to completely fill your board with the numbered cards.

The game starts with each player has a n empty gameboard in front of them. All the decks of cards are shuffled together. There are 4 starting cards placed on each gameboard at the start of the game that are randomly drawn from the deck. The cards are placed in ascending order from the lowest place in the upper left corner position 1:1, the next lowest placed at position 2:2, then the next lowest at position 3:3 and the highest card place at the lower right corner position 4:4. There's an optional version, known as Michael's Version, where only one card is reveled at a time and each player places that card at one of the 4 starting locations they feel is the best spot for that card without looking at any of the face down cards. Then the player turns over the next card in the same manner until all 4 cards are placed in the 4 starting positions.

Cards can only be placed on the board in ascending order from top to bottom and from left to right with the lowest in the upper left corner to the highest in the lower tight corner and no 2 cards with the same number may be next to each other, up and down or side by side. A player may choose to draw a face down card off the top of the deck or play a face up card discarded face up on the table. Once a player draws a face down card from the deck, they stuck with card and can not play a card from the table. If the card drawn from the deck is playable, they may play it on their board or place it on to the table. You may also replace a card on your board with the card you drew from the deck or from the table if it is playable in that spot. The card you removed from your board goes to the table.

The sequence of play: You will be asked number of players, use keyboard for input. Then it will ask to use Michael's Variation, again keyboard input. There will be a thick cursor around the game board board of the player currently taking their turn. At the start of the game, that will be player 1. There is a cursor around the deck of cards indicating thru van draw a card from the deck. The card will appear next to the deck. If there are any cards on the table, there will be a cursor around the the group. To choose a card from the table, click anywhere inside the table cursor, the click on the card you wish to play. A cursor will surround only that card. You van play this card onto your board by clicking the spot on the board or you can select a different table card by re-clicking the card you selected and choose a different or draw a card from the deck.

I've included 2 different copies copies of the rules.

Hope you enjoy playing, Donald


Code: (Select All)
_Title "Lucky Numbers - Coded by Donald L. Foster Jr."

Screen _NewImage(1035, 735, 256)

Randomize Timer

_PaletteColor 1, _RGB32(0, 0, 90) ' Blue Playing Board
_PaletteColor 2, _RGB32(0, 155, 155) ' Cyan Board Spacer
_PaletteColor 3, _RGB32(235, 195, 0) ' Gold Card
_PaletteColor 4, _RGB32(50, 185, 30) ' Green Card
_PaletteColor 5, _RGB32(32, 110, 170) ' Blue Card
_PaletteColor 6, _RGB32(138, 43, 226) ' Purple Card

Dim R As Integer
Dim S As Integer
Dim T As Integer
Dim U As Integer
Dim V As Integer
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim X1 As Integer
Dim X2 As Integer
Dim X3 As Integer
Dim X4 As Integer

Dim Player As Integer
Dim Players As Integer
Dim Row As Integer
Dim Column As Integer
Dim Winner As Integer
Dim Card As Integer
Dim CardColor As Integer
Dim Board As Integer
Dim Variation As Integer
Dim DeckCards As Integer
Dim TableCards As Integer
Dim PlayCard As Integer
Dim PlayColor As Integer
Dim OldCard As Integer
Dim OldColor As Integer
Dim LowCard As Integer
Dim Occupied As Integer
Dim CanPlay As Integer
Dim DrawPile As Integer
Dim Table As Integer
Dim Position As Integer
Dim Routine As Integer

Dim DeckColor(80) As Integer
Dim DeckCard(80) As Integer
Dim CardColor(5) As Integer
Dim Placed(80) As Integer
Dim BoardCenterX(5) As Integer
Dim BoardCenterY(5) As Integer
Dim TableCard(12) As Integer
Dim TableColor(12) As Integer
Dim TableX(12) As Integer
Dim TableY(12) As Integer

Dim HoldCard(4, 4) As Integer
Dim HoldColor(4, 4) As Integer
Dim Sorted(4, 4) As Integer
Dim BoardX(5, 4, 4) As Integer
Dim BoardY(5, 4, 4) As Integer
Dim BoardCard(5, 4, 4) As Integer
Dim BoardColor(5, 4, 4) As Integer

CardColor(1) = 3: CardColor(2) = 4: CardColor(3) = 5: CardColor(4) = 6

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"
fontpath1$ = Environ$("SYSTEMROOT") + "\fonts\Arial.ttf"

Color 2, 0: font& = _LoadFont(fontpath$, 80): _Font font&
Locate 3, 295: Print "L U C K Y";
Locate 5, 175: Print "N U M B E R S";

Color 15, 0: font& = _LoadFont(fontpath$, 30): _Font font&
Locate 17, 315: Print "How Many Players? ( 1 to 4 )";

GetPlayers:
A$ = InKey$: If A$ = "" GoTo GetPlayers
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$) < 1 Or Val(A$) > 4 GoTo GetPlayers
Players = Val(A$)

' Setup Deck of Cards
DeckCards = Players * 20
For Z = 1 To DeckCards: Placed(Z) = 0: Next
For Z = 1 To 20
For Y = 1 To Players
Placed: X = Int(Rnd * DeckCards) + 1: If Placed(X) = 0 Then Placed(X) = 1: DeckCard(X) = Z: DeckColor(X) = Y Else GoTo Placed
Next
Next

Cls

' Get Board X, Y Positions
If Players = 4 Then

X = 186: Board = 1
For Z = 1 To 2
W = 186
For Y = 1 To 2
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
Next
X = X + 363
Next

ElseIf Players = 3 Then

X = 186: Board = 1
For Z = 1 To 2
If Z = 1 Then R = 2: W = 186 Else R = 1: W = 367
For Y = 1 To R
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
Next
X = X + 363
Next

Else

X = 186: W = 186: Board = 1
For Z = 1 To 2
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
X = X + 363: W = W + 363
Next

End If

' Draw Board
For Z = 1 To Players
V = BoardCenterX(Z): U = BoardCenterY(Z)
Line (V - 175, U - 175)-(V + 175, U + 175), 1, BF
For Y = 1 To 4
For X = 1 To 4
X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = 0: X4 = 0: DrawCard X1, X2, X3, X4
Next
Next
Next

' Setup Table Locations
X = 1: V = 360
For Z = 1 To 4
U = 800
For Y = 1 To 3
TableX(X) = U: TableY(X) = V
X = X + 1: U = U + 81
Next
V = V + 81
Next

Color 2, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (812, 10), "L U C K Y"
_PrintString (774, 35), "N U M B E R S"

Color 15, 0: font& = _LoadFont(fontpath$, 16): _Font font&
Locate 45, 760: Print "Use Michael's Variation? Y or N";

GetVariation:
A$ = UCase$(InKey$): If A$ = "" GoTo GetVariation
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 Variation = 1 Else If A$ = "N" Then Variation = 0 Else GoTo GetVariation

' Add Starting Cursors for Michael's Variation
If Variation = 1 Then

For Z = 1 To Players
For R = 1 To 4
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
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

For Y = 1 To 4
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
Else
Line (V - 39, U - 39)-(V + 39, U + 39), 1, B
End If
Next

X1 = 881: X2 = 110: X3 = Z: X4 = CardColor(Z): DrawCard X1, X2, X3, X4
Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (833, 155), "Player " + Str$(Z)

Card = DeckCard(DeckCards): CardColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1 = 881: X2 = 350: X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4

PlaceStartingCard:
Do While _MouseInput
For Y = 1 To 4
For X = 1 To 4
If BoardCard(Z, Y, X) = 0 And ((Y = 1 And X = 1) Or (Y = 2 And X = 2) Or (Y = 3 And X = 3) Or (Y = 4 And X = 4)) Then
If _MouseX > BoardX(Z, Y, X) - 40 And _MouseX < BoardX(Z, Y, X) + 40 And _MouseY > BoardY(Z, Y, X) - 40 And _MouseY < BoardY(Z, Y, X) + 40 And _MouseButton(1) = -1 Then
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
End If
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 PlaceStartingCard

EndPlaceCard:
Next
Next

Else

' Get Hold Cards
For Z = 1 To 4
For Y = 1 To Players
HoldCard(Y, Z) = DeckCard(DeckCards): HoldColor(Y, Z) = DeckColor(DeckCards): DeckCards = DeckCards - 1
Next
Next

' Sort Hold Cards
For Z = 1 To Players
For Y = 1 To 4
LowCard = 100
For X = 1 To 4
If HoldCard(Z, X) < LowCard And Sorted(Z, X) = 0 Then LowCard = HoldCard(Z, X): CardColor = HoldColor(Z, X): T = X
Next
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
Next
Next

End If

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
Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (833, 155), "Player " + Str$(Player)

' Display Deck
X1 = 821: X2 = 240: X3 = 100: X4 = 0: DrawCard X1, X2, X3, X4: Line (777, 196)-(865, 284), 15, B
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Draw a Card From the Deck ";

'Draw Cursor Around Table If Not Empty
If TableCards > 0 Then
Color 15, 0: Locate 45, 750: Print " Or Play a Card From the Table ";
Line (756, 316)-(1006, 646), 15, B
Else
Locate 45, 750: Print String$(70, 32);: Line (756, 316)-(1006, 646), 0, B
End If

ChooseAPlay:
Do While _MouseInput

' Draw a Card From the Deck
If _MouseX > 777 And _MouseX < 865 And _MouseY > 196 And _MouseY < 284 And _MouseButton(1) = -1 Then
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
End If

' Choose Table Cards
If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 And TableCards > 0 Then
GoSub ReleaseButton: GoTo ChooseTableCard
End If

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 ChooseAPlay

PlayDeckCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Play Card on Your Board ";
Locate 45, 750: Print " Or Move Card to the Table ";

ChoosePlay:
Do While _MouseInput

' Place Card on Table
If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 Then
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
End If

' Place Card on Board
For Z = 1 To 4
For Y = 1 To 4
If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Row = Z: Column = Y: DrawPile = 1: Table = 0: Routine = 1: GoTo CheckBoardPosition
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 ChoosePlay


ChooseTableCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Choose a Table Card to Play ";
Locate 45, 750: Print " Or Draw a Card From the Deck ";

GetTableCard:
Do While _MouseInput

' Choose a Card From the Table
For Z = 1 To TableCards
If _MouseX > TableX(Z) - 35 And _MouseX < TableX(Z) + 35 And _MouseY > TableY(Z) - 35 And _MouseY < TableY(Z) + 35 And _MouseButton(1) = -1 Then
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
End If
Next

' Choose Draw a Card From the Deck
If _MouseX > 777 And _MouseX < 865 And _MouseY > 196 And _MouseY < 284 And _MouseButton(1) = -1 Then
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
End If

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 GetTableCard

ChooseBoardPosition:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Play Card on Your Board ";
If TableCards > 0 Then Locate 45, 750: Print " Or a Choose Table Card ";

GetBoardPosition:
Do While _MouseInput

' Reselect Card on Table
If _MouseX > TableX(Position) - 41 And _MouseX < TableX(Position) + 41 And _MouseY > TableY(Position) - 41 And _MouseY < TableY(Position) + 41 And _MouseButton(1) = -1 Then
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
End If

' Place Card on Board
For Z = 1 To 4
For Y = 1 To 4
If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Row = Z: Column = Y:: Routine = 2: GoTo CheckBoardPosition
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 GetBoardPosition


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

Up: If Row - X >= 1 Then
If BoardCard(Player, Row - X, Column) = 0 Then X = X + 1: GoTo Up Else If PlayCard > BoardCard(Player, Row - X, Column) Then X1 = 1
Else
X1 = 1
End If

X = 1
Dn: If Row + X <= 4 Then
If BoardCard(Player, Row + X, Column) = 0 Then X = X + 1: GoTo Dn Else If PlayCard < BoardCard(Player, Row + X, Column) Then X2 = 1
Else
X2 = 1
End If

X = 1
Lt: If Column - X >= 1 Then
If BoardCard(Player, Row, Column - X) = 0 Then X = X + 1: GoTo Lt Else If PlayCard > BoardCard(Player, Row, Column - X) Then X3 = 1
Else
X3 = 1
End If

X = 1
Rt: If Column + X <= 4 Then
If BoardCard(Player, Row, Column + X) = 0 Then X = X + 1: GoTo Rt Else If PlayCard < BoardCard(Player, Row, Column + X) Then X4 = 1
Else
X4 = 1
End If

CanPlay = 0
If X1 = 1 And X2 = 1 And X3 = 1 And X4 = 1 Then
CanPlay = 1
Else
If Routine = 1 Then GoTo ChoosePlay
If Routine = 2 Then GoTo GetBoardPosition
End If

' Place Card on Board
If CanPlay = 1 Then

' 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
If Table = 1 Then

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

Wend

TableCards = TableCards - 1

End If

' Move Old Card to Table
If Occupied = 1 Then
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
End If

End If

EndTurn:

' Check for Winner
X = 0
For Z = 1 To 4
For Y = 1 To 4
If BoardCard(Player, Z, Y) > 0 Then X = X + 1
Next
Next

If X = 16 Then
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Player"; Player; "is the Winner! ";
Locate 45, 750: Print " Play Another Game? Y or N ";

GetYorN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
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 GetYorN
End If

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
GoTo StartGame

ReleaseButton:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo 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,

If X3 = 100 Then

Paint (X1, X2), 15, 2: Color X4, 15: font& = _LoadFont(fontpath$, 13): _Font font&
Color 2, 15: _PrintString (804, 225), "Lucky": _PrintString (793, 245), "Numbers"

ElseIf X3 > 0 Then

Paint (X1, X2), 2
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
Paint (X1, X2), 15


Color X4, 15: font& = _LoadFont(fontpath$, 40): _Font font&
If X3 < 10 Then X = 20 Else X = 22
_PrintString (X1 - X, X2 - 15), Right$(Str$(X3), 2)

End If

End Sub


Attached Files
.7z   Lucky Numbers Rules and Rulebook.7z (Size: 2.23 MB / Downloads: 42)
Reply
#2
[Image: index.php?action=dlattach;topic=4433.0;attach=16177]

Hello Everyone,
This is the completed version of Lucky Numbers board game including Solo Play. Solo Play is a puzzle game the challenges the player to try to complete 40 levels of play.

During the making of the Solo Play edition, my hard drive on my laptop crashed and won't load Windows. This was the only location where I had Solo Play with no other backups, only a few hand written notes. Unable to recover any data at this time, I simply downloaded the 2 to 4 player version from here and started over.

The Solo Play also includes some updates to the original 2 to 4 player version:
1 - I change the deck card back to a color one.
2 - When there are no cards on the table, the game automatically draws a card from the deck for the player.
3 - When choosing a table card, the player doesn't need to click in the large table cursor then click on the card, they only need to click on the card. A player can click on that card again to un-select it or even click on a different table card.

The Solo Play version as mentioned is a puzzle game with 40 levels. A player must complete the current level or highest level completed before attempting a harder level. You see, a player may play any level lower up yo their current level. There a can be 8 different players playing  at their own level on a single device. They are identified by their name they enter at the start of their game.

Each level has a predetermined number of moves to complete the puzzle from 2 to 8. The puzzle starts off with the 16 cards already arranged on the board. However, a few of the cards are not in their correct position on the board.  The player swaps pairs of cards at a time, a predetermined number of moves to complete the puzzle. If the puzzle was not successfully complete, they are required to restart that level. However, if they did complete the puzzle, they advance to the next puzzle. As players complete levels, their game is saved to HD.

When the game is first played on a device, there are no current players stored on HD and the player is asked to enter their name. That player starts at puzzle level 1 and must complete that level before going to level 2. After that first time the game is played, the game loads the current players and you choose your name. If you are a new player, you can select NEW PLAYER and the game will ask you to enter your name and you will start at level 1.

Cards can only be swapped next to each other (side by side or top and bottom) or at opposite ends of the board on the same row or column.

At any time during the play of a level, a player my choose to restart that level, choose a different level, choose a different player, quit the game or play solution.

If you choose to play solution, the game shows you all of the moves to complete the puzzle. Most puzzle games includes the solution to each puzzle, however, I could find one for this game. I included the first 8 levels in this game, but unable to complete level 9. If anyone plays this and able to complete more levels and wants to record the moves, please feel free to post the solutions.

Hope you enjoy playing. Donald



Code: (Select All)
_Title "Lucky Numbers - Coded by Donald L. Foster Jr."

Screen _NewImage(1035, 735, 256)

Randomize Timer

_PaletteColor 1, _RGB32(0, 0, 90) '      Blue Playing Board
_PaletteColor 2, _RGB32(0, 155, 155) '  Cyan Board Spacer
_PaletteColor 3, _RGB32(235, 195, 0) '  Gold Card
_PaletteColor 4, _RGB32(50, 185, 30) '  Green Card
_PaletteColor 5, _RGB32(32, 110, 170) '  Blue Card
_PaletteColor 6, _RGB32(138, 43, 226) '  Purple Card

Dim R As Integer
Dim S As Integer
Dim T As Integer
Dim U As Integer
Dim V As Integer
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim X1 As Integer
Dim X2 As Integer
Dim X3 As Integer
Dim X4 As Integer

Dim Player As Integer
Dim Players As Integer
Dim Row As Integer
Dim Column As Integer
Dim Winner As Integer
Dim Card As Integer
Dim CardColor As Integer
Dim Board As Integer
Dim Variation As Integer
Dim DeckCards As Integer
Dim TableCards As Integer
Dim PlayCard As Integer
Dim PlayColor As Integer
Dim OldCard As Integer
Dim OldColor As Integer
Dim LowCard As Integer
Dim Occupied As Integer
Dim CanPlay As Integer
Dim DrawPile As Integer
Dim Table As Integer
Dim Position As Integer
Dim Routine As Integer
Dim CardDrawn As Integer
Dim Selected As Integer
Dim Level As Integer
Dim PrevColor As Integer
Dim NextColor As Integer
Dim Move As Integer
Dim EndTurn As Integer
Dim As Integer Row1, Col1, Row2, Col2

Dim DeckColor(80) As Integer
Dim DeckCard(80) As Integer
Dim CardColor(5) As Integer
Dim Placed(80) As Integer
Dim BoardCenterX(5) As Integer
Dim BoardCenterY(5) As Integer
Dim TableCard(12) As Integer
Dim TableColor(12) As Integer
Dim TableX(12) As Integer
Dim TableY(12) As Integer
Dim PlayerNameY(8) As Integer
Dim SoloMoves(40) As Integer
Dim ChooseLevelMenu(3) As Integer
Dim PlayLevelMenu(5) As Integer
Dim Menu(6) As String

Dim HoldCard(4, 4) As Integer
Dim HoldColor(4, 4) As Integer
Dim Sorted(4, 4) As Integer
Dim Row1(40, 8) As Integer
Dim Col1(40, 8) As Integer
Dim Row2(40, 8) As Integer
Dim Col2(40, 8) As Integer

Dim BoardX(5, 4, 4) As Integer
Dim BoardY(5, 4, 4) As Integer
Dim BoardCard(5, 4, 4) As Integer
Dim BoardColor(5, 4, 4) As Integer
Dim SoloBoard(40, 4, 4) As Integer

CardColor(1) = 3: CardColor(2) = 4: CardColor(3) = 5: CardColor(4) = 6
ChooseLevelMenu(1) = 1: ChooseLevelMenu(2) = 2: ChooseLevelMenu(3) = 6
PlayLevelMenu(1) = 3: PlayLevelMenu(2) = 4: PlayLevelMenu(3) = 5: PlayLevelMenu(4) = 2: PlayLevelMenu(5) = 6

Menu$(1) = "  Play  Level  ": Menu$(2) = "Choose Player": Menu$(3) = " Play  Solution ": Menu$(4) = " Restart  Level ": Menu$(5) = " Choose Level ": Menu$(6) = "  End  Game  "

' Setup Solo Boards
Data 1,2,5,8,4,7,9,13,10,12,19,17,16,14,15,20,2: ' Board 1
Data 2,18,4,7,3,8,12,13,9,10,15,17,11,14,5,19,2: ' Board 2
Data 13,4,5,9,1,6,12,3,7,10,15,20,11,14,16,17,3: ' Board 3
Data 2,4,5,9,3,10,8,17,7,12,18,15,13,11,16,19,3: ' Board 4
Data 13,3,5,7,4,8,9,10,11,1,14,17,15,12,16,19,3: ' Board 5
Data 1,3,7,5,4,9,8,10,11,12,17,14,13,15,16,19,3: ' Board 6
Data 1,2,5,13,4,12,15,8,17,7,9,10,14,16,19,20,4: ' Board 7
Data 2,14,5,7,9,8,12,3,13,10,15,17,4,11,18,19,4: ' Board 8
Data 1,5,16,9,3,6,12,7,17,10,15,13,11,14,4,20,4: ' Board 9
Data 2,4,5,9,3,10,15,17,7,12,8,18,19,11,16,13,4: ' Board 10
Data 7,3,1,5,11,8,9,4,10,12,14,17,13,15,16,19,4: ' Board 11
Data 2,8,6,7,5,3,14,17,12,10,9,15,11,13,16,19,4: ' Board 12
Data 1,2,8,13,4,7,9,5,10,12,17,20,14,19,16,15,5: ' Board 13
Data 2,14,5,7,13,8,12,17,9,10,3,15,11,18,4,19,5: ' Board 14
Data 11,4,5,9,7,6,12,13,17,1,15,3,14,10,16,20,5: ' Board 15
Data 2,4,16,9,8,3,5,17,18,15,12,7,11,13,10,19,5: ' Board 16
Data 1,3,5,7,8,12,14,10,17,11,9,4,13,15,16,19,5: ' Board 17
Data 2,3,16,19,2,8,9,15,12,14,10,17,11,13,7,6,5: ' Board 18
Data 2,5,7,6,8,3,9,15,10,12,13,17,11,16,14,19,5: ' Board 19
Data 7,3,16,2,5,10,15,9,17,8,14,12,11,13,6,19,6: ' Board 20
Data 1,16,5,20,13,9,7,4,17,15,12,10,14,2,19,8,6: ' Board 21
Data 4,5,2,7,3,10,12,13,9,14,15,17,18,8,19,11,6: ' Board 22
Data 11,5,4,7,13,8,3,12,10,2,15,17,9,14,18,19,6: ' Board 23
Data 1,4,5,12,3,7,13,9,10,6,20,17,11,14,15,16,6: ' Board 24
Data 1,14,5,7,3,6,12,13,15,4,17,20,11,10,16,9,6: ' Board 25
Data 17,5,4,2,7,8,15,9,3,12,10,18,11,16,13,19,6: ' Board 26
Data 9,19,4,2,3,8,5,10,7,12,15,17,11,13,16,18,6: ' Board 27
Data 13,3,5,19,10,9,8,4,17,14,12,11,1,15,16,7,6: ' Board 28
Data 2,14,18,7,13,8,12,3,4,10,15,5,9,11,19,17,7: ' Board 29
Data 3,4,7,5,8,10,12,13,9,15,18,17,11,14,19,2,7: ' Board 30
Data 20,4,5,9,3,15,12,13,7,14,6,17,11,10,16,1,7: ' Board 31
Data 4,1,20,5,6,3,12,13,10,7,15,17,14,11,9,16,7: ' Board 32
Data 11,13,5,9,17,10,15,3,18,12,7,8,2,4,16,19,7: ' Board 33
Data 3,10,4,9,2,5,8,17,11,12,15,7,19,13,16,18,7: ' Board 34
Data 1,19,13,8,12,7,9,5,10,4,15,17,14,2,16,20,8: ' Board 35
Data 4,2,19,10,8,7,9,1,17,12,15,13,5,16,20,14,8: ' Board 36
Data 3,5,7,17,2,10,8,9,12,7,16,19,13,11,15,18,8: ' Board 37
Data 3,13,5,9,8,12,10,17,18,15,16,7,11,4,19,2,8: ' Board 38
Data 7,15,5,10,11,8,14,1,4,12,9,13,19,16,3,17,8: ' Board 39
Data 3,15,5,7,11,8,10,12,4,14,9,17,19,13,16,1,8: ' Board 40
For Z = 1 To 40: For Y = 1 To 4: For X = 1 To 4: Read SoloBoard(Z, Y, X): Next: Next: Read SoloMoves(Z): Next

' Setup Solution
Data 3,3,4,3,4,1,4,2: ' Solution 1
Data 1,2,1,3,1,3,4,3: ' Solution 2
Data 1,1,2,1,2,1,2,4,3,4,4,4: ' Solution 3
Data 2,2,2,3,2,4,3,4,3,3,4,3: ' Solution 4
Data 3,2,4,2,4,1,4,2,1,1,4,1: ' Solution 5
Data 1,3,1,4,2,2,2,3,3,3,3,4: ' Solution 6
Data 1,4,2,4,2,2,3,2,2,3,3,3,3,1,3,4: ' Solution 7
Data 4,1,4,2,1,2,4,2,2,1,3,1,2,1,4,1: ' Solution 8
For Z = 1 To 8: For Y = 1 To SoloMoves(Z): Read Row1(Z, Y), Col1(Z, Y), Row2(Z, Y), Col2(Z, Y): Next: Next

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"
fontpath1$ = Environ$("SYSTEMROOT") + "\fonts\Arial.ttf"

Color 2, 0: font& = _LoadFont(fontpath$, 80): _Font font&
Locate 2, 295: Print "L  U  C  K  Y";
Locate 4, 175: Print "N  U  M  B  E  R  S";

Color 15, 0: font& = _LoadFont(fontpath$, 60): _Font font&
Locate 7, 185: Print "W i t h  S o l o  P l a y";

Color 15, 0: font& = _LoadFont(fontpath$, 30): _Font font&
Locate 19, 310: Print "How Many Players?  ( 1 to 4 )";

GetPlayers:
A$ = InKey$: If A$ = "" GoTo GetPlayers
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$) < 1 Or Val(A$) > 4 GoTo GetPlayers
Players = Val(A$)

' Setup Deck of Cards
DeckCards = Players * 20
For Z = 1 To DeckCards: Placed(Z) = 0: Next
For Z = 1 To 20
    For Y = 1 To Players
        Placed: X = Int(Rnd * DeckCards) + 1: If Placed(X) = 0 Then Placed(X) = 1: DeckCard(X) = Z: DeckColor(X) = Y Else GoTo Placed
    Next
Next

' Setup PlayerNameY()
V = 0: For Z = 1 To 8: PlayerNameY(Z) = 190 + V: Name$(Z) = "EMPTY": V = V + 50: Next

Cls
Color 2, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (812, 10), "L  U  C  K  Y"
_PrintString (774, 35), "N  U  M  B  E  R  S"

' Get Board X, Y Positions
If Players = 4 Then

    X = 186: Board = 1
    For Z = 1 To 2
        W = 186
        For Y = 1 To 2
            U = X - 122
            For T = 1 To 4
                V = W - 122
                For S = 1 To 4
                    BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
                    V = V + 81
                Next
                U = U + 81
            Next
            BoardCenterX(Board) = W: BoardCenterY(Board) = X
            Board = Board + 1
            W = W + 363
        Next
        X = X + 363
    Next

ElseIf Players = 3 Then

    X = 186: Board = 1
    For Z = 1 To 2
        If Z = 1 Then R = 2: W = 186 Else R = 1: W = 367
        For Y = 1 To R
            U = X - 122
            For T = 1 To 4
                V = W - 122
                For S = 1 To 4
                    BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
                    V = V + 81
                Next
                U = U + 81
            Next
            BoardCenterX(Board) = W: BoardCenterY(Board) = X
            Board = Board + 1
            W = W + 363
        Next
        X = X + 363
    Next

ElseIf Players = 2 Then

    X = 186: W = 186: Board = 1
    For Z = 1 To 2
        U = X - 122
        For T = 1 To 4
            V = W - 122
            For S = 1 To 4
                BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
                V = V + 81
            Next
            U = U + 81
        Next
        BoardCenterX(Board) = W: BoardCenterY(Board) = X
        Board = Board + 1
        X = X + 363: W = W + 363
    Next

Else

    X = 367: W = 367: Board = 1
    U = X - 122
    For T = 1 To 4
        V = W - 122
        For S = 1 To 4
            BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
            V = V + 81
        Next
        U = U + 81
    Next
    BoardCenterX(Board) = W: BoardCenterY(Board) = X

End If

' Draw Board
For Z = 1 To Players
    V = BoardCenterX(Z): U = BoardCenterY(Z)
    Line (V - 175, U - 175)-(V + 175, U + 175), 1, BF
    For Y = 1 To 4
        For X = 1 To 4
            X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = 0: X4 = 0: DrawCard X1, X2, X3, X4
        Next
    Next
Next

If Players = 1 GoTo SoloPlay

' Setup Table Locations
X = 1: V = 360
For Z = 1 To 4
    U = 800
    For Y = 1 To 3
        TableX(X) = U: TableY(X) = V
        X = X + 1: U = U + 81
    Next
    V = V + 81
Next

Color 15, 0: font& = _LoadFont(fontpath$, 16): _Font font&
Locate 45, 760: Print "Use Michael's Variation?  Y or N";

GetVariation:
A$ = UCase$(InKey$): If A$ = "" GoTo GetVariation
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 Variation = 1 Else If A$ = "N" Then Variation = 0 Else GoTo GetVariation

' Add Starting Cursors for Michael's Variation
If Variation = 1 Then

    For Z = 1 To Players
        For R = 1 To 4
            Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
            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

            For Y = 1 To 4
                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
                Else
                    Line (V - 39, U - 39)-(V + 39, U + 39), 1, B
                End If
            Next

            X1 = 881: X2 = 110: X3 = Z: X4 = CardColor(Z): DrawCard X1, X2, X3, X4
            Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
            _PrintString (833, 155), "Player " + Str$(Z)

            Card = DeckCard(DeckCards): CardColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
            X1 = 881: X2 = 350: X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4

            PlaceStartingCard:
            Do While _MouseInput
                For Y = 1 To 4
                    For X = 1 To 4
                        If BoardCard(Z, Y, X) = 0 And ((Y = 1 And X = 1) Or (Y = 2 And X = 2) Or (Y = 3 And X = 3) Or (Y = 4 And X = 4)) Then
                            If _MouseX > BoardX(Z, Y, X) - 40 And _MouseX < BoardX(Z, Y, X) + 40 And _MouseY > BoardY(Z, Y, X) - 40 And _MouseY < BoardY(Z, Y, X) + 40 And _MouseButton(1) = -1 Then
                                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
                            End If
                        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 PlaceStartingCard

            EndPlaceCard:
        Next
    Next

Else

    ' Get Hold Cards
    For Z = 1 To 4
        For Y = 1 To Players
            HoldCard(Y, Z) = DeckCard(DeckCards): HoldColor(Y, Z) = DeckColor(DeckCards): DeckCards = DeckCards - 1
        Next
    Next

    ' Sort Hold Cards
    For Z = 1 To Players
        For Y = 1 To 4
            LowCard = 100
            For X = 1 To 4
                If HoldCard(Z, X) < LowCard And Sorted(Z, X) = 0 Then LowCard = HoldCard(Z, X): CardColor = HoldColor(Z, X): T = X
            Next
            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
        Next
    Next

End If

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
Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (833, 155), "Player " + Str$(Player)

' Display Deck
X1 = 821: X2 = 240: X3 = 100: X4 = 0: DrawCard X1, X2, X3, X4
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&

' Draw a Card From the Deck If No Table Cards
If TableCards = 0 Then
    DrawPile = 1: Table = 0: CardDrawn = 1
    PlayCard = DeckCard(DeckCards): PlayColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
    X1 = 941: X2 = 240: X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4
Else
    CardDrawn = 0
End If

Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&

GetInput:

'Draw Cursor Around Table If Not Empty
If TableCards > 0 And CardDrawn = 0 Then
    Locate 43, 750: Print "        Draw a Card From the Deck      ";
    Color 15, 0: Locate 45, 750: Print "      or Play a Card From the Table      ";
    Line (756, 316)-(1006, 646), 15, B: Line (777, 196)-(865, 284), 15, B
Else
    Locate 43, 750: Print "          Play Card on Your Board          ";
    Locate 45, 750: Print "          or Move Card to the Table          ";
    Line (777, 196)-(865, 284), 0, B: Line (756, 316)-(1006, 646), 15, B
End If

ChooseAPlay:
Do While _MouseInput

    If TableCards > 0 Then

        ' Draw a Card From the Deck
        If _MouseX > 777 And _MouseX < 865 And _MouseY > 196 And _MouseY < 284 And _MouseButton(1) = -1 Then
            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: DrawPile = 1: Table = 0
            X1 = 941: X2 = 240: X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4: GoTo PlayDeckCard
        End If

        ' Choose a Card From the Table
        If CardDrawn = 0 Then
            For Z = 1 To TableCards
                If _MouseX > TableX(Z) - 35 And _MouseX < TableX(Z) + 35 And _MouseY > TableY(Z) - 35 And _MouseY < TableY(Z) + 35 And _MouseButton(1) = -1 Then
                    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 PlayDeckCard
                End If
            Next
        End If

    End If

    ' Place Card on Table
    If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 Then
        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
    End If

    ' Place Card on Board
    If DrawPile = 1 Then
        For Z = 1 To 4
            For Y = 1 To 4
                If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
                    GoSub ReleaseButton: W = Player: Row = Z: Column = Y: Routine = 1: GoTo CheckBoardPosition
                End If
            Next
        Next
    End If

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 ChooseAPlay

PlayDeckCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print "        Play Card on Your Board or      ";
Locate 45, 750: Print "        Choose a Card From the Table      ";

ChoosePlay:
Do While _MouseInput

    ' Choose a Card From the Table
    For Z = 1 To TableCards
        If _MouseX > TableX(Z) - 35 And _MouseX < TableX(Z) + 35 And _MouseY > TableY(Z) - 35 And _MouseY < TableY(Z) + 35 And _MouseButton(1) = -1 Then
            GoSub ReleaseButton: Line (TableX(Position) - 41, TableY(Position) - 41)-(TableX(Position) + 41, TableY(Position) + 41), 0, B

            If Z = Position Then

                Line (756, 316)-(1006, 646), 0, B: GoTo GetInput
            Else
                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 ChoosePlay

            End If

        End If
    Next

    ' Place Card on Board
    For Z = 1 To 4
        For Y = 1 To 4
            If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
                GoSub ReleaseButton: W = Player: Row = Z: Column = Y: Routine = 1: GoTo CheckBoardPosition
            End If
        Next
    Next

    ' Place Card on Table
    If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 Then
        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
    End If

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 ChoosePlay


CheckBoardPosition:
If BoardCard(Player, Row, Column) > 0 Then Occupied = 1: OldCard = BoardCard(Player, Row, Column): OldColor = BoardColor(Player, Row, Column)

GoSub CheckPosition

CanPlay = 0
If X1 = 1 And X2 = 1 And X3 = 1 And X4 = 1 Then
    CanPlay = 1
Else
    If Routine = 1 Then GoTo ChoosePlay
    If Routine = 2 Then GoTo GetInput
End If

' Place Card on Board
If CanPlay = 1 Then

    ' 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
    If Table = 1 Then

        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

        Wend

        TableCards = TableCards - 1

    End If

    ' Move Old Card to Table
    If Occupied = 1 Then
        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
    End If

End If

EndTurn:

' Check for Winner
X = 0: W = Player
For Z = 1 To 4
    For Y = 1 To 4
        If BoardCard(Player, Z, Y) > 0 Then X = X + 1
    Next
Next

If X = 16 Then
    Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
    Locate 43, 750: Print "              Player"; Player; "is the Winner!          ";
    Locate 45, 750: Print "        Play Another Game?  Y or N        ";

    GetYorN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
    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 GetYorN
End If

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
GoTo StartGame

SoloPlay:
Color 15, 0: _PrintString (780, 70), "S O L O  P L A Y"

' Check For Existing Players
If _FileExists("Lucky_Numbers.dat") Then
    GoSub GetGameInfo: GoSub ChoosePlayer
Else
    GoSub GetPlayerName: Players = 1: Level = 1: Name$(1) = Name$: level(1) = 1: GoSub StoreGameInfo
End If

DisplayPlayer:
' Display Player's Name
font& = _LoadFont(fontpath1$, 25): _Font font&
Color 2, 0: _PrintString (885 - (Len(Name$) * 18 / 2), 140), Name$

ChooseLevel:
' Display Board Setup
For Z = 1 To 4
    For Y = 1 To 4
        X1 = BoardX(Board, Z, Y): X2 = BoardY(Board, Z, Y): X3 = SoloBoard(Level, Z, Y): X4 = 6: DrawCard X1, X2, X3, X4
        BoardCard(1, Z, Y) = SoloBoard(Level, Z, Y)
    Next
Next

' Display Level Info
Color 3, 0: font& = _LoadFont(fontpath$, 85): _Font font&
_PrintString (190, 50), String$(20, 32)
If Level > 9 Then W = 190 Else W = 215
_PrintString (W, 50), "Level " + Str$(Level)

Color 15, 0: font& = _LoadFont(fontpath1$, 25): _Font font&
_PrintString (210, 160), Str$(SoloMoves(Level)) + " Moves to Complete Level"

' Display Previous / Next Level Arrows
Color 15, 0: font& = _LoadFont(fontpath1$, 30): _Font font&
_PrintString (30, 262), "Previous ": _PrintString (53, 300), "Level"
_PrintString (616, 262), "Next": _PrintString (610, 300), "Level"

If Level > 1 Then PrevColor = 2 Else PrevColor = 1
If Level < level(Player) Then NextColor = 2 Else NextColor = 1
PSet (130, 450), PrevColor: Draw "TA0U90TA120U90TA240U90": Paint (120, 405), PrevColor
PSet (610, 360), NextColor: Draw "TA0D90TA120D90TA240D90": Paint (620, 405), NextColor

Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 770: Print "      Choose a Level      ";
Locate 36, 770: Print "  or Select an Option      ";

' Display Level Menu
Color 15, 0: font& = _LoadFont(fontpath1$, 25): _Font font&
Locate 9, 800: Print " Choose Level"

X = 0
For Z = 1 To 3
    Color 2, 0: Locate 11 + X, 800: Print Menu$(ChooseLevelMenu(Z))
    Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 15, B
    X = X + 2
Next

GetLevelInput:
Do While _MouseInput

    ' Previous Arrow Input
    If _MouseX > 35 And _MouseX < 145 And _MouseY > 345 And _MouseY < 465 Then Selected = 1 Else Selected = 0

    If Selected And PrevColor = 2 Then
        Line (35, 345)-(145, 465), 15, B
    Else
        Line (35, 345)-(145, 465), 0, B
    End If

    If _MouseButton(1) And Selected And PrevColor = 2 Then
        GoSub ReleaseButton: Level = Level - 1: GoTo ChooseLevel
    End If

    ' Next Arrow Input
    If _MouseX > 595 And _MouseX < 705 And _MouseY > 345 And _MouseY < 465 Then Selected = 1 Else Selected = 0

    If Selected And NextColor = 2 Then
        Line (595, 345)-(705, 465), 15, B
    Else
        Line (595, 345)-(705, 465), 0, B
    End If

    If _MouseButton(1) And Selected And NextColor = 2 Then
        GoSub ReleaseButton: Level = Level + 1: GoTo ChooseLevel
    End If

    ' Button Input
    For Z = 1 To 3
        If _MouseX > 790 And _MouseX < 977 And _MouseY > PlayerNameY(Z + 1) - 8 And _MouseY < PlayerNameY(Z + 1) + 30 Then Selected = 1 Else Selected = 0

        If Selected Then
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 5, B
        Else
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 15, B
        End If

        If _MouseButton(1) And Selected Then
            GoSub ReleaseButton

            ' Play Level
            If Z = 1 Then Line (790, 170)-(977, 600), 0, BF: Move = 1: GoTo ChooseMove

            ' Choose Player
            If Z = 2 Then Line (790, 110)-(977, 600), 0, BF: GoSub ChoosePlayer: GoTo DisplayPlayer

            ' End Game
            If Z = 3 Then System

        End If

    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 GetLevelInput

ChooseMove:
' Remove Level Arrows
Line (25, 260)-(160, 460), 0, BF: Line (600, 260)-(700, 460), 0, BF

font& = _LoadFont(fontpath1$, 25): _Font font&
Color 15.0: Locate 9, 800: Print " Choose Move "

X = 0
For Z = 1 To 5
    Color 2, 0: Locate 11 + X, 800: Print Menu$(PlayLevelMenu(Z))
    Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 15, B
    X = X + 2
Next

DisplayMove:
Color 6, 0: font& = _LoadFont(fontpath$, 55): _Font font&
_PrintString (270, 610), "Move " + Str$(Move)

Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 750: Print "    Choose Card to Swap      ";
Locate 36, 750: Print "      or Select an Option      ";

Color 2, 0: font& = _LoadFont(fontpath1$, 25): _Font font&
GetPlayLevelInput:
Do While _MouseInput

    ' Board Input
    For Z = 1 To 4
        For Y = 1 To 4
            If _MouseX > BoardX(1, Z, Y) - 38 And _MouseX < BoardX(1, Z, Y) + 38 And _MouseY > BoardY(1, Z, Y) - 38 And _MouseY < BoardY(1, Z, Y) + 38 And _MouseButton(1) = -1 Then
                GoSub ReleaseButton: Line (BoardX(1, Z, Y) - 38, BoardY(1, Z, Y) - 38)-(BoardX(1, Z, Y) + 38, BoardY(1, Z, Y) + 38), 15, B: Row1 = Z: Col1 = Y: GoTo ChooseNextCard
            End If
        Next
    Next

    ' Button Input
    For Z = 1 To 5
        If _MouseX > 790 And _MouseX < 977 And _MouseY > PlayerNameY(Z + 1) - 8 And _MouseY < PlayerNameY(Z + 1) + 30 Then Selected = 1 Else Selected = 0

        If Selected Then
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 5, B
        Else
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 15, B
        End If

        If _MouseButton(1) And Selected Then
            GoSub ReleaseButton

            ' Play Solution
            If Z = 1 Then GoSub EndLevel: If EndTurn Then GoSub PlaySolution: GoTo DisplayMove Else GoTo DisplayMove

            ' Restart Level
            If Z = 2 Then
                GoSub EndLevel
                If EndTurn Then
                    For X = 1 To 4
                        For Y = 1 To 4
                            X1 = BoardX(1, X, Y): X2 = BoardY(1, X, Y): X3 = SoloBoard(Level, X, Y): X4 = 6: DrawCard X1, X2, X3, X4
                            BoardCard(1, X, Y) = SoloBoard(levelevel, X, Y)
                        Next
                    Next
                    Move = 1
                End If
                GoTo DisplayMove
            End If

            ' Choose Level
            If Z = 3 Then GoSub EndLevel: If EndTurn Then Line (790, 110)-(977, 600), 0, BF: GoTo ChooseLevel Else GoTo DisplayMove

            ' Choose Player
            If Z = 4 Then GoSub EndLevel: If EndTurn Then Line (790, 110)-(977, 600), 0, BF: GoSub ChoosePlayer: GoTo DisplayPlayer Else GoTo DisplayMove

            ' End Game
            If Z = 5 Then GoSub EndLevel: If EndTurn Then System Else GoTo GetPlayLevelInput

        End If

    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 GetPlayLevelInput

ChooseNextCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 750: Print "    Choose the Next Card    ";
Locate 36, 750: Print "      or Select an Option    ";

GetNextCard:
Do While _MouseInput

    ' Board Input
    For Z = 1 To 4
        For Y = 1 To 4
            If _MouseX > BoardX(1, Z, Y) - 38 And _MouseX < BoardX(1, Z, Y) + 38 And _MouseY > BoardY(1, Z, Y) - 38 And _MouseY < BoardY(1, Z, Y) + 38 And _MouseButton(1) Then
                GoSub ReleaseButton: Row2 = Z: Col2 = Y: X = 0
                If Z = Row1 And Y = Col1 Then Line (BoardX(1, Row1, Col1) - 38, BoardY(1, Row1, Col1) - 38)-(BoardX(1, Row1, Col1) + 38, BoardY(1, Row1, Col1) + 38), 1, B: GoTo GetPlayLevelInput
                If (Row1 = Row2 And (Col1 = Col2 + 1 Or Col1 = Col2 - 1)) Or (Col1 = Col2 And (Row1 = Row2 + 1 Or Row1 = Row2 - 1)) Then X = 1
                If (Row1 = Row2 And ((Col1 = 1 And Col2 = 4) Or (Col1 = 4 And Col2 = 1))) Or (Col1 = Col2 And ((Row1 = 1 And Row2 = 4) Or (Row1 = 4 And Row2 = 1))) Then X = 1
                If X = 1 Then Line (BoardX(1, Z, Y) - 38, BoardY(1, Z, Y) - 38)-(BoardX(1, Z, Y) + 38, BoardY(1, Z, Y) + 38), 15, B: GoTo CheckLevelComplete
            End If
        Next
    Next

    ' Button Input
    For Z = 1 To 5
        If _MouseX > 790 And _MouseX < 977 And _MouseY > PlayerNameY(Z + 1) - 8 And _MouseY < PlayerNameY(Z + 1) + 30 Then Selected = 1 Else Selected = 0

        If Selected Then
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 5, B
        Else
            Line (790, PlayerNameY(Z + 1))-(977, PlayerNameY(Z + 1) + 40), 15, B
        End If

        If _MouseButton(1) And Selected Then

            GoSub ReleaseButton

            ' Play Solution
            If Z = 1 Then
                GoSub EndLevel
                If EndTurn Then
                    Line (BoardX(1, Row1, Col1) - 38, BoardY(1, Row1, Col1) - 38)-(BoardX(1, Row1, Col1) + 38, BoardY(1, Row1, Col1) + 38), 1, B: GoSub PlaySolution: GoTo DisplayMove
                Else
                    GoTo ChooseNextCard
                End If
            End If

            ' Restart Level
            If Z = 2 Then
                GoSub EndLevel
                If EndTurn Then
                    For X = 1 To 4
                        For Y = 1 To 4
                            X1 = BoardX(1, X, Y): X2 = BoardY(1, X, Y): X3 = SoloBoard(Level, X, Y): X4 = 6: DrawCard X1, X2, X3, X4
                            BoardCard(1, X, Y) = SoloBoard(levelevel, X, Y)
                        Next
                    Next
                    Move = 1
                End If

                GoTo ChooseNextCard

            End If

            ' Choose Level
            If Z = 3 Then GoSub EndLevel: If EndTurn Then Line (790, 110)-(977, 600), 0, BF: GoTo ChooseLevel Else GoTo ChooseNextCard

            ' Choose Player
            If Z = 4 Then GoSub EndLevel: If EndTurn Then Line (790, 110)-(977, 600), 0, BF: GoSub ChoosePlayer: GoTo DisplayPlayer Else GoTo ChooseNextCard

            ' End Game
            If Z = 5 Then GoSub EndLevel: If EndTurn Then System Else GoTo ChooseNextCard

        End If

    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 GetNextCard

CheckLevelComplete:
' Swap Chosen Cards
Swap BoardCard(1, Row1, Col1), BoardCard(1, Row2, Col2)
X1 = BoardX(1, Row1, Col1): X2 = BoardY(1, Row1, Col1): X3 = BoardCard(1, Row1, Col1): X4 = 6: DrawCard X1, X2, X3, X4
X1 = BoardX(1, Row2, Col2): X2 = BoardY(1, Row2, Col2): X3 = BoardCard(1, Row2, Col2): X4 = 6: DrawCard X1, X2, X3, X4

' Remove Cursors
Line (BoardX(1, Row1, Col1) - 38, BoardY(1, Row1, Col1) - 38)-(BoardX(1, Row1, Col1) + 38, BoardY(1, Row1, Col1) + 38), 1, B
Line (BoardX(1, Row2, Col2) - 38, BoardY(1, Row2, Col2) - 38)-(BoardX(1, Row2, Col2) + 38, BoardY(1, Row2, Col2) + 38), 1, B

' Check for Level Completed
If Move = SoloMoves(Level) Then

    V = 0: W = 1
    For Z = 1 To 4
        For Y = 1 To 4
            PlayCard = BoardCard(1, Z, Y): Row = Z: Column = Y: GoSub CheckPosition: If X1 = 1 And X2 = 1 And X3 = 1 And X4 = 1 Then V = V + 1
        Next
    Next

    If V = 16 Then
        Color 6, 0: font& = _LoadFont(fontpath$, 55): _Font font&
        _PrintString (130, 610), "Level Completed!"

        Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
        Locate 34, 750: Print "Level Succesfully Completed";
        Locate 36, 750: Print " Press <ENTER> Next Level  ";

        GetENTER5:
        A$ = InKey$: If A$ = "" GoTo GetENTER5
        If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
        If Asc(A$) <> 13 GoTo GetENTER5

        Locate 34, 450: Print String$(30, 32);: Locate 36, 450: Print String$(50, 32);

        Color 6, 0: font& = _LoadFont(fontpath$, 55): _Font font&
        _PrintString (130, 610), String$(40, 32)

        Move = 1: Level = Level + 1: level(Player) = Level: Name$(Player) = Name$

        Color 3, 0: font& = _LoadFont(fontpath$, 85): _Font font&
        _PrintString (190, 50), String$(20, 32)
        If Level > 9 Then W = 190 Else W = 215
        _PrintString (W, 50), "Level " + Str$(Level)

        Color 15, 0: font& = _LoadFont(fontpath1$, 25): _Font font&
        _PrintString (210, 160), Str$(SoloMoves(Level)) + " Moves to Complete Level"

        For Z = 1 To 4
            For Y = 1 To 4
                BoardCard(1, Z, Y) = SoloBoard(Level, Z, Y)
                X1 = BoardX(1, Z, Y): X2 = BoardY(1, Z, Y): X3 = SoloBoard(Level, Z, Y): X4 = 6: DrawCard X1, X2, X3, X4
            Next
        Next

        GoSub StoreGameInfo

    Else

        Color 6, 0: font& = _LoadFont(fontpath$, 55): _Font font&
        _PrintString (170, 610), "  Level Failed!  "

        Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
        Locate 34, 750: Print "    Level Failed!  Try Again  ";
        Locate 36, 750: Print "Press <ENTER> Restart Level";

        GetENTER6:
        A$ = InKey$: If A$ = "" GoTo GetENTER6
        If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
        If Asc(A$) <> 13 GoTo GetENTER6

        Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
        Locate 34, 750: Print String$(30, 32);: Locate 36, 750: Print String$(45, 32);: Move = 1

        Color 3, 0: font& = _LoadFont(fontpath$, 85): _Font font&
        _PrintString (190, 50), String$(20, 32)
        If Level > 9 Then W = 190 Else W = 215
        _PrintString (W, 50), "Level " + Str$(Level)

        Color 3, 0: font& = _LoadFont(fontpath$, 55): _Font font&
        _PrintString (170, 610), String$(30, 32)

        For Z = 1 To 4
            For Y = 1 To 4
                BoardCard(1, Z, Y) = SoloBoard(Level, Z, Y)
                X1 = BoardX(1, Z, Y): X2 = BoardY(1, Z, Y): X3 = SoloBoard(Level, Z, Y): X4 = 6: DrawCard X1, X2, X3, X4
            Next
        Next

    End If

Else

    Move = Move + 1

End If

GoTo DisplayMove

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

EndLevel:
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 750: Print String$(40, 32);
Locate 36, 750: Print "    End This Level?  Y or N    ";
EndLevelTurn:
A$ = UCase$(InKey$): If A$ = "" GoTo EndLevelTurn
If A$ = "Y" Then EndTurn = 1: Return
If A$ = "N" Then EndTurn = 0: Return
GoTo EndLevelTurn

ChoosePlayer:
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 750: Print "      Choose a Player or    ";
Locate 36, 750: Print "      Choose New Player      ";

Color 15, 0: font& = _LoadFont(fontpath1$, 25): _Font font&
Locate 7, 800: Print "Choose Player";

X = 0: V = 0
For Z = 1 To Players + 1
    Locate 9 + X, 800: Color 2, 0
    If Z = Players + 1 Then Print "NEW PLAYER"; Else Print Name$(Z)
    Line (790, PlayerNameY(Z))-(977, PlayerNameY(Z) + 40), 15, B
    X = X + 2: V = V + 50
Next

GetPlayer:
Do While _MouseInput
    If Players = 8 Then X = 8 Else X = Players + 1
    For Z = 1 To X
        If _MouseX > 790 And _MouseX < 977 And _MouseY > PlayerNameY(Z) And _MouseY < PlayerNameY(Z) + 40 Then Selected = 1 Else Selected = 0
        If Selected Then
            Line (790, PlayerNameY(Z))-(977, PlayerNameY(Z) + 40), 5, B
        Else
            Line (790, PlayerNameY(Z))-(977, PlayerNameY(Z) + 40), 15, B
        End If
        If _MouseButton(1) And Selected Then
            GoSub ReleaseButton: Color 2, 0: font& = _LoadFont(fontpath$, 85): _Font font&
            If Z = Players + 1 Then
                GoSub GetPlayerName: Players = Players + 1: Name$(Players) = Name$: Player = Players: Level = 1: level(Players) = 1: GoSub StoreGameInfo
            Else
                Name$ = Name$(Z): Player = Z: Level = level(Z)
            End If
            length = Len(Name$): Line (790, 140)-(977, 600), 0, BF: Return
        End If
    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 GetPlayer

GetPlayerName:
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 34, 750: Print String$(40, 32);: Locate 36, 750: Print String$(40, 32);
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 45, 750: Print "Enter Your Name: ";
Name$ = "_        ": Position = 1
PrintName: Locate 45, 880: Print String$(35, 32);: Locate 45, 880: Print Name$;
EnterLetter: A$ = UCase$(InKey$): If A$ = "" GoTo EnterLetter
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
If Asc(A$) > 64 And Asc(A$) < 91 And Position < 11 Then Mid$(Name$, Position, 2) = A$ + "_": Position = Position + 1: GoTo PrintName
If Asc(A$) = 8 And Position > 1 Then Mid$(Name$, Position - 1, 2) = "_ ": Position = Position - 1: GoTo PrintName
If Asc(A$) = 13 Then
    If Position < 10 Then Name$ = Left$(Name$, Position - 1)
    Locate 45, 750: Print String$(70, 32);: Return
End If
GoTo EnterLetter

StoreGameInfo:
Open "Lucky_Numbers.dat" For Output As #1
Write #1, Players
For Z = 1 To 8
    Print #1, Name$(Z)
    Write #1, level(Z)
Next
Close #1
Return

GetGameInfo:
Open "Lucky_Numbers.dat" For Input As #1
Input #1, Players
For Z = 1 To 8
    Line Input #1, Name$(Z)
    Input #1, level(Z)
Next
Close #1
Return

CheckPosition:
X = 1: X1 = 0: X2 = 0: X3 = 0: X4 = 0

Up: If Row - X >= 1 Then
    If BoardCard(W, Row - X, Column) = 0 Then X = X + 1: GoTo Up Else If PlayCard > BoardCard(W, Row - X, Column) Then X1 = 1
Else

    X1 = 1
End If

X = 1
Dn: If Row + X <= 4 Then
    If BoardCard(W, Row + X, Column) = 0 Then X = X + 1: GoTo Dn Else If PlayCard < BoardCard(W, Row + X, Column) Then X2 = 1
Else
    X2 = 1
End If

X = 1
Lt: If Column - X >= 1 Then
    If BoardCard(W, Row, Column - X) = 0 Then X = X + 1: GoTo Lt Else If PlayCard > BoardCard(W, Row, Column - X) Then X3 = 1
Else
    X3 = 1
End If

X = 1
Rt: If Column + X <= 4 Then
    If BoardCard(W, Row, Column + X) = 0 Then X = X + 1: GoTo Rt Else If PlayCard < BoardCard(W, Row, Column + X) Then X4 = 1
Else
    X4 = 1
End If
Return

PlaySolution:
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 36, 750: Print String$(40, 32);
X = Level
For Y = 1 To SoloMoves(Level)
    Color 6, 0: font& = _LoadFont(fontpath$, 55): _Font font&
    _PrintString (270, 610), "Move " + Str$(Y)
    Line (BoardX(1, Row1(X, Y), Col1(X, Y)) - 38, BoardY(1, Row1(X, Y), Col1(X, Y)) - 38)-(BoardX(1, Row1(X, Y), Col1(X, Y)) + 38, BoardY(1, Row1(X, Y), Col1(X, Y)) + 38), 15, B
    Line (BoardX(1, Row2(X, Y), Col2(X, Y)) - 38, BoardY(1, Row2(X, Y), Col2(X, Y)) - 38)-(BoardX(1, Row2(X, Y), Col2(X, Y)) + 38, BoardY(1, Row2(X, Y), Col2(X, Y)) + 38), 15, B
    _Delay 1
    Swap BoardCard(1, Row1(X, Y), Col1(X, Y)), BoardCard(1, Row2(X, Y), Col2(X, Y))
    X1 = BoardX(1, Row1(X, Y), Col1(X, Y)): X2 = BoardY(1, Row1(X, Y), Col1(X, Y)): X3 = BoardCard(1, Row1(X, Y), Col1(X, Y)): X4 = 6: DrawCard X1, X2, X3, X4
    X1 = BoardX(1, Row2(X, Y), Col2(X, Y)): X2 = BoardY(1, Row2(X, Y), Col2(X, Y)): X3 = BoardCard(1, Row2(X, Y), Col2(X, Y)): X4 = 6: DrawCard X1, X2, X3, X4
    Line (BoardX(1, Row1(X, Y), Col1(X, Y)) - 38, BoardY(1, Row1(X, Y), Col1(X, Y)) - 38)-(BoardX(1, Row1(X, Y), Col1(X, Y)) + 38, BoardY(1, Row1(X, Y), Col1(X, Y)) + 38), 1, B
    Line (BoardX(1, Row2(X, Y), Col2(X, Y)) - 38, BoardY(1, Row2(X, Y), Col2(X, Y)) - 38)-(BoardX(1, Row2(X, Y), Col2(X, Y)) + 38, BoardY(1, Row2(X, Y), Col2(X, Y)) + 38), 1, B
    _Delay 1
Next
Color 15, 0: font& = _LoadFont(fontpath1$, 20): _Font font&
Locate 36, 750: Print "Press <ENTER> to continue  ";
GetENTER3:
A$ = InKey$: If A$ = "" GoTo GetENTER3
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
If Asc(A$) <> 13 GoTo GetENTER3
For X = 1 To 4
    For Y = 1 To 4
        X1 = BoardX(1, X, Y): X2 = BoardY(1, X, Y): X3 = SoloBoard(Level, X, Y): X4 = 6: DrawCard X1, X2, X3, X4
        BoardCard(1, X, Y) = SoloBoard(Level, X, Y)
    Next
Next
Move = 1: GoTo DisplayMove
Return

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,

    If X3 > 0 Then

        If X3 = 100 Then W = 1: V = 2 Else W = 2: V = 15
        Paint (X1, X2), W, 2

        Line (X1 - 25, X2 - 22)-(X1 - 25, X2 + 22), V: Line (X1 + 25, X2 - 22)-(X1 + 25, X2 + 22), V: Line (X1 - 22, X2 - 25)-(X1 + 22, X2 - 25), V: Line (X1 - 22, X2 + 25)-(X1 + 22, X2 + 25), V
        Circle (X1 - 22, X2 - 22), 3, V, 1.5, 3.0: Circle (X1 + 22, X2 - 22), 3, V, 0, 1.6: Circle (X1 - 22, X2 + 22), 3, V, 3.0, 4.8: Circle (X1 + 22, X2 + 22), 3, V, 4.5, 0: Paint (X1, X2), V

        If X3 = 100 Then

            Paint (X1, X2), 15, 2: Color X4, 15: font& = _LoadFont(fontpath$, 10): _Font font&
            Color 15, 2: _PrintString (808, 228), "Lucky": _PrintString (800, 242), "Numbers"

        ElseIf X3 > 0 Then

            Color X4, 15: font& = _LoadFont(fontpath$, 40): _Font font&
            If X3 < 10 Then X = 20 Else X = 22
            _PrintString (X1 - X, X2 - 15), Right$(Str$(X3), 2)

        End If
    End If

End Sub


.7z   Lucky Numbers (with Solo Play).7z (Size: 2.33 MB / Downloads: 33)
Reply
#3
(12-23-2023, 02:18 PM)SMcNeill Wrote: Hello Everyone,
This is the completed version of Lucky Numbers board game including Solo Play. Solo Play is a puzzle game the challenges the player to try to complete 40 levels of play.

During the making of the Solo Play edition, my hard drive on my laptop crashed and won't load Windows. This was the only location where I had Solo Play with no other backups, only a few hand written notes. Unable to recover any data at this time, I simply downloaded the 2 to 4 player version from here and started over.

Ouch. Better go easy on the egg nog for a while.

Thank you for this program. I have found something else to do on "The" Eve.

LOL just noticed Donald has his own forum. Congratulations. Keep bringing on the weird board games.
Reply




Users browsing this thread: 2 Guest(s)