Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tilt Solo Maze Game
#1
Hello All,

Tilt is a single player maze game with 40 challenges. Hope you enjoy playing.

Donald

   
 https://youtu.be/-h2A2cuivRA

.pdf   Tilt Description.pdf (Size: 44.42 KB / Downloads: 57)

.pdf   Tilt Review.pdf (Size: 366.79 KB / Downloads: 60)

.pdf   Tilt Rules.pdf (Size: 1.55 MB / Downloads: 83)
 
Code: (Select All)
_Title "Tilt by Donald L. Foster Jr."

Screen _NewImage(1324, 736, 256)

_PaletteColor 1, _RGB32(200, 200, 200) '      LT GREY
_PaletteColor 2, _RGB32(150, 150, 150) '      MED GREY
_PaletteColor 3, _RGB32(100, 100, 100) '      DK GREY
_PaletteColor 4, _RGB32(0, 245, 0) '          LT GREEN
_PaletteColor 5, _RGB32(0, 195, 0) '          MED GREEN
_PaletteColor 6, _RGB32(0, 125, 0) '          DK GREEN
_PaletteColor 7, _RGB32(0, 245, 245) '        LT CYAN
_PaletteColor 8, _RGB32(0, 195, 195) '        MED CYAN
_PaletteColor 9, _RGB32(0, 145, 145) '        DK CYAN
_PaletteColor 10, _RGB32(194, 78, 0) '        ORANGE
_PaletteColor 11, _RGB32(0, 80, 255) '        BLUE
_PaletteColor 12, _RGB32(255, 0, 0) '         RED
_PaletteColor 13, _RGB32(175, 175, 175) '     MED LT GREY
_PaletteColor 14, _RGB32(125, 125, 125) '     MED DK GREY
_PaletteColor 16, _RGB32(75, 75, 75) '        DARKER GREY
_PaletteColor 17, _RGB32(50, 50, 50) '        DARKEST GREY
_PaletteColor 18, _RGB32(220, 220, 220) '     MED WHITE
_PaletteColor 19, _RGB32(0, 0, 80) '          DK BLUE
_PaletteColor 20, _RGB32(0, 0, 110) '         MED DK BLUE
_PaletteColor 21, _RGB32(136, 0, 0) '         RED

Dim As _Unsigned _Bit Selected
Dim As _Byte Y, Z, LastDirection, Ended
Dim Shared As _Byte Card, Moves, Solution, Pieces, GreenPieces(40), BoardTemp(5, 5)
Dim Shared As _Byte BoardShadow(8), PieceColor(2, 3), PatternCard(40, 5, 5), HintCard(40, 5, 5), BoardPiece(5, 5)
Dim Shared As Integer BoardX(5, 5), BoardY(5, 5)
Dim Shared As String UpDownCursor, LeftRightCursor, CardArrowCursor, ArrowCursor, SolutionCard(40), Arrow(4)

PieceColor(1, 1) = 5: PieceColor(1, 2) = 4: PieceColor(1, 3) = 6: PieceColor(2, 1) = 8: PieceColor(2, 2) = 7: PieceColor(2, 3) = 9
PlayerName$(1) = "Empty     ": PlayerName$(2) = "Empty     ": PlayerName$(3) = "Empty     ": PlayerName$(4) = "Empty     "
PlayerName$(5) = "Empty     ": PlayerName$(6) = "Empty     ": PlayerName$(7) = "Empty     ": PlayerName$(8) = "Guest     "

UpDownCursor = "D64R127U64L127H1D66R129U66L129": LeftRightCursor = "D127R64U127L64H1D129R66U129L66"
CardArrowCursor = "R140D140L140U140H1R142D142L142U142"

Arrow(1) = "BU8F8L4D8L8U8L4E8": Arrow(2) = "BD8H8R4U8R8D8R4G8": Arrow(3) = "BL8E8D4R8D8L8D4H8": Arrow(4) = "BR8G8U4L8U8R8U4F8"
ArrowCursor = "R24D24L24U24H1R26D26L26U26"

' Board Shadow Color Setup
Data 0,17,16,3,14,2,13,1
For Z = 1 To 8: Read BoardShadow(Z): Next

' Setup Green Pieces
Data 1,1,2,2,2,2,1,2,1,1,2,2,2,1,1,1,1,1,2,1,1,2,1,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2
For Z = 1 To 40: Read GreenPieces(Z): Next

' Pattern Card Setup
Data 1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0
Data 3,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 2,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0
Data 3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1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For Z = 1 To 40: For Y = 1 To 5: For v = 1 To 5: Read HintCard(Z, Y, v): Next: Next: Next

' Solution Card Setup
SolutionCard(1) = "DRURUL1D"
SolutionCard(2) = "RDLURDLU1R"
SolutionCard(3) = "RDR1UDL1U"
SolutionCard(4) = "RUL1DURDLU1R"
SolutionCard(5) = "RUL1D"
SolutionCard(6) = "RDLURDLURUL1D"
SolutionCard(7) = "RULDLURDRURDLU1R"
SolutionCard(8) = "RDLDRDR1UDLURDLDRDR1U"
SolutionCard(9) = "RDLURDL1U"
SolutionCard(10) = "ULDRDRULULU1R"
SolutionCard(11) = "DRURDLURDRU1LDRU1L"
SolutionCard(12) = "DRULURDL1URDL1U"
SolutionCard(13) = "ULDRULDRULDLU1R"
SolutionCard(14) = "LURDRULDRURDLURD1L"
SolutionCard(15) = "DLDRURDLU1R"
SolutionCard(16) = "DRULDLURDRULDRURDLU1R"
SolutionCard(17) = "RULDLDRURDL1U"
SolutionCard(18) = "RURDRURDRDLDLURDLURUL1D"
SolutionCard(19) = "LURDLDEDL1U"
SolutionCard(20) = "DRURURURDRDLURDLULDLULDLDLU1R"
SolutionCard(21) = "LULDRULURURULDRULURULURDRU1L"
SolutionCard(22) = "LURDLU1R"
SolutionCard(23) = "RDLURULDRDLULDRD1L"
SolutionCard(24) = "LURDRULDLDRLLU1RLDRULDRULU1R"
SolutionCard(25) = "LURDLDRURULURDLURDLU1R"
SolutionCard(26) = "LDRURDLDRURDLDRURDLU1R"
SolutionCard(27) = "URULDLURDLDLURULDLURDLU"
SolutionCard(28) = "RDLURDLULURDRDLULURDLDLDLULULD1R"
SolutionCard(29) = "DRDRDLULULDRDRDLULULDRDRDRU1L"
SolutionCard(30) = "RURURULDLURDRURULDRULDRD1L"
SolutionCard(31) = "RURDLDRURU1LRDLURU1L"
SolutionCard(32) = "DRULURDLURDRU1L1D"
SolutionCard(33) = "URULURDLULDRDLUL1DRURDLURULD1R"
SolutionCard(34) = "LULURDLULURULDRDLULDR1U1L"
SolutionCard(35) = "ULDRDL1ULDRULDRDL1U"
SolutionCard(36) = "DLURDRDLURDRDLDR1ULURDR1U"
SolutionCard(37) = "DLDRURDLDRURDRURD1LDRURUL1D"
SolutionCard(38) = "DRURDLDRDLULURULDLU1RLDRULURDLU1R"
SolutionCard(39) = "LDLDRDLDRDLULDRDLURURDLURDLDLD1RLU1R"
SolutionCard(40) = "DRURURDRDLDRDLURULURULDLDLULDLU1RLDLU1R"

Cls , 3

BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

Color 15, 3: font& = _LoadFont(BoldFont$, 30): _Font font&: _UPrintString (835, 10), ".T I L T  -  Teetering Logic Maze"

Card = 1

GetCard:
DrawBoard: DrawCard 1: DisplayCardArrows: ChooseCardButton

Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (860, 710), "Choose a Challenge Card to Play"

ChooseCard:
Do While _MouseInput

    ' Previous Card Arrow
    If _MouseX > 750 And _MouseX < 890 And _MouseY > 145 And _MouseY < 285 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (750, 145), 15: Draw CardArrowCursor Else PSet (750, 145), 3: Draw CardArrowCursor
    If _MouseButton(1) = -1 And Selected = 1 Then
        GoSub ReleaseButton: If Card = 1 Then Card = 40 Else Card = Card - 1
        DrawCard 1
    End If

    ' Next Card Arrow
    If _MouseX > 1160 And _MouseX < 1300 And _MouseY > 145 And _MouseY < 285 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (1159, 145), 15: Draw CardArrowCursor Else PSet (1159, 145), 3: Draw CardArrowCursor
    If _MouseButton(1) = -1 And Selected = 1 Then
        GoSub ReleaseButton: If Card = 40 Then Card = 1 Else Card = Card + 1
        DrawCard 1
    End If

    ' Choose Card Button
    If _MouseX > 894 And _MouseX < 1154 And _MouseY > 394 And _MouseY < 436 And _MouseButton(1) = -1 Then GoSub ReleaseButton: GoTo EndChooseCard

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 ChooseCard

EndChooseCard:
Line (893, 394)-(1155, 437), 3, BF: Line (750, 145)-(890, 285), 3, BF: Line (1159, 145)-(1300, 285), 3, BF:

Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (860, 710), Space$(300): SetupBoard 1

Color 0, 3: font& = _LoadFont(BoldFont$, 35): _Font font&: _UPrintString (955, 390), "M O V E S": Moves = 0

' Display Buttons
DrawButtons: DisplayMoves: LastDirection = 0: Pieces = 0

Direction: Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (855, 710), "Choose a Direction to Shift Pieces"

ChooseDirection:
Do While _MouseInput

    ' Up Arrow
    If _MouseX > 302 And _MouseX < 434 And _MouseY > 23 And _MouseY < 92 And LastDirection <> 1 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (304, 25), 0: Draw UpDownCursor$ Else PSet (304, 25), 18: Draw UpDownCursor$
    If _MouseButton(1) = -1 And Selected = 1 Then GoSub ReleaseButton: Solution = 0: Ended = ShiftPieces(1): LastDirection = 1: PSet (304, 25), 18: Draw UpDownCursor: GoTo EndShiftPieces

    ' Down Arrowd
    If _MouseX > 302 And _MouseX < 434 And _MouseY > 644 And _MouseY < 713 And LastDirection <> 2 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (304, 646), 0: Draw UpDownCursor$ Else PSet (304, 646), 18: Draw UpDownCursor$
    If _MouseButton(1) = -1 And Selected = 1 Then GoSub ReleaseButton: Solution = 0: Ended = ShiftPieces(2): LastDirection = 2: PSet (304, 646), 18: Draw UpDownCursor: GoTo EndShiftPieces

    ' Left Arrow
    If _MouseX > 23 And _MouseX < 92 And _MouseY > 302 And _MouseY < 434 And LastDirection <> 3 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (25, 304), 0: Draw LeftRightCursor$ Else PSet (25, 304), 18: Draw LeftRightCursor$
    If _MouseButton(1) = -1 And Selected = 1 Then GoSub ReleaseButton: Solution = 0: Ended = ShiftPieces(3): LastDirection = 3: PSet (25, 304), 18: Draw LeftRightCursor: GoTo EndShiftPieces

    ' Right Arrow
    If _MouseX > 644 And _MouseX < 711 And _MouseY > 302 And _MouseY < 434 And LastDirection <> 4 Then Selected = 1 Else Selected = 0
    If Selected = 1 Then PSet (646, 304), 0: Draw LeftRightCursor$ Else PSet (646, 304), 18: Draw LeftRightCursor$
    If _MouseButton(1) = -1 And Selected = 1 Then GoSub ReleaseButton: Solution = 0: Ended = ShiftPieces(4): LastDirection = 4: PSet (646, 304), 18: Draw LeftRightCursor: GoTo EndShiftPieces

    ' Hint Button
    If _MouseX > 758 And _MouseX < 915 And _MouseY > 447 And _MouseY < 489 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: DrawCard 2: GoSub PressEnter: DrawCard 1: GoTo Direction
    End If

    ' Solution Button
    If _MouseX > 1134 And _MouseX < 1292 And _MouseY > 447 And _MouseY < 489 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: DrawCard 3: DrawCard 1: GoTo Direction
    End If

    ' Restart Maze
    If _MouseX > 853 And _MouseX < 1009 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: If EndMaze = 0 GoTo Direction Else DrawBoard: SetupBoard 1: Moves = 0: DisplayMoves: GoTo Direction
    End If

    ' New Maze
    If _MouseX > 1040 And _MouseX < 1197 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: If EndMaze = 0 GoTo Direction Else Line (754, 388)-(1297, 662), 3, BF: GoTo GetCard
    End If

    ' Exit Maze
    If _MouseX > 759 And _MouseX < 915 And _MouseY > 613 And _MouseY < 653 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: If EndMaze = 0 GoTo ChooseDirection Else System
    End If

    ' Load Maze
    If _MouseX > 947 And _MouseX < 1103 And _MouseY > 613 And _MouseY < 653 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: If EndMaze = 0 GoTo Direction Else GoTo LoardMaze
    End If

    ' Save Maze
    If _MouseX > 1135 And _MouseX < 1291 And _MouseY > 613 And _MouseY < 653 And _MouseButton(1) = -1 Then
        GoSub ReleaseButton: GoTo SaveMaze
    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 ChooseDirection

EndShiftPieces:
Moves = Moves + 1: DisplayMoves

If Ended > 0 Then If CompletedMaze(Ended) = 1 And Solution = 0 GoTo GetCard

GoTo ChooseDirection

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

PressEnter:
Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&
_UPrintString (855, 710), Space$(300)
_UPrintString (890, 710), "Press <ENTER> to Continue"
GetENTER2: A$ = InKey$: If A$ = "" GoTo GetENTER2
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 GetENTER2 Else _UPrintString (855, 710), Space$(300): Return

NoMaze:
Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&
_UPrintString (855, 710), Space$(300)
_UPrintString (890, 682), "There are No Saved Mazes"
_UPrintString (890, 710), "Press <ENTER> to Continee"
Enter: A$ = InKey$: If A$ = "" GoTo Enter Else If Asc(A$) <> 13 GoTo Enter
_UPrintString (890, 682), Space$(300): _UPrintString (855, 710), Space$(300)
GoTo Direction

LoardMaze:
On Error GoTo NoMaze
Open "TiltData" For Input As #1
Input #1, Card, Moves
For Z = 1 To 5: For Y = 1 To 5: Input #1, BoardPiece(Z, Y): Next: Next
Close #1
DrawBoard: DrawCard 1: DisplayMoves
For Z = 1 To 5
    For Y = 1 To 5
        If BoardPiece(Z, Y) = 3 Then DrawBlock BoardX(Z, Y), BoardY(Z, Y), 1 Else If BoardPiece(Z, Y) > 0 Then DrawPiece BoardX(Z, Y), BoardY(Z, Y), BoardPiece(Z, Y), 1
    Next
Next
GoTo Direction

SaveMaze:
Open "TiltData" For Output As #1
Write #1, Card, Moves
For Z = 1 To 5: For Y = 1 To 5: Write #1, BoardPiece(Z, Y): Next: Next
Close #1
Message
GoTo Direction

Sub DrawBoard

    Line (5, 5)-(731, 731), 3, BF
    Circle (120, 120), 115, 19, 1.5, 3.2: Circle (616, 120), 115, 19, 0, 1.6: Circle (120, 616), 115, 19, 3.1, 4.7: Circle (616, 616), 115, 19, 4.7, 0
    Line (5, 120)-(5, 616), 19: Line (120, 5)-(616, 5), 19: Line (731, 120)-(731, 616), 19: Line (115, 731)-(616, 731), 19: Paint (100, 100), 19
    Circle (120, 120), 108, 15, 1.5, 3.2: Circle (616, 120), 108, 15, 0, 1.6: Circle (120, 616), 108, 15, 3.1, 4.7: Circle (616, 616), 108, 15, 4.7, 0
    Line (12, 125)-(12, 616), 15: Line (125, 12)-(611, 12), 15: Line (724, 115)-(724, 621), 15: Line (115, 724)-(616, 724), 15: Paint (100, 100), 18, 15

    ' Draw Board Slots
    x = 0
    For Z = 1 To 6
        W = 0
        For Y = 1 To 6
            Line (108 - 37 + W, 108 - 37 + x)-(108 + 37 + W, 108 + 37 + x), 1, B
            PSet (108 - 37 + W, 108 - 37 + x), 15: Draw "R74D74H1U72L72F1R70D70C1L70U70H1D72R72F1L74U74C3G1D74R74G1L74U74G1D74R74G1L74U74G1D74R74G1L74U74G1D74R74"
            W = W + 104
        Next
        x = x + 104
    Next

    ' Draw Inside Board Edge
    Circle (124, 124), 17, 19, 1.4, 3.3: Circle (612, 124), 17, 19, 0, 1.6: Circle (124, 612), 17, 19, 2.9, 4.8: Circle (612, 612), 17, 19, 4.5, 0
    Line (124, 107)-(612, 107), 19: Line (107, 124)-(107, 612), 19: Line (124, 629)-(612, 629), 19: Line (629, 124)-(629, 612), 19: Paint (20, 100), 18, 19

    ' Draw Board Shadow
    x = 0
    For Z = 1 To 8
        Circle (124, 124), 17 + x, BoardShadow(Z), 1.4, 3.3: Circle (612, 124), 17 + x, BoardShadow(Z), 0, 1.6: Circle (124, 612), 17 + x, BoardShadow(Z), 2.9, 4.8: Circle (612, 612), 17 + x, BoardShadow(Z), 4.5, 0
        Line (124, 107 - x)-(612, 107 - x), BoardShadow(Z): Line (107 - x, 124)-(107 - x, 612), BoardShadow(Z): Line (124, 629 + x)-(612, 629 + x), BoardShadow(Z): Line (629 + x, 124)-(629 + x, 612), BoardShadow(Z)
        x = x + 1
    Next

    ' Draw Center Exit
    Circle (368, 368), 63, 19: Paint (368, 368), 19

    ' Draw Up Arrow
    Circle (368, 46), 14, 15, .7, 2.3: Circle (416, 77), 5, 15, 3.8, .8: Circle (320, 77), 5, 3, 2.5, 5.5: Circle (368, 52), 8, 3, .5, 2.6
    Line (378, 36)-(421, 74), 15: Line (359, 35)-(315, 74), 3: Line (372, 45)-(411, 79), 3: Line (364, 45)-(325, 79), 15

    ' Draw Lrft Arrow
    Circle (46, 368), 14, 3, 2.0, 4.0: Circle (77, 416), 5, 3, 3.8, .8: Circle (77, 320), 5, 15, 5.5, 2.5: Circle (52, 368), 8, 15, 2.0, 4.0
    Line (36, 378)-(74, 421), 3: Line (35, 359)-(74, 315), 3: Line (45, 372)-(79, 411), 15: Line (45, 364)-(79, 325), 15

    ' Draw Right Arrow
    Circle (690, 368), 14, 15, 5.2, 1.0: Circle (659, 320), 5, 15, 0.9, 4.0: Circle (659, 416), 5, 3, 2.5, 5.5: Circle (684, 368), 8, 3, 5.0, 1.0
    Line (701, 378)-(665, 418), 15: Line (701, 359)-(662, 315), 15: Line (691, 372)-(654, 415), 3: Line (691, 364)-(657, 325), 3

    ' Draw Down Arrow
    Circle (368, 690), 14, 3, 4.0, 5.5: Circle (320, 659), 5, 3, .9, 4.0: Circle (416, 659), 5, 15, 5.5, 2.5: Circle (368, 684), 8, 15, 4.0, 5.5
    Line (378, 701)-(418, 665), 15: Line (359, 701)-(315, 662), 3: Line (372, 691)-(415, 654), 3: Line (364, 691)-(325, 657), 15

End Sub

Sub DrawCard (CardType)

    Dim As _Byte Y, Z, LevelColor, CardColor, ArrowColor, Space, Position, Arrow
    Dim As Integer V, X

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    Line (914, 61)-(1134, 369), 3, BF

    Circle (934, 81), 20, 15, 1.5, 3.2: Circle (1114, 81), 20, 15, 0, 1.6: Circle (934, 349), 20, 15, 2.9, 4.8: Circle (1114, 349), 20, 15, 4.7, 0
    Line (914, 81)-(914, 349), 15: Line (1134, 81)-(1134, 349), 15: Line (934, 61)-(1114, 61), 15: Line (934, 369)-(1114, 369), 15

    If CardType = 3 Then CardColor = 15 Else CardColor = 2
    Line (914, 334)-(1134, 334), 15: Paint (934, 81), CardColor, 15

    font& = _LoadFont(BoldFont$, 22): _Font font&
    If Card < 11 Then LevelColor = 6: Paint (927, 343), 6, 15: Color 15, 6: _UPrintString (979, 344), "BEGINNER"
    If Card > 10 And Card < 21 Then LevelColor = 10: Paint (924, 343), 10, 15: Color 15, 10: _UPrintString (961, 344), "INTERMEDIATE"
    If Card > 20 And Card < 31 Then LevelColor = 11: Paint (924, 343), 11, 15: Color 15, 11: _UPrintString (974, 344), "ADVANCED"
    If Card > 30 Then LevelColor = 21: Paint (924, 343), 21, 15: Color 15, 21: _UPrintString (993, 344), "EXPERT"

    font& = _LoadFont(BoldFont$, 30): _Font font&

    If CardType = 1 Then
        Color 0, CardColor: _UPrintString (985, 67), ".T I L T"
    ElseIf CardType = 2 Then
        Color LevelColor, CardColor: _UPrintString (985, 67), "H I N T:"
    Else
        Color LevelColor, CardColor: _UPrintString (957, 67), "SOLUTION:"
    End If

    If Card > 9 Then X = 1093 Else X = 1101
    Color LevelColor, CardColor: font& = _LoadFont(BoldFont$, 28): _Font font&: _UPrintString (X, 306), Str$(Card)

    If CardType = 3 Then

        font& = _LoadFont(BoldFont$, 30): _Font font&:

        Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (855, 710), Space$(300)
        _UPrintString (890, 710), "Press <ENTER> to Continue"

        Color LevelColor, 15: _PrintString (918, 108), ">"

        Solution = 1: Space = 1: Counter = 1: V = 106: Animate$ = ""

        StartRow: X = 945: Position = 1

        StartColumn:

        ' Get Next Character from Solution Card
        A$ = Mid$(SolutionCard(Card), Counter, 1)

        ' Set Next Arrow to be Displayed as Green
        If A$ = "1" Then ArrowColor = 5: Counter = Counter + 1: GoTo StartColumn

        ' Get Arrow Direction
        If A$ = "U" Then Arrow = 1
        If A$ = "D" Then Arrow = 2
        If A$ = "L" Then Arrow = 3
        If A$ = "R" Then Arrow = 4

        ' Create Solution Animation String
        Animate$ = Animate$ + Right$(Str$(Arrow), 1)

        ' Setup Next Arrow to Alternate Colors
        If ArrowColor = 0 Then If Space / 2 = Fix(Space / 2) Then ArrowColor = 2 Else ArrowColor = 17

        ' Draw Next Arrow
        PSet (X, V + 9), ArrowColor: Draw Arrow(Arrow): Paint (X, V + 8), ArrowColor

        ' Draw Line Under Arrows
        Line (934, V + 25)-(933 + Position * 23, V + 26), LevelColor, BF

        ' Setup for Next Arrow
        ArrowColor = 0: X = X + 23: Space = Space + 1: Counter = Counter + 1: Position = Position + 1

        ' Check for Last Arrow
        If Counter < Len(SolutionCard(Card)) Then If Position > 8 Then V = V + 45: GoTo StartRow Else GoTo StartColumn

        ' Get Board Current Positions
        For Z = 1 To 5: For Y = 1 To 5: BoardTemp(Z, Y) = BoardPiece(Z, Y): Next: Next

        ' Clear Board and Set to Starting Positions
        DrawBoard: SetupBoard 1

        ' Clear Moves and Buttons from Screen
        Line (754, 388)-(1297, 662), 3, BF: AnimateButton

        SolutionButton:
        Do While _MouseInput
            If _MouseX > 894 And _MouseX < 1154 And _MouseY > 394 And _MouseY < 436 And _MouseButton(1) = -1 Then GoSub ReleaseButton: GoTo Animate
        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
            If Asc(A$) = 13 Then
                Line (893, 394)-(1155, 437), 3, BF: DrawButtons: DrawBoard
                Color 0, 3: font& = _LoadFont(BoldFont$, 35): _Font font&: _UPrintString (955, 390), "M O V E S": DisplayMoves
                For Z = 1 To 5
                    For Y = 1 To 5
                        BoardPiece(Z, Y) = BoardTemp(Z, Y)
                        If BoardTemp(Z, Y) = 3 Then DrawBlock BoardX(Z, Y), BoardY(Z, Y), 1 Else If BoardTemp(Z, Y) > 0 Then DrawPiece BoardX(Z, Y), BoardY(Z, Y), BoardTemp(Z, Y), 1
                    Next
                Next
                GoTo EndSub
            End If
        End If
        GoTo SolutionButton

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

        Animate:
        V = 103: X = 933: Position = 1
        For Z = 1 To Len(Animate$):
            a = ShiftPieces(Val(Mid$(Animate$, Z, 1))): PSet (X, V), 0: Draw ArrowCursor
            Sleep 1: PSet (X, V), 15: Draw ArrowCursor: If Point(X + 14, V + 14) = 5 Then Paint (368, 368), 19
            If Position = 8 Then Position = 1: X = 933: V = V + 45 Else Position = Position + 1: X = X + 23
        Next

        Sleep 1: DrawBoard: SetupBoard 1: GoTo SolutionButton

    Else

        Circle (954, 129), 30, 19, 1.5, 3.2: Circle (1094, 129), 30, 19, 0, 1.6: Circle (954, 269), 30, 19, 2.9, 4.8: Circle (1094, 269), 30, 19, 4.7, 0
        Line (924, 129)-(924, 269), 19: Line (1124, 129)-(1124, 269), 19: Line (954, 99)-(1094, 99), 19: Line (954, 299)-(1094, 299), 19: Paint (954, 129), 19
        Circle (957, 132), 30, 15, 1.5, 3.2: Circle (1091, 132), 30, 15, 0, 1.6: Circle (957, 266), 30, 15, 2.9, 4.8: Circle (1091, 266), 30, 15, 4.7, 0
        Line (927, 132)-(927, 266), 15: Line (1121, 132)-(1121, 266), 15: Line (957, 102)-(1091, 102), 15: Line (957, 296)-(1091, 296), 15: Paint (936, 114), 18, 15

        X = 124
        For Z = 1 To 6
            W = 948
            For Y = 1 To 6
                Line (W - 10, X - 10)-(W + 10, X + 10), 1, B
                PSet (W - 10, X - 10), 15: Draw "R21D21H1U19L19C3D21R21G1L21U21G1D21R21"
                W = W + 30
            Next
            X = X + 30
        Next

        Circle (953, 129), 4, 19, 1.4, 3.3: Circle (1095, 129), 4, 19, 0, 1.6: Circle (953, 271), 4, 19, 2.9, 4.8: Circle (1095, 271), 4, 19, 4.5, 0
        Line (953, 125)-(1095, 125), 19: Line (953, 275)-(1095, 275), 19: Line (949, 129)-(949, 271), 19: Line (1099, 129)-(1099, 271), 19: Paint (936, 111), 18, 19

        Circle (953, 129), 4, 0, 1.4, 3.3: Circle (1095, 129), 4, 0, 0, 1.6: Circle (953, 271), 4, 0, 2.9, 4.8: Circle (1095, 271), 4, 0, 4.5, 0
        Line (953, 125)-(1095, 125), 0: Line (953, 275)-(1095, 275), 0: Line (949, 129)-(949, 271), 0: Line (1099, 129)-(1099, 271), 0
        Circle (953, 129), 5, 17, 1.4, 3.3: Circle (1095, 129), 5, 17, 0, 1.6: Circle (953, 271), 5, 17, 2.9, 4.8: Circle (1095, 271), 5, 17, 4.5, 0
        Line (953, 124)-(1095, 124), 17: Line (953, 276)-(1095, 276), 17: Line (948, 129)-(948, 271), 17: Line (1100, 129)-(1100, 271), 17

        Circle (1024, 200), 17, 19: Paint (1024, 200), 20, 19

        If CardType = 2 Then SetupHint Else SetupBoard 2

    End If
    EndSub: Solution = 0
End Sub

Sub DrawBlock (X, Y, Size)

    If Size = 1 Then
        Line (X - 36, Y - 51)-(X + 36, Y - 51), 2: Line (X - 51, Y - 36)-(X - 51, Y + 36), 2: Line (X + 51, Y - 36)-(X + 51, Y + 36), 2: Line (X - 36, Y + 51)-(X + 36, Y + 51), 2
        Circle (X - 36, Y - 36), 15, 2, 1.5, 3.1: Circle (X + 36, Y - 36), 15, 2, 0, 1.6: Circle (X - 36, Y + 36), 15, 2, 3.0, 4.8: Circle (X + 36, Y + 36), 15, 2, 4.6, 0: Paint (X, Y), 2
        Circle (X - 36, Y - 36), 9, 3, 1.5, 3.1: Circle (X + 36, Y - 36), 9, 3, 0, 1.6: Circle (X - 36, Y + 36), 9, 3, 3.0, 4.8: Circle (X + 36, Y + 36), 9, 3, 4.6, 0
        Line (X - 36, Y - 45)-(X + 36, Y - 45), 3: Line (X - 45, Y - 36)-(X - 45, Y + 36), 3: Line (X + 45, Y - 36)-(X + 45, Y + 36), 3: Line (X - 36, Y + 45)-(X + 36, Y + 45), 3
        PSet (X - 28, Y - 28), 3: Draw "R56D56H1U54L54F1R52D52H1U50L50F1R48D48H1U46L46F1R44D44H1U42L42F1R40D40C1L40U40H1D42R42F1L44U44H1D46R46F1L48U48H1D50R50F1L52U52H1D54R54F1L56U56"
    Else
        Line (X - 11, Y - 14)-(X + 11, Y - 14), 2: Line (X - 14, Y - 11)-(X - 14, Y + 11), 2: Line (X + 14, Y - 11)-(X + 14, Y + 11), 2: Line (X - 11, Y + 14)-(X + 11, Y + 14), 2
        Circle (X - 11, Y - 11), 3, 2, 1.5, 3.1: Circle (X + 11, Y - 11), 3, 2, 0, 1.6: Circle (X - 11, Y + 11), 3, 2, 3.0, 4.8: Circle (X + 11, Y + 11), 3, 2, 4.6, 0: Paint (X, Y), 2
        Circle (X - 9, Y - 9), 2, 3, 1.5, 3.1: Circle (X + 9, Y - 9), 2, 3, 0, 1.6: Circle (X - 9, Y + 9), 2, 3, 3.0, 4.8: Circle (X + 9, Y + 9), 2, 3, 4.6, 0
        Line (X - 9, Y - 11)-(X + 9, Y - 11), 3: Line (X - 11, Y - 9)-(X - 11, Y + 9), 3: Line (X + 11, Y - 9)-(X + 11, Y + 9), 3: Line (X - 9, Y + 11)-(X + 9, Y + 11), 3
        PSet (X - 6, Y - 6), 3: Draw "R12D12H1U10L10F1R8D8C1L8U8H1D10R10F1L12U12"
    End If

End Sub

Sub DrawPiece (X, Y, Piece, Size)

    If Size = 1 Then
        Circle (X, Y), 51, PieceColor(Piece, 1): Paint (X, Y), PieceColor(Piece, 1)
        Circle (X, Y), 35, PieceColor(Piece, 2), 5.5, 2.0: Circle (X - 7, Y + 7), 40, PieceColor(Piece, 2), 6.0, 1.8: Paint (X + 23, Y - 23), PieceColor(Piece, 2)
        Circle (X, Y), 51, PieceColor(Piece, 2), 5.5, 2.0: Circle (X - 7, Y + 7), 56, PieceColor(Piece, 2), 6.0, 1.8: Paint (X + 34, Y - 34), PieceColor(Piece, 2)
        Circle (X, Y), 35, PieceColor(Piece, 3), 2.7, 5.0: Circle (X + 7, Y - 7), 40, PieceColor(Piece, 3), 3.1, 4.8: Paint (X - 23, Y + 23), PieceColor(Piece, 3)
        Circle (X, Y), 51, PieceColor(Piece, 3), 2.7, 5.0: Circle (X + 7, Y - 7), 56, PieceColor(Piece, 3), 3.1, 4.8: Paint (X - 34, Y + 34), PieceColor(Piece, 3)
    Else
        Circle (X, Y), 14, PieceColor(Piece, 1): Paint (X, Y), PieceColor(Piece, 1)
        Circle (X, Y), 8, PieceColor(Piece, 2), 5.5, 2.0: Circle (X, Y), 8, PieceColor(Piece, 3), 2.7, 5.0
    End If

End Sub

Sub RemovePiece (X, Y)

    Circle (X, Y), 51, 18: Paint (X, Y), 18
    PSet (X + 8, Y - 50), 3: Draw "D42R42U1L41U41R1D40R40U1L39U39R1D38R38U1L37U37R1D36R36BU1C1L35U35"
    PSet (X + 13, Y + 15), 15: Draw "R35D1L34F1R33"
    PSet (X + 8, Y + 21), 3: Draw "D30R1U31E1D32R1U33E1D34R1U35E1D36"
    PSet (X - 15, Y + 50), 15: Draw "U35L35D1R34D34L1U33L33"
    PSet (X - 50, Y - 14), 3: Draw "R35G1L34D1R33G1L32D1R31G1L30D1R29"
    PSet (X - 15, Y - 50), 15: Draw "D35H1U34L1D33"

End Sub

Sub ChooseCardButton

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    Color 15, 0: font& = _LoadFont(BoldFont$, 30): _Font font&

    ' Restart Puzzle
    Circle (914, 415), 21, 0, 1.4, 4.8: Circle (1134, 415), 21, 0, 4.4, 1.6: Line (914, 394)-(1134, 394), 0: Line (914, 436)-(1134, 436), 0: Paint (914, 415), 0
    _UPrintString (919, 403), "Choose This Card"

End Sub

Sub AnimateButton

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    Color 15, 0: font& = _LoadFont(BoldFont$, 30): _Font font&

    ' Restart Puzzle
    Circle (914, 415), 21, 0, 1.4, 4.8: Circle (1134, 415), 21, 0, 4.4, 1.6: Line (914, 394)-(1134, 394), 0: Line (914, 436)-(1134, 436), 0: Paint (914, 415), 0
    _UPrintString (919, 403), "Animate Solution"

End Sub

Sub DrawButtons

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    font& = _LoadFont(BoldFont$, 30): _Font font&

    ' Hint Button
    Circle (779, 468), 21, 15, 1.4, 4.8: Circle (895, 468), 21, 15, 4.4, 1.6: Line (779, 447)-(895, 447), 15: Line (779, 489)-(895, 489), 15: Paint (779, 468), 15
    Color 0, 15: _UPrintString (811, 455), "Hint"

    ' Solve Button
    Circle (1155, 468), 21, 15, 1.4, 4.8: Circle (1271, 468), 21, 15, 4.4, 1.6: Line (1155, 447)-(1271, 447), 15: Line (1155, 489)-(1271, 489), 15: Paint (1155, 468), 15
    Color 0, 15: _UPrintString (1162, 455), "Solution"

    ' Restart Puzzle
    Circle (873, 561), 21, 0, 1.4, 4.8: Circle (989, 561), 21, 0, 4.4, 1.6: Line (873, 540)-(989, 540), 0: Line (873, 582)-(989, 582), 0: Paint (873, 561), 0
    Color 15, 0: _UPrintString (888, 548), "Restart"

    ' Change Puzzle
    Circle (1061, 561), 21, 0, 1.4, 4.8: Circle (1177, 561), 21, 0, 4.4, 1.6: Line (1061, 540)-(1177, 540), 0: Line (1061, 582)-(1177, 582), 0: Paint (1061, 561), 0
    Color 15, 0: _UPrintString (1088, 548), "New"

    ' Exit Puzzle
    Circle (779, 634), 21, 0, 1.4, 4.8: Circle (895, 634), 21, 0, 4.4, 1.6: Line (779, 613)-(895, 613), 0: Line (779, 655)-(895, 655), 0: Paint (779, 634), 0
    Color 15, 0: _UPrintString (811, 621), "Exit"

    ' Load Puzzle
    Circle (967, 634), 21, 0, 1.4, 4.8: Circle (1083, 634), 21, 0, 4.4, 1.6: Line (967, 613)-(1083, 613), 0: Line (967, 655)-(1083, 655), 0: Paint (967, 634), 0
    Color 15, 0: _UPrintString (997, 621), "Load"

    ' Save Puzzle
    Circle (1155, 634), 21, 0, 1.4, 4.8: Circle (1271, 634), 21, 0, 4.4, 1.6: Line (1155, 613)-(1271, 613), 0: Line (1155, 655)-(1271, 655), 0: Paint (1155, 634), 0
    Color 15, 0: _UPrintString (1187, 621), "Save"

End Sub

Sub DisplayCardArrows

    PSet (775, 215), 0: Draw "E50D25R40D50L40D25H50BR10P0,0"
    PSet (1274, 215), 0: Draw "G50U25L40U50R40U25F50BL10P0,0"

End Sub

Sub DisplayMoves

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    If Moves < 10 Then X = 995 Else X = 960
    Color 15, 3: font& = _LoadFont(BoldFont$, 120): _Font font&: _UPrintString (X, 420), LTrim$(Str$(Moves))

End Sub

Sub SetupBoard (Size)

    Dim As _Byte Y, Z
    Dim As Integer W, X

    If Size = 1 Then
        X = 0
        For Z = 1 To 5
            W = 0
            For Y = 1 To 5
                BoardPiece(Z, Y) = PatternCard(Card, Z, Y): BoardX(Z, Y) = 160 + W: BoardY(Z, Y) = 160 + X
                If BoardPiece(Z, Y) = 1 Or BoardPiece(Z, Y) = 2 Then DrawPiece 160 + W, 160 + X, BoardPiece(Z, Y), 1
                If BoardPiece(Z, Y) = 3 Then DrawBlock 160 + W, 160 + X, 1
                W = W + 104
            Next
            X = X + 104
        Next
    Else
        X = 140
        For Z = 1 To 5
            W = 964
            For Y = 1 To 5
                If PatternCard(Card, Z, Y) = 1 Or PatternCard(Card, Z, Y) = 2 Then DrawPiece W, X, PatternCard(Card, Z, Y), 2
                If PatternCard(Card, Z, Y) = 3 Then DrawBlock W, X, 2
                W = W + 30
            Next
            X = X + 30
        Next
    End If

End Sub

Sub SetupHint

    Dim As _Byte Y, Z
    Dim As Integer W, X

    X = 140
    For Z = 1 To 5
        W = 964
        For Y = 1 To 5
            If HintCard(Card, Z, Y) = 1 Or HintCard(Card, Z, Y) = 2 Then DrawPiece W, X, HintCard(Card, Z, Y), 2
            If HintCard(Card, Z, Y) = 3 Then DrawBlock W, X, 2
            W = W + 30
        Next
        X = X + 30
    Next

End Sub

Function ShiftPieces (Direction)

    Dim As _Byte Y, Z, Spaces, Ended: Ended = 0: ShiftPieces = 0

    Select Case Direction

        Case 1: ' Up
            For Z = 1 To 5
                If Z = 3 Then
                    If (BoardPiece(2, 3) = 1 Or BoardPiece(2, 3) = 2) And BoardPiece(1, 3) = 0 Then
                        BoardPiece(1, 3) = BoardPiece(2, 3): BoardPiece(2, 3) = 0
                        RemovePiece BoardX(2, 3), BoardY(2, 3): DrawPiece BoardX(1, 3), BoardY(1, 3), BoardPiece(1, 3), 1
                        RestoreCenter 1
                    End If
                    If BoardPiece(4, 3) = 1 Or BoardPiece(4, 3) = 2 Then
                        If Solution = 0 Then If BoardPiece(4, 3) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(4, 3), BoardY(4, 3): DrawPiece 368, 368, BoardPiece(4, 3), 1: BoardPiece(4, 3) = 0
                        RestoreCenter 2: If BoardPiece(4, 3) = 1 Then Sleep 1: Paint (368, 368), 19: Sleep 1
                    End If
                    If (BoardPiece(5, 3) = 1 Or BoardPiece(5, 3) = 2) And BoardPiece(4, 3) = 0 Then
                        If Solution = 0 Then If BoardPiece(5, 3) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(5, 3), BoardY(5, 3): DrawPiece 368, 368, BoardPiece(5, 3), 1: BoardPiece(5, 3) = 0
                        If BoardPiece(5, 3) = 1 Then Sleep 1: Paint (368, 368), 19
                    End If

                    If Ended = 1 Then ShiftPieces = 2
                    If Pieces = GreenPieces(Card) Then ShiftPieces = 1

                Else
                    For Y = 2 To 5
                        If BoardPiece(Y, Z) = 1 Or BoardPiece(Y, Z) = 2 Then
                            Spaces = 0
                            Check1:
                            If Y - Spaces - 1 >= 1 Then If BoardPiece(Y - Spaces - 1, Z) = 0 Then Spaces = Spaces + 1: GoTo Check1
                            If Spaces > 0 Then
                                BoardPiece(Y - Spaces, Z) = BoardPiece(Y, Z): BoardPiece(Y, Z) = 0
                                RemovePiece BoardX(Y, Z), BoardY(Y, Z): DrawPiece BoardX(Y - Spaces, Z), BoardY(Y - Spaces, Z), BoardPiece(Y - Spaces, Z), 1
                                If Z = 2 And Y = 3 Then RestoreCenter 3
                                If Z = 4 And Y = 3 Then RestoreCenter 4
                            End If
                        End If
                    Next
                End If
            Next

        Case 2: ' Down
            For Z = 1 To 5
                If Z = 3 Then
                    If (BoardPiece(4, 3) = 1 Or BoardPiece(4, 3) = 2) And BoardPiece(5, 3) = 0 Then
                        BoardPiece(5, 3) = BoardPiece(4, 3): BoardPiece(4, 3) = 0
                        RemovePiece BoardX(4, 3), BoardY(4, 3): DrawPiece BoardX(5, 3), BoardY(5, 3), BoardPiece(5, 3), 1
                        RestoreCenter 2
                    End If
                    If BoardPiece(2, 3) = 1 Or BoardPiece(2, 3) = 2 Then
                        If Solution = 0 Then If BoardPiece(2, 3) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(2, 3), BoardY(2, 3): DrawPiece 368, 368, BoardPiece(2, 3), 1: BoardPiece(2, 3) = 0
                        RestoreCenter 1: If BoardPiece(2, 3) = 1 Then Sleep 1: Paint (368, 368), 19: Sleep 1
                    End If
                    If (BoardPiece(1, 3) = 1 Or BoardPiece(1, 3) = 2) And BoardPiece(2, 3) = 0 Then
                        If Solution = 0 Then If BoardPiece(1, 3) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(1, 3), BoardY(1, 3): DrawPiece 368, 368, BoardPiece(1, 3), 1: BoardPiece(1, 3) = 0
                        If BoardPiece(1, 3) = 1 Then Sleep 1: Paint (368, 368), 19
                    End If

                    If Ended = 1 Then ShiftPieces = 2
                    If Pieces = GreenPieces(Card) Then ShiftPieces = 1

                Else
                    For Y = 4 To 1 Step -1
                        If BoardPiece(Y, Z) = 1 Or BoardPiece(Y, Z) = 2 Then
                            Spaces = 0
                            Check2:
                            If Y + Spaces + 1 <= 5 Then If BoardPiece(Y + Spaces + 1, Z) = 0 Then Spaces = Spaces + 1: GoTo Check2
                            If Spaces > 0 Then
                                BoardPiece(Y + Spaces, Z) = BoardPiece(Y, Z): BoardPiece(Y, Z) = 0
                                RemovePiece BoardX(Y, Z), BoardY(Y, Z): DrawPiece BoardX(Y + Spaces, Z), BoardY(Y + Spaces, Z), BoardPiece(Y + Spaces, Z), 1
                                If Z = 2 And Y = 3 Then RestoreCenter 3
                                If Z = 4 And Y = 3 Then RestoreCenter 4
                            End If
                        End If
                    Next
                End If
            Next

        Case 3: ' Left
            For Z = 1 To 5
                If Z = 3 Then
                    If (BoardPiece(3, 2) = 1 Or BoardPiece(3, 2) = 2) And BoardPiece(3, 1) = 0 Then
                        BoardPiece(3, 1) = BoardPiece(3, 2): BoardPiece(3, 2) = 0
                        RemovePiece BoardX(3, 2), BoardY(3, 2): DrawPiece BoardX(3, 1), BoardY(3, 1), BoardPiece(3, 1), 1
                        RestoreCenter 3
                    End If
                    If BoardPiece(3, 4) = 1 Or BoardPiece(3, 4) = 2 Then
                        If Solution = 0 Then If BoardPiece(3, 4) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(3, 4), BoardY(3, 4): DrawPiece 368, 368, BoardPiece(3, 4), 1: BoardPiece(3, 4) = 0
                        RestoreCenter 4: If BoardPiece(3, 4) = 1 Then Sleep 1: Paint (368, 368), 19: Sleep 1
                    End If
                    If (BoardPiece(3, 5) = 1 Or BoardPiece(3, 5) = 2) And BoardPiece(3, 4) = 0 Then
                        If Solution = 0 Then If BoardPiece(3, 5) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(3, 5), BoardY(3, 5): DrawPiece 368, 368, BoardPiece(3, 5), 1: BoardPiece(3, 5) = 0
                        If BoardPiece(3, 5) = 1 Then Sleep 1: Paint (368, 368), 19
                    End If

                    If Ended = 1 Then ShiftPieces = 2
                    If Pieces = GreenPieces(Card) Then ShiftPieces = 1

                Else
                    For Y = 2 To 5
                        If BoardPiece(Z, Y) = 1 Or BoardPiece(Z, Y) = 2 Then
                            Spaces = 0
                            Check3:
                            If Y - Spaces - 1 >= 1 Then If BoardPiece(Z, Y - Spaces - 1) = 0 Then Spaces = Spaces + 1: GoTo Check3
                            If Spaces > 0 Then
                                BoardPiece(Z, Y - Spaces) = BoardPiece(Z, Y): BoardPiece(Z, Y) = 0
                                RemovePiece BoardX(Z, Y), BoardY(Z, Y): DrawPiece BoardX(Z, Y - Spaces), BoardY(Z, Y - Spaces), BoardPiece(Z, Y - Spaces), 1
                                If Z = 2 And Y = 3 Then RestoreCenter 1
                                If Z = 4 And Y = 3 Then RestoreCenter 2
                            End If
                        End If
                    Next
                End If
            Next

        Case 4: ' Right
            For Z = 1 To 5
                If Z = 3 Then
                    If (BoardPiece(3, 4) = 1 Or BoardPiece(3, 4) = 2) And BoardPiece(3, 5) = 0 Then
                        BoardPiece(3, 5) = BoardPiece(3, 4): BoardPiece(3, 4) = 0
                        RemovePiece BoardX(3, 4), BoardY(3, 4): DrawPiece BoardX(3, 5), BoardY(3, 5), BoardPiece(3, 5), 1
                        RestoreCenter 4
                    End If
                    If BoardPiece(3, 2) = 1 Or BoardPiece(3, 2) = 2 Then
                        If Solution = 0 Then If BoardPiece(3, 2) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(3, 2), BoardY(3, 2): DrawPiece 368, 368, BoardPiece(3, 2), 1: BoardPiece(3, 2) = 0
                        RestoreCenter 3: If BoardPiece(3, 2) = 1 Then Sleep 1: Paint (368, 368), 19: Sleep 1
                    End If
                    If (BoardPiece(3, 1) = 1 Or BoardPiece(3, 1) = 2) And BoardPiece(3, 2) = 0 Then
                        If Solution = 0 Then If BoardPiece(3, 1) = 2 Then Ended = 1 Else Pieces = Pieces + 1
                        RemovePiece BoardX(3, 1), BoardY(3, 1): DrawPiece 368, 368, BoardPiece(3, 1), 1: BoardPiece(3, 1) = 0
                        If BoardPiece(3, 1) = 1 Then Sleep 1: Paint (368, 368), 19
                    End If

                    If Ended = 1 Then ShiftPieces = 2
                    If Pieces = GreenPieces(Card) Then ShiftPieces = 1

                Else
                    For Y = 4 To 1 Step -1
                        If BoardPiece(Z, Y) = 1 Or BoardPiece(Z, Y) = 2 Then
                            Spaces = 0
                            Check4:
                            If Y + Spaces + 1 <= 5 Then If BoardPiece(Z, Y + Spaces + 1) = 0 Then Spaces = Spaces + 1: GoTo Check4
                            If Spaces > 0 Then
                                BoardPiece(Z, Y + Spaces) = BoardPiece(Z, Y): BoardPiece(Z, Y) = 0
                                RemovePiece BoardX(Z, Y), BoardY(Z, Y): DrawPiece BoardX(Z, Y + Spaces), BoardY(Z, Y + Spaces), BoardPiece(Z, Y + Spaces), 1
                                If Z = 2 And Y = 3 Then RestoreCenter 1
                                If Z = 4 And Y = 3 Then RestoreCenter 2
                            End If
                        End If
                    Next
                End If
            Next

    End Select

End Function

Sub RestoreCenter (Position)

    Select Case Position
        Case 1: Circle (368, 368), 63, 19, 1, 2: Paint (368, 308), 19
        Case 2: Circle (368, 368), 63, 19, 4, 5.5: Paint (368, 428), 19
        Case 3: Circle (368, 368), 63, 19, 2.2, 3.8: Paint (308, 368), 19
        Case 4: Circle (368, 368), 63, 19, 5.5, .5: Paint (428, 368), 19
    End Select

End Sub

Function CompletedMaze (Ended)

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    font& = _LoadFont(BoldFont$, 25): _Font font&: Color 15, 3

    If Ended = 1 Then _UPrintString (860, 680), "You have Completed this Maze!"
    If Ended = 2 Then _UPrintString (885, 680), "You have FAILED this Maze!"

    _UPrintString (855, 710), Space$(300): _UPrintString (825, 710), "Would You Like to Play a Maze? Y or N"

    YorN: A$ = UCase$(InKey$): If A$ = "" Then GoTo YorN
    If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
    If A$ = "Y" GoTo EndSub
    If A$ = "N" Then System
    GoTo YorN

    EndSub: CompletedMaze = 1: If Ended = 1 Then Card = Card + 1

    _UPrintString (860, 680), Space$(300): _UPrintString (82, 713), Space$(300)
    Line (5, 5)-(781, 781), 3, BF: Line (755, 390)-(1295, 660), 3, BF

End Function

Function EndMaze

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&
    _UPrintString (855, 685), Space$(250): _UPrintString (855, 710), Space$(300)
    _UPrintString (910, 710), "End this Maze?  Y or N"

    YorN: A$ = UCase$(InKey$): If A$ = "" Then GoTo YorN
    If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
    If A$ = "Y" Then EndMaze = 1: GoTo EndSub
    If A$ = "N" Then EndMaze = 0: GoTo EndSub
    GoTo YorN

    EndSub: Color 15, 3: _UPrintString (855, 710), Space$(250)

End Function

Sub Message

    BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"

    Color 15, 3: font& = _LoadFont(BoldFont$, 25): _Font font&
    _UPrintString (890, 685), "Your Maze has been Saved"
    _UPrintString (890, 710), "Press <ENTER> to Continee"

    Enter2: A$ = InKey$: If A$ = "" GoTo Enter2 Else If Asc(A$) <> 13 GoTo Enter2

    _UPrintString (890, 685), Space$(300): _UPrintString (890, 710), Space$(300)

End Sub
Reply
#2
Thanks, luv these puzzle apps., looks like you have it well documented. Video was very helpful.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
Looks great!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Turnstile Maze Game Donald Foster 3 531 10-14-2025, 02:53 PM
Last Post: a740g

Forum Jump:


Users browsing this thread: 1 Guest(s)