10-12-2025, 10:15 PM
Hello All,
Turnstile is a single player maze game. The game consist of a game board, 4 colored pieces (blue, purple, green, orange) and gray pieces, turnstiles of 5 different shapes and 40 challenge cards.
The object of the game is to move the colored pieces to their matching corners. The gray pieces are to help position the turnstiles. The turnstiles are pushed (rotated) by moving pieces through them.
At the start of the game, the player chooses a challenge card and the pieces and the turnstiles are placed on to the game board in their starting positions.
Pieces are moves by selecting a pieces (a white dot will appear on the piece), then chooses an empty adjacent space (a black dot will appear in all empty board spaces that the piece can move to). licking on the pieces already selected, that pieces will become unselected and the dots will be removed. if the is a turnstile between the two spaces, the turnstile will be rotated according to the positions of the turnstiles and the direction the piece is moving.
if you need help with a challenge, on the back side of each challenge card is the solution. Press the <Solution> button to reveal the solution. Pressing the <Animate Solution> button will show the pieces moving through the maze and the turnstiles changing positions.
Pressing <ESC> will alternate between Window and Full Screen modes.
Hope you enjoy playing. Donald
https://youtu.be/0QW0V6e0f-c
https://youtu.be/71g_OHCqr9Y
Turnstile is a single player maze game. The game consist of a game board, 4 colored pieces (blue, purple, green, orange) and gray pieces, turnstiles of 5 different shapes and 40 challenge cards.
The object of the game is to move the colored pieces to their matching corners. The gray pieces are to help position the turnstiles. The turnstiles are pushed (rotated) by moving pieces through them.
At the start of the game, the player chooses a challenge card and the pieces and the turnstiles are placed on to the game board in their starting positions.
Pieces are moves by selecting a pieces (a white dot will appear on the piece), then chooses an empty adjacent space (a black dot will appear in all empty board spaces that the piece can move to). licking on the pieces already selected, that pieces will become unselected and the dots will be removed. if the is a turnstile between the two spaces, the turnstile will be rotated according to the positions of the turnstiles and the direction the piece is moving.
if you need help with a challenge, on the back side of each challenge card is the solution. Press the <Solution> button to reveal the solution. Pressing the <Animate Solution> button will show the pieces moving through the maze and the turnstiles changing positions.
Pressing <ESC> will alternate between Window and Full Screen modes.
Hope you enjoy playing. Donald
https://youtu.be/0QW0V6e0f-c
https://youtu.be/71g_OHCqr9Y
Code: (Select All)
_Title "Turnstile Maze Game"
Screen _NewImage(1324, 736, 256)
_PaletteColor 1, _RGB32(0, 110, 161) ' Blue Piece
_PaletteColor 2, _RGB32(98, 0, 75) ' Purple Piece
_PaletteColor 3, _RGB32(10, 165, 10) ' Green Piece
_PaletteColor 4, _RGB32(222, 89, 6) ' Orange Piece
_PaletteColor 5, _RGB32(50)
_PaletteColor 6, _RGB32(75)
_PaletteColor 7, _RGB32(100)
_PaletteColor 8, _RGB32(125)
_PaletteColor 9, _RGB32(150)
_PaletteColor 10, _RGB32(175)
_PaletteColor 11, _RGB32(200)
_PaletteColor 12, _RGB32(225)
_PaletteColor 13, _RGB32(1)
_PaletteColor 16, _RGB32(0, 125, 0) ' Level 1 Color
_PaletteColor 17, _RGB32(255, 175, 0) ' Level 2 Color
_PaletteColor 18, _RGB32(0, 40, 205) ' Level 3 Color
_PaletteColor 19, _RGB32(186, 0, 0) ' Level 4 Color
Dim As _Unsigned _Bit Selected
Dim As _Byte Y, Z, Turnstile, Rotation, Position, Space
Dim Shared As _Byte Moves, Card, Rotations(5), PieceColor(5), BoardPiece(9), Turnstile(4), Rotation(4), BoardShadow(8)
Dim Shared As _Byte Playable(9), Position(9), Rotate(9), CardPiece(40, 9), CardTurnstile(40, 4), CardRotation(40, 4)
Dim Shared As _Byte PieceInPlay(4), SolutionLines(40), Offset(40, 6), PiecesInPlay
Dim Shared As Integer BoardX(9), BoardY(9), TurnstileX(4), TurnstileY(4)
Dim Shared As String Turnstile1, Turnstile2, ArrowCursor, CardArrowCursor, SolutionCard(40, 8)
PieceColor(1) = 1: PieceColor(2) = 2: PieceColor(3) = 3: PieceColor(4) = 4: PieceColor(5) = 6
Rotations(1) = 4: Rotations(2) = 2: Rotations(3) = 4: Rotations(4) = 4: Rotations(5) = 1
Turnstile1 = "H20U120E10R20F10D120G20BU5P8,8BD5C5H10U140R20D140G10BU5P5,5"
Turnstile2 = "H4U32E3R3F3D32G4BU5P0,0"
ArrowCursor = "TA0R24D24L24U24H1R26D26L26U26"
CardArrowCursor = "TA0R140D140L140U140H1R142D142L142U142"
' Board Shadow Color Setup
Data 0,5,6,7,8,9,10,11
For Z = 1 To 8: Read BoardShadow(Z): Next
' Setup Challenge Cards
Data 0,0,3,5,0,0,0,0,5,1,3,1,2,2,2,1,1: ' Card 1
Data 0,0,0,0,0,4,0,0,0,3,2,1,3,1,2,3,2: ' Card 2
Data 0,0,1,2,0,0,0,0,0,1,2,3,1,1,1,1,1: ' card 3
Data 0,5,5,0,0,1,0,0,0,1,3,5,1,1,2,1,2: ' Card 4
Data 0,0,0,0,3,0,0,1,0,2,2,4,2,3,4,2,2: ' Card 5
Data 0,5,0,0,0,3,5,0,2,1,3,1,4,3,2,1,1: ' Card 6
Data 5,5,3,0,0,0,0,0,0,5,1,1,2,1,3,2,2: ' Card 7
Data 0,5,0,0,5,0,5,0,1,1,3,4,2,4,3,1,2: ' Card 8
Data 5,5,5,2,0,0,5,0,0,1,4,4,3,3,4,1,4: ' Card 9
Data 0,0,5,0,0,4,5,1,5,1,2,1,3,3,4,3,3: ' cARD 10
Data 0,0,5,4,5,3,0,0,5,4,3,1,3,1,3,3,3: ' card 11
Data 0,5,0,0,5,0,2,0,5,2,2,3,2,3,4,2,2: ' Card 12
Data 0,4,5,5,0,5,0,0,0,1,1,2,2,5,1,3,1: ' Card 13
Data 0,3,5,5,0,0,2,0,0,2,1,1,4,3,2,1,1: ' Card 14
Data 0,0,5,0,0,0,0,4,1,3,3,3,4,1,2,1,1: ' Card 15
Data 3,0,4,0,0,0,1,0,2,5,1,1,3,1,4,2,2: ' Card 16
Data 0,5,3,0,0,5,0,5,0,4,4,3,4,1,2,2,1: ' Card 17
Data 5,1,0,0,0,5,2,0,0,1,4,3,3,3,3,2,2: ' Card 18
Data 1,0,0,0,0,0,0,0,3,3,3,1,3,2,2,3,2: ' Card 19
Data 0,0,5,5,0,5,2,0,1,1,2,1,1,2,1,2,1: ' Card 20
Data 0,0,0,0,0,4,2,1,3,3,1,1,3,1,4,2,2: ' Card 21
Data 5,5,0,4,0,0,5,5,0,3,4,4,1,2,1,3,4: ' Card 22
Data 0,2,1,3,0,0,4,5,5,1,3,1,2,1,4,4,1: ' Card 23
Data 0,2,0,0,0,0,0,0,3,3,4,5,1,4,4,3,3: ' Card 24
Data 0,0,4,0,0,3,5,5,1,1,2,1,2,5,1,1,1: ' Card 25
Data 0,0,0,3,0,0,4,1,0,1,3,4,4,2,2,3,2: ' Card 26
Data 0,2,5,0,0,0,0,0,0,3,1,4,2,1,1,2,2: ' Card 27
Data 5,0,0,5,5,0,5,0,1,1,1,4,1,4,2,1,1: ' Card 28
Data 5,5,3,0,5,2,0,5,0,1,4,2,1,4,4,1,3: ' Card 29
Data 0,3,5,0,0,5,0,0,0,4,1,1,2,5,1,1,1: ' Card 30
Data 5,3,5,4,5,0,0,0,0,3,4,4,1,2,1,3,2: ' Card 31
Data 0,2,3,5,0,0,5,5,1,5,1,1,2,1,2,1,1: ' Card 32
Data 0,0,3,0,0,0,5,1,0,4,1,3,2,4,4,3,2: ' Card 33
Data 0,2,1,0,4,3,0,0,5,2,2,1,2,1,3,5,1: ' Card 34
Data 4,5,0,0,5,0,5,0,5,2,1,3,1,3,2,2,1: ' Card 35
Data 0,1,0,4,0,5,5,0,2,2,1,2,2,3,2,1,1: ' Card 36
Data 3,0,0,0,0,1,4,2,5,4,2,1,1,1,4,4,1: ' Card 37
Data 0,5,0,0,0,3,2,5,5,4,1,1,1,1,4,5,1: ' Card 38
Data 5,3,1,0,5,2,4,0,0,1,4,4,3,4,4,1,3: ' Card 39
Data 4,5,5,0,5,1,0,5,0,3,4,5,1,3,2,1,2: ' Card 40
For Z = 1 To 40: For Y = 1 To 9: Read CardPiece(Z, Y): Next: For Y = 1 To 4: Read CardTurnstile(Z, Y), CardRotation(Z, Y): Next: Next
' Setup SolutionLines
Data 1,1,2,3,2,3,3,3,4,4,3,3,3,5,3,5,4,4,4,5,5,4,5,3,6,5,4,5,4,5,3,6,4,5,5,6,6,6,5,6
For Z = 1 To 40: Read SolutionLines(Z): Next
' Setup Offset
Data 19,0,45,48,47,56,44,14,0,35,45,19,22,10,19,10,38,60,13,42,13,56,30,23,23,19,38,10,35,23,23,60,38,23,38,60,42,0,13,19: ' Cards 1 - 14
Data 32,28,19,44,19,47,23,56,38,14,23,42,38,19,38,47,28,56,47,47,32,23,38,38,32,0,38,56,42,19,32,23,13,23,10,38,23,47,23: ' Cards 15 - 23
Data 60,19,32,13,35,10,10,38,70,0,23,38,5,70,19,19,56,60,19,0,23,10,23,23,23,38,60,28,19,19,35,47,0,9,0,13,13,13,0,13,23: ' Cards 24 - 32
Data 23,38,23,60,35,10,0,0,23,9,23,0,23,47,23,0,0,13,13,60,0,13,0,0,35,60,38,0,13,13,9,23,0,13,13,13,0,23,0,13,0,13,0: ' Cards 33 - 40
For Z = 1 To 40: For Y = 1 To SolutionLines(Z): Read Offset(Z, Y): Next: Next
' Setbup Solution Cards
Data "E4-1 C3-2-5-4-7": ' Card 1
Data "D6-3-2-5-8-5-6-9": ' Card 2
Data "B4-5-2-5-6","A3-2-1 B6-3": ' Card 3
Data "E2-1-4 A6-9","E3-6-5-8","A9-6-3-2-1": ' Card 4
Data "C5-4-5-2-5-6-9","A8-5 C9-8 A5-2-1 C8-7": ' Carde 5
Data "E7-4-1 B9-8-7","C6-9-8-5-4","B7-8-9-6-3 C4-7": ' Card 6
Data "C3-6 E2-3 E1-4-7","E3-2-5 C6-3 E5-6-9","E7-8 C3-2-5-4-7": ' Card 7
Data "E5-4-1 E7-4 A9-8-5","E4-7 A5-4 E2-5","E1-2 A4-1": ' Card 8
Data "E7-8 B4-7 E1-4 E2-1","E3-6-5-6-9","E8-5 B7-8 E4-7 E5-4","B8-5-6-3": ' Card 9
Data "E3-2-1-4 D6-3","E9-6 A8-9 E4-5-2","E6-5-4 D3-6 E2-3","A9-8-5-2-1 D6-9": ' Card 10
Data "E3-2 D4-7 E5-4","C6-5 E9-6-3 C5-8-5","D7-8-9 C5-8-7": ' Card 11
Data "E5-6 E9-8-5 B7-8","E5-4 E6-9 B8-5-6","R2-5 B6-3": ' Card 12
Data "D2-1 E6-9 E3-6","D1-2-5 E4-1 D5-8","E6-5 E9-6 D8-9": ' Card 13
Data "E4-1 B7-4","E3-6-9-8-7","C2-3-6-9-8-5-2-5","E7-8 B4-7 C5-4 E8-5","B7-8-9-6-3 C4-7": ' Card 14
Data "E3-6 D8-7-4-1","A9-8-5-2-5-4","D1-2-5-8-9 A4-1": ' Card 15
Data "A7-8 C1-4-7","D3-2-5-6-5 C7-4","A8-7 B9-6-3","D5-6-9 A7-8 C4-7","A8-5-2-1": ' Card 16
Data "E6-9 C3-6 E2-3","E8-7-4-5-8-5-4","E3-2 C6-3 E9-8-5","C3-6-9-8-7": ' Card 17
Data "A2-3 E6-5 A3-6","E1-2-3 E7-4-1-2","E5-4 A6-5 E3-6","2-3 A5-2-1": ' Card 18
Data "A1-4-5-6-5-8","C9-6-5-2","A8-5-4 C2-5","A4-1 C5-4-7": ' Card 19
Data "E4-1 B7-4-5-2","E1-4-7 B2-5 E3-2","E6-3 A9-8 B5-6","E2-5 E3-2 B6-3","E5-6 A8-5-4-1": ' Card 20
Data "D6-3-2-5-6-5-2-1","B7-4 A8-7 C9-6","B4-5-2-3","D1-4-5-8-9","A7-4-1 C6-5-4-7": ' Card 21
Data "E8-5-6-5 E2-3","E1-2 D4-1 E5-4-5","D1-4 E2-1 E3-2 E5-6","D4-5-8 E6-5 D8-9": ' Card 22
Data "B2-5 A3-2-1 B5-2-3","C4-5 D7-4 E8-7","E9-8 C5-6 E8-5-2","D4-5-8 C6-5","D8-9 E7-4 C5-8-7": ' Card 23
Data "B2-5 C9-6","B5-8-7-4 C6-5-8","B4-5-2-3 C8-7": ' Card 24
Data "D3-2 C6-3 A9-6 E8-9","E7-4-1 E9-8-5","A6-9-8 C3-6-9 E5-6","D2-3 A8-5-2 C9-8-7","E1-4 A2-1 E6-5","D3-6-9": ' Card 25
Data "C4-1-2-5-4-5-2-3","A8-9 D7-4-5 A9-8","D5-6 C3-2 D6-3","C2-5-4-7 A8-5-2-1","D3-6-9": ' Card 26
Data "B2-1 E3-6-5-4-5","B1-4-7 E5-4-5-2","B7-4-5-6","E2-5 B6-3": ' Card 27
Data "E5-6-5-2-5 E1-2","E4-1 E7-4 E5-8 E2-5-6","E1-2-5 E4-1 E6-3","5-4 E8-5-6 A9-8-7","E4-5 E1-2 A7-4-1": ' Card 28
Data "E8-9 E5-8-7 E9-8","B6-9 C3-6-5 B9-6","E8-9 C5-8 B6-3","E7-4 C8-7": ' Card 29
Data "E6-9-8-5-6-5","E3-6-9 E5-6-5-8","E9-6-5 C2-3-6-9","E5-6-3 C9-6-5","E8-9 C5-8-7": ' Card 30
Data "D4-7-8 E1-4 C2-1 E3-6","C1-2 E4-1 E5-4-7-4","C2-5 E6-3 D8-9 C5-8-7": ' Card 31
Data "A9-6 E8-9 E7-8 E4-7","B2-5 C3-2 A6-3 B5-6","C2-5 E7-4 E8-7 C5-8","E4-1-2 B6-5 A3-6 E2-3","B5-2 A6-5 E3-6 B2-3","A5-2-1 E7-4 C8-7": ' Card 32
Data "A8-5 E7-8 A5-2-5","C3-2 A5-6 C2-1","A6-5-2 C1-4 A2-1","E8-5 C4-7": ' Card 33
Data "D5-4-7 B2-1-4","A3-2-1 B4-5-2 C6-3","E9-8 C3-6 B2-3 A1-2-1","D7-4 E8-7 C6-9-8 D4-5","E7-4 C8-7 D5-8-9": ' Card 34
Data "E7-4 E5-8-5-6 E2-5","E6-3 E5-8-5 E4-7","D1-4 E3-6 E5-2-1 D4-5","E1-4-1 E7-4 E6-3","9-6 D5-8-9": ' Card 35
Data "D4-1 E7-4 B9-8-7","E6-5-8-9 A2-3-6-3","B7-8 E4-7 D1-2-5 A3-2","E9-6 B8-9 E7-4 D5-8","E6-5 B9-6 D8-9 E5-8","B6-3 A2-1": ' Card 36
Data "C1-4-5 E6-3 D7-4 B8-7","E9-8 C5-6 D4-5 B7-4","E8-7 D5-8 B4-5-2 C6-5","D8-9 A3-6 B2-3 7-4-1","C5-4-7 A6-5-4","E1-2 A4-1": ' Card 37
Data "C6-3 B7-4 E8-7","E9-6-5 E7-8 B4-7 E5-4","E8-5 B7-8 E4-7 E2-1","E5-2 E7-4 B8-5 C3-6","E2-3 B5-2 C6-9-8-7","B2-5-6 E3-2 B6-3": ' Card 38
Data "E5-8-9 D7-8 E1-4 C2-1","A3-2 B6-3 E4-5 C1-4","A2-1 B5-2 D8-5 C4-7","A1-4 E2-1 B3-2 E9-8","D5-6-9 B2-3 E1-2 A4-1": ' Card 39
Data "D1-4-7 E5-4 E8-5","D7-8-9 E4-7 E5-8 E2-1","E7-4 E8-7 D9-8 A6-9","E3-6-5 E1-2 E4-1 E5-4","E2-5 A9-6 D8-9 E5-8","A6-3-2 E4-5 E1-4 A2-1": ' Card 40
For Z = 1 To 40: For Y = 1 To SolutionLines(Z): Read SolutionCard(Z, Y): Next: Next
Cls , 0: Card = 1: DrawBoard: DrawBoardCenter: DrawCard 1
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
BoldItalicsFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibriz.ttf"
Color 15, 0: font& = _LoadFont(BoldItalicsFont$, 30): _Font font&
_UPrintString (780, 10), "T U R N S T I L E"
Color 9, 0: font& = _LoadFont(BoldFont$, 30): _Font font&
_UPrintString (995, 10), "Revolving Maze Game"
GetCard: DisplayCardArrows: ChooseCardButton
Color 15, 0: 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), 0: Draw CardArrowCursor
If _MouseButton(1) = -1 And Selected = 1 Then
GoSub ReleaseButton: If Card = 1 Then Card = 40 Else Card = Card - 1
Line (914, 61)-(1134, 369), 0, BF: DrawCard 1: GoTo ChooseCard
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), 0: Draw CardArrowCursor
If _MouseButton(1) = -1 And Selected = 1 Then
GoSub ReleaseButton: If Card = 40 Then Card = 1 Else Card = Card + 1
Line (914, 61)-(1134, 369), 0, BF: DrawCard 1: GoTo ChooseCard
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), 0, BF: Line (750, 145)-(890, 285), 0, BF: Line (1159, 145)-(1300, 285), 0, BF
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (860, 710), Space$(300)
Color 15, 0: font& = _LoadFont(BoldFont$, 35): _Font font&: _UPrintString (955, 390), "M O V E S": Moves = 0
SetupBoard: UpdateBoard: DrawButtons: DisplayMoves
Piece: Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (890, 710), "Choose a Piece to Move"
ChoosePiece:
Do While _MouseInput
' Board Piece
For Z = 1 To 9
If _MouseX > BoardX(Z) - 70 And _MouseX < BoardX(Z) + 70 And _MouseY > BoardY(Z) - 70 And _MouseY < BoardY(Z) + 70 And _MouseButton(1) = -1 And BoardPiece(Z) > 0 Then
GoSub ReleaseButton: If CheckPiece(Z) = 0 GoTo ChoosePiece Else Position = Z: GoTo EndChoosePiece
End If
Next
' Solution Button
If _MouseX > 758 And _MouseX < 916 And _MouseY > 540 And _MouseY < 582 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (785, 61)-(1265, 369), 0, BF: DrawCard 2: Line (785, 61)-(1265, 369), 0, BF: DrawCard 1: GoTo Piece
End If
' Restart Maze
If _MouseX > 936 And _MouseX < 1104 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: If EndMaze = 0 GoTo Piece Else DrawBoardCenter: SetupBoard: UpdateBoard: Moves = 0: DisplayMoves: GoTo Piece
End If
' New Maze
If _MouseX > 1134 And _MouseX < 1291 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: If EndMaze = 0 GoTo Piece Else Line (754, 388)-(1297, 662), 0, BF: DrawBoardCenter: 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 Piece 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 Piece Else GoTo LoadMaze
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 ChoosePiece
EndChoosePiece:
Playable(Position) = 1: DisplayCursors
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (890, 710), Space$(300)
_UPrintString (880, 710), "Choose Space to Move Piece to"
ChooseSpace:
Do While _MouseInput
' Board Piece
For Z = 1 To 9
If _MouseX > BoardX(Z) - 70 And _MouseX < BoardX(Z) + 70 And _MouseY > BoardY(Z) - 70 And _MouseY < BoardY(Z) + 70 And _MouseButton(1) = -1 And Playable(Z) > 0 Then
GoSub ReleaseButton: If Z = Position Then ClearPlayables: RemoveBoardCursors: _UPrintString (880, 710), Space$(300): GoTo Piece
Space = Z: GoTo EndChooseSpace
End If
Next
' Solution Button
If _MouseX > 758 And _MouseX < 916 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (785, 61)-(1265, 369), 0, BF: DrawCard 2: Line (785, 61)-(1265, 369), 0, BF: DrawCard 1: GoTo Piece
End If
' Restart Maze
If _MouseX > 936 And _MouseX < 1104 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: If EndMaze = 0 GoTo Piece Else DrawBoardCenter: SetupBoard: UpdateBoard: Moves = 0: DisplayMoves: GoTo Piece
End If
' New Maze
If _MouseX > 1134 And _MouseX < 1291 And _MouseY > 520 And _MouseY < 602 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: If EndMaze = 0 GoTo Piece Else Line (754, 388)-(1297, 662), 0, BF: DrawBoardCenter: 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 Piece 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 Piece Else GoTo LoadMaze
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 ChooseSpace
EndChooseSpace:
' Move Piece to New Board Space
BoardPiece(Space) = BoardPiece(Position): BoardPiece(Position) = 0
' Change Rotation of Turnstile
If Position(Space) > 0 Then Rotation(Position(Space)) = Rotate(Space)
DrawBoardCenter: UpdateBoard: Moves = Moves + 1: DisplayMoves
_UPrintString (880, 710), Space$(300)
If CheckCompletedMaze = 1 Then If CompletedMaze = 1 Then Line (754, 388)-(1297, 662), 0, BF: GoTo GetCard
ClearPlayables: GoTo Piece
ReleaseButton:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo ReleaseButton
NoMaze:
Color 15, 0: 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 Piece
LoadMaze:
On Error GoTo NoMaze
Open "TurnstileData" For Input As #1
Input #1, Card, Moves
For Z = 1 To 9: Input #1, BoardPiece(Z): Next
For Z = 1 To 4: Input #1, Turnstile(Z): Next
For Z = 1 To 4: Input #1, Rotation(Z): Next
Close #1
DrawBoardCenter: UpdateBoard: DrawCard 1: DisplayMoves
GoTo Piece
SaveMaze:
Open "TurnstileData" For Output As #1
Write #1, Card, Moves
For Z = 1 To 9: Write #1, BoardPiece(Z): Next
For Z = 1 To 4: Write #1, Turnstile(Z): Next
For Z = 1 To 4: Write #1, Rotation(Z): Next
Close #1
Message
GoTo Piece
Sub DrawBoard
Dim As _Byte X, Z
' Draw Board Outline
Circle (175, 175), 165, 15, 1.5, 3.2: Circle (561, 175), 165, 15, 0, 1.6: Circle (175, 561), 165, 15, 3.1, 4.7: Circle (561, 561), 165, 15, 4.7, 0
Line (10, 175)-(10, 561), 15: Line (175, 10)-(561, 10), 15: Line (726, 175)-(726, 561), 15: Line (160, 726)-(561, 726), 15: Paint (175, 175), 15
' Draw Board Shadow
X = 1
For Z = 1 To 8
Circle (205, 205), 100 + X, BoardShadow(Z), 1.5, 3.2: Circle (531, 205), 100 + X, BoardShadow(Z), 0, 1.6: Circle (205, 531), 100 + X, BoardShadow(Z), 3.1, 4.8: Circle (531, 531), 100 + X, BoardShadow(Z), 4.7, 0
Line (205, 105 - X)-(531, 105 - X), BoardShadow(Z): Line (205, 631 + X)-(531, 631 + X), BoardShadow(Z): Line (105 - X, 205)-(105 - X, 531), BoardShadow(Z): Line (631 + X, 205)-(631 + X, 531), BoardShadow(Z)
X = X + 1
Next
End Sub
Sub DrawBoardCenter
Dim As _Byte W, Y, Z
Dim As Integer V, X
Paint (205, 205), 12, 0
Circle (200, 200), 110, 1, 1.5, 3.2: Circle (200, 200), 155, 1, 1.5, 3.2: PSet (200, 90), 1: Draw "TA0R70U45L70BL155BD155D70R45U70BL5P1,1"
Circle (536, 200), 110, 2, 0, 1.6: Circle (536, 200), 155, 2, 0, 1.6: PSet (536, 90), 2: Draw "TA0L70U45R70BR155BD155D70L45U70BR5P2,2"
Circle (200, 536), 110, 3, 3.1, 4.8: Circle (200, 536), 155, 3, 3.1, 4.8: PSet (200, 646), 3: Draw "TA0R70D45L70BL155BU155U70R45D70BL5P3,3"
Circle (536, 536), 110, 4, 4.7, 0: Circle (536, 536), 155, 4, 4.7, 0: PSet (536, 646), 4: Draw "TA0L70D45R70BR155BU155U70L45D70BR5P4,4"
' Draw Board Space for Turnstile
PSet (278, 141), 7: Draw "TA0R7F8D106F8R136E8U106E8R14F8D106F8R106F8D14G8L106G8D136F8R106F8D14G8L106G8D106G8L14H8U106H8L136G8D106G8L14H8U106H8L106H8U14E8R106E8U136H8L106H8U14E8R106E8U106E8R14"
PSet (301, 293), 7: Draw "R136F8D136G8L136H8U136E8"
' Draw Board Space for Piece
X = 187: W = 1
For Z = 1 To 3
V = 187
For Y = 1 To 3
Circle (V, X), 60, 9: Paint (V, X), 9
BoardX(W) = V: BoardY(W) = X: V = V + 182: W = W + 1
Next
X = X + 182
Next
' Setup Turnstile Board X,Y
X = 278: W = 1
For Z = 1 To 2
V = 278
For Y = 1 To 2
Circle (V, X), 15, 7: Paint (V, X), 7
TurnstileX(W) = V: TurnstileY(W) = X: V = V + 182: W = W + 1
Next
X = X + 182
Next
End Sub
Sub DrawPiece (X, Y, Piece, Size)
If Size = 1 Then
Circle (X, Y), 60, 5: Paint (X, Y), 5: Circle (X, Y), 50, PieceColor(Piece): Paint (X, Y), PieceColor(Piece)
Else
Circle (X, Y), 17, PieceColor(Piece): Paint (X, Y), PieceColor(Piece)
End If
End Sub
Sub DrawTurnstile (X, Y, Turnstile, Direction, Size)
If (Turnstile = 1 And Direction = 1) Or (Turnstile = 2 And Direction = 1) Or (Turnstile = 3 And (Direction = 1 Or Direction = 4)) Or (Turnstile = 4 And Direction <> 3) Or Turnstile = 5 Then
If Size = 1 Then
PSet (X, Y), 8: Draw "TA0" + Turnstile1
Else
PSet (X, Y), 0: Draw "TA0" + Turnstile2
End If
End If
If (Turnstile = 1 And Direction = 2) Or (Turnstile = 2 And Direction = 2) Or (Turnstile = 3 And (Direction = 1 Or Direction = 2)) Or (Turnstile = 4 And Direction <> 4) Or Turnstile = 5 Then
If Size = 1 Then
PSet (X, Y), 8: Draw "TA270" + Turnstile1
Else
PSet (X, Y), 0: Draw "TA270" + Turnstile2
End If
End If
If (Turnstile = 1 And Direction = 3) Or (Turnstile = 2 And Direction = 1) Or (Turnstile = 3 And (Direction = 2 Or Direction = 3)) Or (Turnstile = 4 And Direction <> 1) Or Turnstile = 5 Then
If Size = 1 Then
PSet (X, Y), 8: Draw "TA180" + Turnstile1
Else
PSet (X, Y), 0: Draw "TA180" + Turnstile2
End If
End If
If (Turnstile = 1 And Direction = 4) Or (Turnstile = 2 And Direction = 2) Or (Turnstile = 3 And (Direction = 3 Or Direction = 4)) Or (Turnstile = 4 And Direction <> 2) Or Turnstile = 5 Then
If Size = 1 Then
PSet (X, Y), 8: Draw "TA90" + Turnstile1
Else
PSet (X, Y), 0: Draw "TA90" + Turnstile2
End If
End If
If Size = 1 Then
Circle (X, Y), 26, 6: Paint (X, Y), 6
Else
Circle (X, Y), 8, 13: Paint (X, Y), 13
End If
End Sub
Sub DrawCard (CardType)
Dim As _Byte W, Y, Z, TextColor, Position, LevelColor, Pairs, Pair(30, 2), StorePiece(9), StoreRotation(4)
Dim As Integer V, X, X1
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
BoldItalicsFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibriz.ttf"
If CardType = 1 Then X1 = 914: W = 6 Else If CardType = 2 Then X1 = 785: W = 6 Else X1 = 1045
' Draw Challenge Card Outline and Fill In
Circle (X1 + 20, 81), 20, W, 1.5, 3.2: Circle (X1 + 200, 81), 20, W, 0, 1.6: Circle (X1 + 20, 349), 20, W, 2.9, 4.8: Circle (X1 + 200, 349), 20, W, 4.7, 0
Line (X1, 81)-(X1, 349), W: Line (X1 + 220, 81)-(X1 + 220, 349), W: Line (X1 + 20, 61)-(X1 + 200, 61), W: Line (X1 + 20, 369)-(X1 + 200, 369), W: Paint (X1 + 20, 81), W
font& = _LoadFont(BoldItalicsFont$, 51): _Font font&
Color 15, W: _UPrintString (X1 + 18, 65), "Turnstile"
Circle (X1 + 32, 133), 20, 15, 1.5, 3.2: Circle (X1 + 188, 133), 20, 15, 0, 1.6: Circle (X1 + 32, 289), 20, 15, 2.9, 4.8: Circle (X1 + 188, 289), 20, 15, 4.7, 0
Line (X1 + 12, 133)-(X1 + 12, 289), 15: Line (X1 + 208, 133)-(X1 + 208, 289), 15: Line (X1 + 32, 113)-(X1 + 188, 113), 15: Line (X1 + 32, 309)-(X1 + 188, 309), 15: Paint (X1 + 32, 138), 15
Circle (X1 + 47, 148), 17, 1, 1.5, 3.2: Circle (X1 + 46, 147), 28, 1, 1.5, 3.2: PSet (X1 + 47, 131), 1: Draw "TA0R35U12L35BL29BD29D30R12U35BL2P1,1"
Circle (X1 + 173, 148), 17, 2, 0, 1.6: Circle (X1 + 174, 147), 28, 2, 0, 1.6: PSet (X1 + 173, 131), 2: Draw "TA0L35U12R35BR29BD29D35L12U35BR2P2,2"
Circle (X1 + 47, 274), 17, 3, 2.9, 4.8: Circle (X1 + 46, 275), 28, 3, 2.9, 4.8: PSet (X1 + 47, 291), 3: Draw "TA0R35D12L35BL29BU29U30R12D35BL2P3,3"
Circle (X1 + 173, 274), 17, 4, 4.7, 0: Circle (X1 + 174, 275), 28, 4, 4.7, 0: PSet (X1 + 173, 291), 4: Draw "TA0L35D12R35BR29BU29U30L12D35BR2P4,4"
' Draw Pieces
X = 157: Position = 1
For Z = 1 To 3
V = X1 + 55
For Y = 1 To 3
Circle (V, X), 20, 10: If CardPiece(Card, Position) > 0 Then DrawPiece V, X, CardPiece(Card, Position), 2
V = V + 55: Position = Position + 1
Next
X = X + 55
Next
' Draw Turnstiles
X = 184: Position = 1
For Z = 1 To 2
V = X1 + 83
For Y = 1 To 2
If CardTurnstile(Card, Position) > 0 Then DrawTurnstile V, X, CardTurnstile(Card, Position), CardRotation(Card, Position), 2
V = V + 55: Position = Position + 1
Next
X = X + 55
Next
' Setup Level Color
If Card < 11 Then LevelColor = 3: Color 15, 14
If Card > 10 And Card < 21 Then LevelColor = 17
If Card > 20 And Card < 31 Then LevelColor = 18
If Card > 30 Then LevelColor = 19: Color 15, 17
Circle (X1 + 110, 340), 20, LevelColor: Paint (X1 + 110, 340), LevelColor
Color 15, LevelColor: If Card > 9 Then X = 0 Else X = 9
font& = _LoadFont(BoldFont$, 29): _Font font&
_UPrintString (X1 + 96 + X, 327), LTrim$(Str$(Card))
PSet (X1 + 95, 331), LevelColor: Draw "TA0L77G6D6F6R77BR32R77E6U6H6L77"
Paint (X1 + 80, 340), LevelColor: Paint (X1 + 140, 340), LevelColor
font& = _LoadFont(BoldFont$, 12): _Font font&
If Card < 11 Then _UPrintString (X1 + 135, 336), "BEGINNER"
If Card > 10 And Card < 21 Then _UPrintString (X1 + 130, 336), "INTERMEDIATE"
If Card > 20 And Card < 31 Then _UPrintString (X1 + 137, 336), "ADVANCED"
If Card > 30 Then _UPrintString (X1 + 147, 336), "EXPERT"
' Solution Card
If CardType = 2 Then
' Add Position Numbers to Challenge Card
font& = _LoadFont(BoldFont$, 28): _Font font&
X = 157: Position = 1
For Z = 1 To 3
V = X1 + 55
For Y = 1 To 3
If CardPiece(Card, Position) > 0 Then Color 15, PieceColor(CardPiece(Card, Position)) Else Color 0, 15
_UPrintString (V - 7, X - 12), LTrim$(Str$(Position))
V = V + 55: Position = Position + 1
Next
X = X + 55
Next
'Draw Solution Card outline and Fill In
Circle (1065, 81), 20, 15, 1.5, 3.2: Circle (1245, 81), 20, 15, 0, 1.6: Circle (1065, 349), 20, 15, 2.9, 4.8: Circle (1245, 349), 20, 15, 4.7, 0
Line (1045, 81)-(1045, 349), 15: Line (1265, 81)-(1265, 349), 15: Line (1065, 61)-(1245, 61), 15: Line (1065, 369)-(1245, 369), 15: Paint (1065, 81), 15
Circle (1155, 95), 20, LevelColor: Paint (1155, 95), LevelColor
Color 15, LevelColor: font& = _LoadFont(BoldFont$, 27): _Font font&
If Card < 10 Then X = 1150 Else X = 1141
_UPrintString (X, 84), LTrim$(Str$(Card))
font& = _LoadFont(BoldFont$, 24): _Font font&
X = 137
For Z = 1 To SolutionLines(Card)
Position = 1: V = 1059 + Offset(Card, Z)
For Y = 1 To Len(SolutionCard(Card, Z))
If Asc(Mid$(SolutionCard(Card, Z), Position, 1)) = 32 Then V = V + 6: GoTo EndLoop
If Asc(Mid$(SolutionCard(Card, Z), Position, 1)) > 64 Then TextColor = Asc(Mid$(SolutionCard(Card, Z), Position, 1)) - 64: GoTo EndLoop
If Mid$(SolutionCard(Card, Z), Position, 1) = "-" Then
PSet (V + 7, X), TextColor: Draw "TA0G8U5L6U6R6U5F8": Paint (V, X), TextColor: V = V + 15
Else
Color TextColor, 15: _UPrintString (V - 7, X - 9), Mid$(SolutionCard(Card, Z), Position, 1): V = V + 13
End If
EndLoop: Position = Position + 1
Next
If Z < SolutionLines(Card) Then Line (1065, X + 20)-(1245, X + 21), 8, BF
X = X + 41
Next
Line (754, 388)-(1297, 662), 0, BF: AnimateButton
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (855, 710), Space$(300)
_UPrintString (890, 710), "Press <ENTER> to Continue"
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), 0, BF: DrawButtons: ' DrawBoard
Color 15, 0: font& = _LoadFont(BoldFont$, 35): _Font font&
_UPrintString (955, 390), "M O V E S": DisplayMoves
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&
_UPrintString (855, 710), Space$(300): GoTo EndSub
End If
End If
GoTo SolutionButton
ReleaseButton:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo ReleaseButton
Animate:
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&
_UPrintString (855, 710), Space$(300): _UPrintString (890, 710), Space$(300)
' Get Solution Pairs
Pairs = 0
For Z = 1 To SolutionLines(Card)
For Y = 1 To Len(SolutionCard(Card, Z))
If Mid$(SolutionCard(Card, Z), Y, 1) = "-" Then
Pairs = Pairs + 1
Pair(Pairs, 1) = Val(Mid$(SolutionCard(Card, Z), Y - 1, 1))
Pair(Pairs, 2) = Val(Mid$(SolutionCard(Card, Z), Y + 1, 1))
End If
Next
Next
' Store Current Board Positions
For Z = 1 To 9
StorePiece(Z) = BoardPiece(Z)
Next
For Z = 1 To 4
StoreRotation(Z) = Rotation(Z)
Next
' SEt Board To Starting Positions
For Z = 1 To 9
BoardPiece(Z) = CardPiece(Card, Z)
Next
For Z = 1 To 4
Rotation(Z) = CardRotation(Card, Z)
Next
DrawBoardCenter: UpdateBoard
' Animate Solution
For Z = 1 To Pairs
X = CheckPiece(Pair(Z, 1)): ClearPlayables: Playable(Pair(Z, 1)) = 1: Playable(Pair(Z, 2)) = 1: DisplayCursors
Sleep 1: BoardPiece(Pair(Z, 2)) = BoardPiece(Pair(Z, 1)): BoardPiece(Pair(Z, 1)) = 0
Rotation(Position(Pair(Z, 2))) = Rotate(Pair(Z, 2)): DrawBoardCenter: UpdateBoard: Sleep 1
Next
' Restore Current Positions
For Z = 1 To 9
BoardPiece(Z) = StorePiece(Z)
Next
For Z = 1 To 4
Rotation(Z) = StoreRotation(Z)
Next
DrawBoardCenter: UpdateBoard: Sleep 1
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: _UPrintString (855, 710), Space$(300)
_UPrintString (890, 710), "Press <ENTER> to Continue": GoTo SolutionButton
End If
EndSub:
End Sub
Sub DrawButtons
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
font& = _LoadFont(BoldFont$, 30): _Font font&
' SolUTION Button
Circle (779, 561), 21, 15, 1.4, 4.8: Circle (895, 561), 21, 15, 4.4, 1.6: Line (779, 540)-(895, 540), 15: Line (779, 582)-(895, 582), 15: Paint (779, 561), 15
Color 0, 15: _UPrintString (784, 548), "Solution"
' Restart Puzzle
Circle (957, 561), 21, 5, 1.4, 4.8: Circle (1083, 561), 21, 5, 4.4, 1.6: Line (957, 540)-(1083, 540), 5: Line (957, 582)-(1083, 582), 5: Paint (957, 561), 5
Color 15, 5: _UPrintString (974, 548), "Restart"
' New Puzzle
Circle (1155, 561), 21, 5, 1.4, 4.8: Circle (1271, 561), 21, 5, 4.4, 1.6: Line (1155, 540)-(1271, 540), 5: Line (1155, 582)-(1271, 582), 5: Paint (1155, 561), 5
Color 15, 5: _UPrintString (1182, 548), "New"
' Exit Puzzle
Circle (779, 634), 21, 5, 1.4, 4.8: Circle (895, 634), 21, 5, 4.4, 1.6: Line (779, 613)-(895, 613), 5: Line (779, 655)-(895, 655), 5: Paint (779, 634), 5
Color 15, 5: _UPrintString (811, 621), "Exit"
' Load Puzzle
Circle (967, 634), 21, 5, 1.4, 4.8: Circle (1083, 634), 21, 5, 4.4, 1.6: Line (967, 613)-(1083, 613), 5: Line (967, 655)-(1083, 655), 5: Paint (967, 634), 5
Color 15, 5: _UPrintString (996, 621), "Load"
' Save Puzzle
Circle (1155, 634), 21, 5, 1.4, 4.8: Circle (1271, 634), 21, 5, 4.4, 1.6: Line (1155, 613)-(1271, 613), 5: Line (1155, 655)-(1271, 655), 5: Paint (1155, 634), 5
Color 15, 5: _UPrintString (1187, 621), "Save"
End Sub
Sub DrawBoardCursor (Position)
Dim As _Byte CursorColor
If BoardPiece(Position) = 0 Then CursorColor = 5 Else CursorColor = 15
Circle (BoardX(Position), BoardY(Position)), 20, CursorColor: Paint (BoardX(Position), BoardY(Position)), CursorColor
End Sub
Sub RemoveBoardCursors
Dim As _Byte Z, CursorColor
For Z = 1 To 9
If BoardPiece(Z) = 0 Then CursorColor = 9 Else CursorColor = PieceColor(BoardPiece(Z))
Circle (BoardX(Z), BoardY(Z)), 20, CursorColor: Paint (BoardX(Z), BoardY(Z)), CursorColor
Next
End Sub
Sub ClearPlayables
Dim As _Byte Z
For Z = 1 To 9: Playable(Z) = 0: Next
End Sub
Sub DisplayCursors
Dim As _Byte Z
For Z = 1 To 9
If Playable(Z) > 0 Then DrawBoardCursor Z
Next
End Sub
Sub DisplayMoves
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
If Moves < 10 Then X = 995 Else X = 960
Color 8, 0: font& = _LoadFont(BoldFont$, 120): _Font font&:
_UPrintString (960, 420), Space$(100): _UPrintString (X, 420), LTrim$(Str$(Moves))
End Sub
Sub SetupBoard
Dim As _Byte Z: PiecesInPlay = 0
For Z = 1 To 9
BoardPiece(Z) = CardPiece(Card, Z)
If BoardPiece(Z) > 0 And BoardPiece(Z) < 5 Then PieceInPlay(BoardPiece(Z)) = 1: PiecesInPlay = PiecesInPlay + 1
Next
For Z = 1 To 4: Turnstile(Z) = CardTurnstile(Card, Z): Rotation(Z) = CardRotation(Card, Z): Next
End Sub
Sub UpdateBoard
Dim As _Byte Z
' Draw Piece
For Z = 1 To 9
If BoardPiece(Z) > 0 Then DrawPiece BoardX(Z), BoardY(Z), BoardPiece(Z), 1
Next
' Draw Turnstile
For Z = 1 To 4
If Turnstile(Z) > 0 Then DrawTurnstile TurnstileX(Z), TurnstileY(Z), Turnstile(Z), Rotation(Z), 1
Next
End Sub
Sub DisplayCardArrows
PSet (775, 215), 9: Draw "TA0E50D25R40D50L40D25H50BR10P9,9"
PSet (1274, 215), 9: Draw "TA0G50U25L40U50R40U25F50BL10P9,9"
End Sub
Sub ChooseCardButton
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
Color 0, 15: font& = _LoadFont(BoldFont$, 30): _Font font&
' Restart Puzzle
Circle (914, 415), 21, 15, 1.4, 4.8: Circle (1134, 415), 21, 15, 4.4, 1.6: Line (914, 394)-(1134, 394), 15: Line (914, 436)-(1134, 436), 15: Paint (914, 415), 15
_UPrintString (919, 403), "Choose This Card"
End Sub
Function CheckPiece (Position)
Dim As _Byte X, Z: X = 0: For Z = 1 To 9: Playable(Z) = 0: Next
Select Case Position
Case 1
' Check Move to Position 2
If BoardPiece(2) = 0 Then
If Point(287, 187) = 12 Then X = 1: Playable(2) = 1: Position(2) = 0
If Turnstile(1) = 1 And Rotation(1) = 1 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 2
If Turnstile(1) = 2 And Rotation(1) = 1 And BoardPiece(4) = 0 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 2
If Turnstile(1) = 3 And Rotation(1) = 1 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 2
If Turnstile(1) = 3 And Rotation(1) = 4 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 2
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 3
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(4) = 0 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(1) = 5 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(2) = 1: Position(2) = 0
End If
' Check Move to Position 4
If BoardPiece(4) = 0 Then
If Point(187, 287) = 12 Then X = 1: Playable(4) = 1: Position(4) = 0
If Turnstile(1) = 1 And Rotation(1) = 4 And Point(287, 187) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 3
If Turnstile(1) = 2 And Rotation(1) = 2 And BoardPiece(2) = 0 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 1
If Turnstile(1) = 3 And Rotation(1) = 3 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 2
If Turnstile(1) = 3 And Rotation(1) = 4 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 3
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(2) = 0 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 4
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 2
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 3
If Turnstile(1) = 5 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(4) = 1: Position(4) = 0
End If
Case 2
' Check Move to Position 1
If BoardPiece(1) = 0 Then
If Point(287, 187) = 12 Then X = 1: Playable(1) = 1: Position(1) = 0
If Turnstile(1) = 1 And Rotation(1) = 1 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 4
If Turnstile(1) = 2 And Rotation(1) = 1 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 2
If Turnstile(1) = 3 And Rotation(1) = 1 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 4
If Turnstile(1) = 3 And Rotation(1) = 4 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 3
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 4
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(5) = 0 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 1
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(4) = 0 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 3
If Turnstile(1) = 5 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(1) = 1: Position(1) = 0
End If
' Check Move to Position 3
If BoardPiece(3) = 0 Then
If Point(469, 187) = 12 Then X = 1: Playable(3) = 1: Position(3) = 0
If Turnstile(2) = 1 And Rotation(2) = 1 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 2
If Turnstile(2) = 2 And Rotation(2) = 1 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 2
If Turnstile(2) = 3 And Rotation(2) = 4 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 3 And Rotation(2) = 1 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 2
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 2
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(5) = 0 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(5) = 0 And BoardPiece(6) = 0 And Point(369, 287) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 3
If Turnstile(2) = 5 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(3) = 1: Position(3) = 0
End If
' Check Move to Position 5
If BoardPiece(5) = 0 Then
If Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(1) = 1 And Rotation(1) = 2 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 3
If Turnstile(2) = 1 And Rotation(2) = 4 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 3
If Turnstile(1) = 2 And Rotation(1) = 2 And BoardPiece(1) = 0 And Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 1
If Turnstile(2) = 2 And Rotation(2) = 2 And BoardPiece(3) = 0 And Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 1
If Turnstile(1) = 3 And Rotation(1) = 2 And BoardPiece(4) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 3
If Turnstile(1) = 3 And Rotation(1) = 1 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(2) = 3 And Rotation(2) = 4 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 3
If Turnstile(2) = 3 And Rotation(2) = 3 And BoardPiece(6) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 2
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(1) = 0 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 4
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(1) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(4) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 3
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(3) = 0 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 2
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(3) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 4
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(6) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 3
If Turnstile(1) = 5 And BoardPiece(1) = 0 And BoardPiece(4) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(2) = 5 And BoardPiece(3) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
End If
Case 3
' Check Move to Position 2
If BoardPiece(2) = 0 Then
If Point(469, 187) = 12 Then X = 1: Playable(2) = 1: Position(2) = 0
If Turnstile(2) = 1 And Rotation(2) = 1 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 4
If Turnstile(2) = 2 And Rotation(2) = 1 And BoardPiece(6) = 0 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 2
If Turnstile(2) = 3 And Rotation(2) = 1 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 4
If Turnstile(2) = 3 And Rotation(2) = 4 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 3
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 4
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(6) = 0 And Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 1
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 3
If Turnstile(2) = 5 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(2) = 1: Position(2) = 0
End If
' Check Move to Position 6
If BoardPiece(6) = 0 Then
If Point(551, 287) = 12 Then X = 1: Playable(6) = 1: Position(6) = 0
If Turnstile(2) = 1 And Rotation(2) = 2 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 3
If Turnstile(2) = 2 And Rotation(2) = 2 And BoardPiece(2) = 0 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 1
If Turnstile(2) = 3 And Rotation(2) = 1 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(2) = 3 And Rotation(2) = 2 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 3
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(2) = 0 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 3
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 4
If Turnstile(2) = 5 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(6) = 1: Position(6) = 0
End If
Case 4
' Check Move to Position 1
If BoardPiece(1) = 0 Then
If Point(187, 287) = 12 Then X = 1: Playable(1) = 1: Position(1) = 0
If Turnstile(1) = 1 And Rotation(1) = 4 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 1
If Turnstile(1) = 2 And Rotation(1) = 2 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 1
If Turnstile(1) = 3 And Rotation(1) = 3 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 4
If Turnstile(1) = 3 And Rotation(1) = 4 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 1
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 1
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(5) = 0 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 4
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(2) = 0 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(1) = 1: Position(1) = 1: Rotate(1) = 2
If Turnstile(1) = 5 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(1) = 1: Position(1) = 0
End If
' Check Move to Position 7
If BoardPiece(7) = 0 Then
If Point(187, 469) = 12 Then X = 1: Playable(7) = 1: Position(7) = 0
If Turnstile(3) = 1 And Rotation(3) = 4 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 3
If Turnstile(3) = 2 And Rotation(3) = 2 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 1
If Turnstile(3) = 3 And Rotation(3) = 3 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 2
If Turnstile(3) = 3 And Rotation(3) = 4 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 3
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(5) = 0 And BoardPiece(8) = 0 And Point(287, 369) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 2
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(5) = 0 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 4
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 3
If Turnstile(3) = 5 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(7) = 1: Position(7) = 0
End If
' Check Move to Position 5
If BoardPiece(5) = 0 Then
If Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(1) = 1 And Rotation(1) = 3 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(3) = 1 And Rotation(3) = 1 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 2
If Turnstile(1) = 2 And Rotation(1) = 1 And BoardPiece(1) = 0 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(3) = 2 And Rotation(3) = 1 And BoardPiece(7) = 0 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 2
If Turnstile(1) = 3 And Rotation(1) = 2 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 1
If Turnstile(1) = 3 And Rotation(1) = 3 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(3) = 3 And Rotation(3) = 4 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(3) = 3 And Rotation(3) = 1 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 2
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(1) = 0 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 3
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(1) = 0 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 1
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 1: Rotate(5) = 2
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(7) = 0 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(7) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 3
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 2
If Turnstile(1) = 5 And BoardPiece(1) = 0 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(3) = 5 And BoardPiece(7) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
End If
Case 5
' Check Move to Position 2
If BoardPiece(2) = 0 Then
If Point(369, 287) = 12 Then X = 1: Playable(2) = 1: Position(2) = 0
If Turnstile(1) = 1 And Rotation(1) = 2 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(2) = 1 And Rotation(2) = 4 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 1
If Turnstile(1) = 2 And Rotation(1) = 2 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(2) = 2 And Rotation(2) = 2 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 1
If Turnstile(1) = 3 And Rotation(1) = 1 And BoardPiece(1) = 0 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 4
If Turnstile(1) = 3 And Rotation(1) = 2 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(2) = 3 And Rotation(2) = 3 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 4
If Turnstile(2) = 3 And Rotation(2) = 4 And BoardPiece(3) = 0 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 1
If Turnstile(1) = 4 And Rotation(1) = 1 And BoardPiece(1) = 0 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 4
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(1) = 0 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 1
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(4) = 0 Then X = 1: Playable(2) = 1: Position(2) = 1: Rotate(2) = 2
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(3) = 0 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 2
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(6) = 0 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 4
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(3) = 0 Then X = 1: Playable(2) = 1: Position(2) = 2: Rotate(2) = 1
If Turnstile(1) = 5 And BoardPiece(1) = 0 And BoardPiece(4) = 0 Then X = 1: Playable(2) = 1: Position(2) = 0
If Turnstile(2) = 5 And BoardPiece(3) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(2) = 1: Position(2) = 0
End If
' Check Move to Position 4
If BoardPiece(4) = 0 Then
If Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 0
If Turnstile(1) = 1 And Rotation(1) = 3 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 4
If Turnstile(3) = 1 And Rotation(3) = 1 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 4
If Turnstile(1) = 2 And Rotation(1) = 1 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 2
If Turnstile(3) = 2 And Rotation(3) = 1 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 2
If Turnstile(1) = 3 And Rotation(1) = 3 And BoardPiece(1) = 0 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 4
If Turnstile(1) = 3 And Rotation(1) = 2 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 3
If Turnstile(3) = 3 And Rotation(3) = 1 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 4
If Turnstile(3) = 3 And Rotation(3) = 4 And BoardPiece(7) = 0 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 3
If Turnstile(1) = 4 And Rotation(1) = 4 And BoardPiece(1) = 0 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 1
If Turnstile(1) = 4 And Rotation(1) = 2 And BoardPiece(2) = 0 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 3
If Turnstile(1) = 4 And Rotation(1) = 3 And BoardPiece(1) = 0 Then X = 1: Playable(4) = 1: Position(4) = 1: Rotate(4) = 4
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(7) = 0 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 3
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(7) = 0 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 4
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(8) = 0 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 1
If Turnstile(1) = 5 And BoardPiece(1) = 0 And BoardPiece(2) = 0 Then X = 1: Playable(4) = 1: Position(4) = 0
If Turnstile(3) = 5 And BoardPiece(7) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(4) = 1: Position(4) = 0
End If
' Check Move to Position 6
If BoardPiece(6) = 0 Then
If Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 0
If Turnstile(2) = 1 And Rotation(2) = 3 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(4) = 1 And Rotation(4) = 1 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 2
If Turnstile(2) = 2 And Rotation(2) = 1 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(4) = 2 And Rotation(4) = 1 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 2
If Turnstile(2) = 3 And Rotation(2) = 2 And BoardPiece(3) = 0 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 1
If Turnstile(2) = 3 And Rotation(2) = 3 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(4) = 3 And Rotation(4) = 4 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(4) = 3 And Rotation(4) = 1 And BoardPiece(9) = 0 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 2
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(2) = 0 And BoardPiece(3) = 0 And Point(369, 287) = 12 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 1
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(3) = 0 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 2
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(2) = 0 Then X = 1: Playable(6) = 1: Position(6) = 2: Rotate(6) = 3
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(8) = 0 And BoardPiece(9) = 0 And Point(369, 469) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 3
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(9) = 0 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 2
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(8) = 0 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(2) = 5 And BoardPiece(2) = 0 And BoardPiece(3) = 0 Then X = 1: Playable(6) = 1: Position(6) = 0
If Turnstile(4) = 5 And BoardPiece(8) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(6) = 1: Position(6) = 0
End If
' Check Move to Position 8
If BoardPiece(8) = 0 Then
If Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 0
If Turnstile(3) = 1 And Rotation(3) = 2 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 3
If Turnstile(4) = 1 And Rotation(4) = 4 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 3
If Turnstile(3) = 2 And Rotation(3) = 2 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 1
If Turnstile(4) = 2 And Rotation(4) = 2 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 1
If Turnstile(3) = 3 And Rotation(3) = 2 And BoardPiece(7) = 0 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 3
If Turnstile(3) = 3 And Rotation(3) = 1 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(4) = 3 And Rotation(4) = 4 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 3
If Turnstile(4) = 3 And Rotation(4) = 3 And BoardPiece(9) = 0 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 2
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(4) = 0 And BoardPiece(7) = 0 And Point(287, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 4
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(2) = 0 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 3
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(4) = 0 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(6) = 0 And BoardPiece(9) = 0 And Point(469, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 2
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(6) = 0 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 4
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(9) = 0 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 3
If Turnstile(3) = 5 And BoardPiece(4) = 0 And BoardPiece(7) = 0 Then X = 1: Playable(8) = 1: Position(8) = 0
If Turnstile(4) = 5 And BoardPiece(6) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(8) = 1: Position(8) = 0
End If
Case 6
' Check Move to Position 3
If BoardPiece(3) = 0 Then
If Point(551, 287) = 12 Then X = 1: Playable(3) = 1: Position(3) = 0
If Turnstile(2) = 1 And Rotation(2) = 2 And Point(469, 187) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 2 And Rotation(2) = 2 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 3 And Rotation(2) = 1 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 4
If Turnstile(2) = 3 And Rotation(2) = 2 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(2) = 0 And Point(369, 287) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 1
If Turnstile(2) = 4 And Rotation(2) = 1 And BoardPiece(2) = 0 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 4
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(5) = 0 Then X = 1: Playable(3) = 1: Position(3) = 2: Rotate(3) = 2
If Turnstile(2) = 5 And BoardPiece(2) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(3) = 1: Position(3) = 0
End If
' Check Move to Position 9
If BoardPiece(9) = 0 Then
If Point(551, 469) = 12 Then X = 1: Playable(9) = 1: Position(9) = 0
If Turnstile(4) = 1 And Rotation(4) = 2 And Point(469, 551) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 3
If Turnstile(4) = 2 And Rotation(4) = 2 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 1
If Turnstile(4) = 3 And Rotation(4) = 2 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 3
If Turnstile(4) = 3 And Rotation(4) = 1 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 4
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 3
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(5) = 0 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 5 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(9) = 1: Position(9) = 0
End If
' Check Move to Position 5
If BoardPiece(5) = 0 Then
If Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(2) = 1 And Rotation(2) = 3 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 4
If Turnstile(4) = 1 And Rotation(4) = 1 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 4
If Turnstile(2) = 2 And Rotation(2) = 1 And BoardPiece(5) = 0 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 2
If Turnstile(4) = 2 And Rotation(4) = 1 And BoardPiece(9) = 0 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 2
If Turnstile(2) = 3 And Rotation(2) = 3 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 4
If Turnstile(2) = 3 And Rotation(2) = 2 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 3
If Turnstile(4) = 3 And Rotation(4) = 1 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 4
If Turnstile(4) = 3 And Rotation(4) = 4 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 3
If Turnstile(2) = 4 And Rotation(2) = 2 And BoardPiece(3) = 0 And Point(369, 287) = 12 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 3
If Turnstile(2) = 4 And Rotation(2) = 3 And BoardPiece(2) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 4
If Turnstile(2) = 4 And Rotation(2) = 4 And BoardPiece(2) = 0 And BoardPiece(3) = 0 Then X = 1: Playable(5) = 1: Position(5) = 2: Rotate(5) = 1
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(9) = 0 And Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 1
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(8) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 4
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(8) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 3
If Turnstile(2) = 5 And BoardPiece(2) = 0 And BoardPiece(3) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(4) = 5 And BoardPiece(8) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
End If
Case 7
' Check Move to Position 4
If BoardPiece(4) = 0 Then
If Point(187, 469) = 12 Then X = 1: Playable(4) = 1: Position(4) = 0
If Turnstile(3) = 1 And Rotation(3) = 4 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 1
If Turnstile(3) = 2 And Rotation(3) = 2 And BoardPiece(8) = 0 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 1
If Turnstile(3) = 3 And Rotation(3) = 3 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 4
If Turnstile(3) = 3 And Rotation(3) = 4 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 1
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 2
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(8) = 0 And Point(287, 369) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 4
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(4) = 1: Position(4) = 3: Rotate(4) = 1
If Turnstile(3) = 5 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(4) = 1: Position(4) = 0
End If
' Check Move to Position 8
If BoardPiece(8) = 0 Then
If Point(287, 551) = 12 Then X = 1: Playable(8) = 1: Position(8) = 0
If Turnstile(3) = 1 And Rotation(3) = 3 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(3) = 2 And Rotation(3) = 1 And BoardPiece(4) = 0 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(3) = 3 And Rotation(3) = 2 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 1
If Turnstile(3) = 3 And Rotation(3) = 3 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 1
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(5) = 0 And Point(287, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 2
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(4) = 0 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 3: Rotate(8) = 3
If Turnstile(3) = 5 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(8) = 1: Position(8) = 0
End If
Case 8
' Check Move to Position 7
If BoardPiece(7) = 0 Then
If Point(287, 551) = 12 Then X = 1: Playable(7) = 1: Position(7) = 0
If Turnstile(3) = 1 And Rotation(3) = 3 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 4
If Turnstile(3) = 2 And Rotation(3) = 1 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 2
If Turnstile(3) = 3 And Rotation(3) = 3 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 4
If Turnstile(3) = 3 And Rotation(3) = 2 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 3
If Turnstile(3) = 4 And Rotation(3) = 4 And BoardPiece(4) = 0 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 1
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(4) = 0 And Point(287, 369) = 12 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 4
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(5) = 0 Then X = 1: Playable(7) = 1: Position(7) = 3: Rotate(7) = 3
If Turnstile(3) = 5 And BoardPiece(4) = 0 And BoardPiece(5) = 0 Then X = 1: Playable(7) = 1: Position(7) = 0
End If
' Check Move to Position 9
If BoardPiece(9) = 0 Then
If Point(469, 551) = 12 Then X = 1: Playable(9) = 1: Position(9) = 0
If Turnstile(4) = 1 And Rotation(4) = 3 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 2 And Rotation(4) = 1 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 3 And Rotation(4) = 3 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 3 And Rotation(4) = 2 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 1
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(5) = 0 And BoardPiece(6) = 0 And Point(369, 469) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 1
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(6) = 0 And Point(469, 369) = 12 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 2
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(5) = 0 Then X = 1: Playable(9) = 1: Position(9) = 4: Rotate(9) = 1
If Turnstile(4) = 5 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(9) = 1: Position(9) = 0
End If
' Check Move to Position 5
If BoardPiece(5) = 0 Then
If Point(369, 469) = 12 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(3) = 1 And Rotation(3) = 2 And Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(4) = 1 And Rotation(4) = 4 And Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 1
If Turnstile(3) = 2 And Rotation(3) = 2 And BoardPiece(7) = 0 And Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(4) = 2 And Rotation(4) = 2 And BoardPiece(9) = 0 And Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 1
If Turnstile(3) = 3 And Rotation(3) = 1 And BoardPiece(4) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 4
If Turnstile(3) = 3 And Rotation(3) = 2 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(4) = 3 And Rotation(4) = 3 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 4
If Turnstile(4) = 3 And Rotation(4) = 4 And BoardPiece(6) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 1
If Turnstile(3) = 4 And Rotation(3) = 1 And BoardPiece(4) = 0 And BoardPiece(7) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 4
If Turnstile(3) = 4 And Rotation(3) = 2 And BoardPiece(4) = 0 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 1
If Turnstile(3) = 4 And Rotation(3) = 3 And BoardPiece(7) = 0 And Point(287, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 3: Rotate(5) = 2
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(6) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 2
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(6) = 0 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 1
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(9) = 0 And Point(469, 369) = 12 Then X = 1: Playable(5) = 1: Position(5) = 4: Rotate(5) = 4
If Turnstile(3) = 5 And BoardPiece(4) = 0 And BoardPiece(7) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
If Turnstile(4) = 5 And BoardPiece(6) = 0 And BoardPiece(9) = 0 Then X = 1: Playable(5) = 1: Position(5) = 0
End If
Case 9
' Check Move to Position 6
If BoardPiece(6) = 0 Then
If Point(551, 469) = 12 Then X = 1: Playable(6) = 1: Position(6) = 0
If Turnstile(4) = 1 And Rotation(4) = 2 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(4) = 2 And Rotation(4) = 2 And BoardPiece(8) = 0 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(4) = 3 And Rotation(4) = 1 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 4
If Turnstile(4) = 3 And Rotation(4) = 2 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(4) = 4 And Rotation(4) = 1 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 4
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(5) = 0 And Point(369, 469) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 1
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(8) = 0 And Point(469, 369) = 12 Then X = 1: Playable(6) = 1: Position(6) = 4: Rotate(6) = 2
If Turnstile(4) = 5 And BoardPiece(5) = 0 And BoardPiece(8) = 0 Then X = 1: Playable(6) = 1: Position(6) = 0
End If
' Check Move to Position 8
If BoardPiece(8) = 0 Then
If Point(469, 551) = 12 Then X = 1: Playable(8) = 1: Position(8) = 0
If Turnstile(4) = 1 And Rotation(4) = 3 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 4
If Turnstile(4) = 2 And Rotation(4) = 1 And BoardPiece(6) = 0 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 2
If Turnstile(4) = 3 And Rotation(4) = 2 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 3
If Turnstile(4) = 3 And Rotation(4) = 3 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 4
If Turnstile(4) = 4 And Rotation(4) = 2 And BoardPiece(8) = 0 And Point(369, 469) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 3
If Turnstile(4) = 4 And Rotation(4) = 3 And BoardPiece(5) = 0 And Point(469, 369) = 12 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 4
If Turnstile(4) = 4 And Rotation(4) = 4 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(8) = 1: Position(8) = 4: Rotate(8) = 1
If Turnstile(4) = 5 And BoardPiece(5) = 0 And BoardPiece(6) = 0 Then X = 1: Playable(8) = 1: Position(8) = 0
End If
End Select
CheckPiece = X
End Function
Sub AnimateButton
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
Color 15, 5: font& = _LoadFont(BoldFont$, 30): _Font font&
Circle (914, 415), 21, 5, 1.4, 4.8: Circle (1134, 415), 21, 5, 4.4, 1.6: Line (914, 394)-(1134, 394), 5: Line (914, 436)-(1134, 436), 5: Paint (914, 415), 5
_UPrintString (919, 403), "Animate Solution"
End Sub
Function CheckCompletedMaze
Dim As _Byte X: X = 0
If BoardPiece(1) = 1 Then X = X + 1
If BoardPiece(3) = 2 Then X = X + 1
If BoardPiece(7) = 3 Then X = X + 1
If BoardPiece(9) = 4 Then X = X + 1
If X = PiecesInPlay Then CheckCompletedMaze = 1 Else CheckCompletedMaze = 0
End Function
Function CompletedMaze
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
font& = _LoadFont(BoldFont$, 25): _Font font&: Color 15, 0
_UPrintString (860, 680), "You have Completed 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: Line (914, 61)-(1134, 369), 0, BF: CompletedMaze = 1: Card = Card + 1: DrawCard 1
Color 15, 0: font& = _LoadFont(BoldFont$, 25): _Font font&: Color 15, 0
_UPrintString (860, 680), Space$(300): _UPrintString (825, 710), Space$(300)
Line (755, 390)-(1295, 660), 3, BF: DrawBoardCenter
End Function
Function EndMaze
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
Color 15, 0: 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, 0: _UPrintString (855, 710), Space$(250)
End Function
Sub Message
BoldFont$ = Environ$("SYSTEMROOT") + "\fonts\Calibrib.ttf"
Color 15, 0: 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
