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

This is 3 versions of almost the same game. They are all 2 player abstract strategy board game play on a 6x6 game board.

Tix was created first with square shaped pieces.
Tixel was created shortly after with a partial circle cut out of 1 side.
Tixel with Extension Set includes the Tix tile set that each player can choose to exchange some of their Tixel pieces for Tix pieces.

When the pieces are on the board with the sides parallel to the board spaces, those pieces are said to be Inactive.
When the pieces are on the board with the side diagonal to the board spaces, those pieces are said to be Active.
Active pieces can be moved or slid across the board. All Active pieces that are each side of the sliding piece is rotated Inactive.
Pieces can only be put on the board in an Active state. No 2 Active pieces can be directly next to each other.
A player loses when they have no Active Pieces on the board.

An option to play on an 8x8 board included.

A complete copy of both sets of rules are included.

Hope you enjoy playing.

Donald


   


.pdf   Tix Rules.pdf (Size: 998.72 KB / Downloads: 33)

.pdf   Tixel Board Game Rules.pdf (Size: 645.03 KB / Downloads: 40)

Code: (Select All)

_Title "Tixel - Game Designed by Martijn Althuizen - Programmed by Donald L. Foster Jr."

Screen _NewImage(1237, 735, 256)

_PaletteColor 1, _RGB32(255, 0, 0) ' Red
_PaletteColor 2, _RGB32(0, 70, 255) ' Blue
_PaletteColor 3, _RGB32(170, 170, 170) ' Lt Grey
_PaletteColor 4, _RGB32(255, 215, 0) ' Gold
_PaletteColor 5, _RGB32(120, 120, 120) ' DK Grey
_PaletteColor 6, _RGB32(145, 145, 145) ' Med Grey
_Limit 100


Dim V As Integer
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

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

Dim MouseX As Integer
Dim MouseY As Integer
Dim MouseLeftButton As Integer

Dim Player As Integer ' Current Player
Dim Opponant As Integer ' Current Opponant
Dim GameChoice As Integer ' 1 - Tix, 2 - Tixel, 3 - Tixel with Extensions
Dim Active As Integer ' 0 - Current Piece Not Active, 1 - Current Piece is Active
Dim Piece As Integer ' 1 - Expansion Piece, 2 - Tixel Piece
Dim Rotation As Integer ' 1 - Curve Up or UpRight, 2 - Curve if Right or DownRight, 3 - Curve is Down or DownLeft, 4 - Curve is Left or UpLeft
Dim Direction As Integer ' 1 - Up, 2 - Right, 3 - Down, 4 - Left

Dim GameBoard As Integer ' 1 - 6 X 6 Game Board, 2 - 8 X 8 Game Board
Dim Pieces As Integer ' Number of Pieces Each Player Has: 1 - 8, 2 - 10
Dim BoardSize As Integer
Dim PieceSize As Integer
Dim BonusMove As Integer
Dim StartingX As Integer
Dim StartingY As Integer
Dim Increase As Integer
Dim PoolX As Integer
Dim PoolY As Integer
Dim Rotate As Integer
Dim RotationX As Integer
Dim RotationY As Integer
Dim Playable As Integer
Dim LastRow As Integer
Dim LastCol As Integer
Dim Row As Integer
Dim Col As Integer
Dim Row1 As Integer
Dim Col2 As Integer
Dim Column1 As Integer
Dim Row2 As Integer
Dim Column2 As Integer
Dim Escape As Integer
Dim Update As Integer

Dim ButtonY(3) As Integer
Dim FirstMove(2) As Integer ' Is This Players First Move? 1 - Yes, 0 - No
Dim RotationY(4) As Integer
Dim GameCursorY(5) As Integer ' Y Location on Screen for Game Choice Cursor

Dim ExpansionPieces(2) As Integer
Dim RegularPieces(2) As Integer
Dim PoolPieces(2) As Integer
Dim PoolExpPieces(2) As Integer
Dim PoolRegPieces(2) As Integer
Dim BoardPlayer(8, 8) As Integer ' Player at Selected Board Location: 0 - Empty, 1 - Player 1, 2 - Player 2
Dim BoardPiece(8, 8) As Integer ' Piece at Selected Board Location: 1 - Pix / Extension Piece, 2 - Pixel
Dim BoardActive(8, 8) As Integer
Dim BoardRotation(8, 8) As Integer ' Rotation of Piece at Selected Board Location: 1 - 4
Dim BoardX(8, 8) As Integer ' X Location Board Square is on the Screen
Dim BoardY(8, 8) As Integer ' Y Location Board Square is on the Screen
Dim Playable(8, 8) As Integer
Dim CircleSize(2) As Integer
Dim Start(2, 2, 4) As _Float
Dim EndCir(2, 2, 4) As _Float
Dim SetBack(2, 2) As Integer
Dim Xsetback(2, 2, 4) As Integer
Dim Ysetback(2, 2, 4) As Integer

Dim Piece$(2, 2, 3)
Dim Rotate$(2, 4)
Dim Remove$(2)
Dim Playable$(2)
Dim RemoveIndicator$(2)
Dim Box$(2)
Dim Button$(3)

Player = 1: Opponant = 2: BonusMove = 0
FirstMove(1) = 1: FirstMove(2) = 1
CircleSize(1) = 82: CircleSize(2) = 63
SetBack(1, 0) = 88: SetBack(1, 1) = 82: SetBack(2, 0) = 115

Xsetback(1, 0, 1) = 0: Ysetback(1, 0, 1) = -115: Xsetback(1, 0, 2) = 115: Ysetback(1, 0, 2) = 0: Xsetback(1, 0, 3) = 0: Ysetback(1, 0, 3) = 115: Xsetback(1, 0, 4) = -115: Ysetback(1, 0, 4) = 0
Xsetback(1, 1, 1) = 82: Ysetback(1, 1, 1) = -82: Xsetback(1, 1, 2) = 82: Ysetback(1, 1, 2) = 82: Xsetback(1, 1, 3) = -82: Ysetback(1, 1, 3) = 82: Xsetback(1, 1, 4) = -82: Ysetback(1, 1, 4) = -82
Xsetback(2, 0, 1) = 0: Ysetback(2, 0, 1) = -88: Xsetback(2, 0, 2) = 88: Ysetback(2, 0, 2) = 0: Xsetback(2, 0, 3) = 0: Ysetback(2, 0, 3) = 88: Xsetback(2, 0, 4) = -88: Ysetback(2, 0, 4) = 0
Xsetback(2, 1, 1) = 62: Ysetback(2, 1, 1) = -62: Xsetback(2, 1, 2) = 62: Ysetback(2, 1, 2) = 62: Xsetback(2, 1, 3) = -62: Ysetback(2, 1, 3) = 62: Xsetback(2, 1, 4) = -62: Ysetback(2, 1, 4) = -62

Start(1, 0, 1) = 4.00: EndCir(1, 0, 1) = 5.42: Start(1, 0, 2) = 2.42: EndCir(1, 0, 2) = 3.88: Start(1, 0, 3) = 0.88: EndCir(1, 0, 3) = 2.27: Start(1, 0, 4) = 5.57: EndCir(1, 0, 4) = 0.73
Start(1, 1, 1) = 3.23: EndCir(1, 1, 1) = 4.65: Start(1, 1, 2) = 1.62: EndCir(1, 1, 2) = 3.06: Start(1, 1, 3) = 0.08: EndCir(1, 1, 3) = 1.50: Start(1, 1, 4) = 4.78: EndCir(1, 1, 4) = 6.19
Start(2, 0, 1) = 4.07: EndCir(2, 0, 1) = 5.37: Start(2, 0, 2) = 2.48: EndCir(2, 0, 2) = 3.82: Start(2, 0, 3) = 0.94: EndCir(2, 0, 3) = 2.21: Start(2, 0, 4) = 5.63: EndCir(2, 0, 4) = 0.67
Start(2, 1, 1) = 3.29: EndCir(2, 1, 1) = 4.59: Start(2, 1, 2) = 1.68: EndCir(2, 1, 2) = 3.00: Start(2, 1, 3) = 0.14: EndCir(2, 1, 3) = 1.46: Start(2, 1, 4) = 4.80: EndCir(2, 1, 4) = 6.15

Piece$(1, 1, 1) = "BR53C1U53L107D107R107U54BL10P1,1": Piece$(1, 1, 2) = "BR53C2U53L107D107R107U54BL10P2,2"
Piece$(2, 1, 1) = "BR38C1U38L76D76R76U38BL10P1,1": Piece$(2, 1, 2) = "BR38C2U38L76D76R76U38BL10P2,2"
Piece$(1, 2, 1) = "BL53C1U53D107R107U107D20BL5P1,1": Piece$(1, 2, 2) = "BL53C2U53D107R107U107D20BL5P2,2": Piece$(1, 2, 3) = "BL53C3U53D107R107U107D20BL5P3,3"
Piece$(2, 2, 1) = "BL38C1U38D76R76U76D10BL5P1,1": Piece$(2, 2, 2) = "BL38C2U38D76R76U76D10BL5P2,2": Piece$(2, 2, 3) = "BL38C3U38D76R76U76D10BL5P3,3"
Rotate$(0, 1) = "TA0": Rotate$(0, 2) = "TA270": Rotate$(0, 3) = "TA180": Rotate$(0, 4) = "TA90"
Rotate$(1, 1) = "TA315": Rotate$(1, 2) = "TA225": Rotate$(1, 3) = "TA135": Rotate$(1, 4) = "TA45"
Remove$(1) = "BU63NR15NL15BU2P3,3": Remove$(2) = "BU48NR10NL10BU2P3,3"
Playable$(1) = "TA0C5BR30U30L60D60R60U36BL10P5,5": Playable$(2) = "TA0C5BR25U25L50D50R50U31BL10P5,5"
Box$(1) = "BU70R10P15,15": Box$(2) = "BU50P15,15"
Button$(1) = " Slide Piece ": Button$(2) = " Return Piece": Button$(3) = " Rotate Piece"
TixelT$ = "TA0C4D44R44U44L44BF5P4,4H5C0D44R44U44L44R1D43R42U42L42D11R16D30R10U30R15BH5P0,0"
TixI$ = "TA0C4D44R44U44L44BF5P4,4H5C0D44R44U44L44R1D43R42U42L42R16D41R10U41BG5P0,0"
TixelI$ = "TA0C0NR44D44R44H1l42U42R42L15BD5P4,0U5C0D42L10U42BF5P0,0"
TixelX$ = "C4D44R44U44L44BF5P4,4H5C0D44R44U44L44R1D43R42U42L42R16D16L15D10R15D15R10U15R15U10L15U15BG5P0,0"
TixX$ = "C4G31F31E31H31BD5P4,4BU5C0G31F31E31H31BD3G28F28E28H28BU1P0,0F11G11H11G8F11G11F8E11F11E8H11E11BL10P0,0"
TixelE$ = "TA0C0R44D44L44E1R42U42L42R10BD5P4,0BU6C0R34G9L30BE5P0,0G5BD26R30F9L10BU5P0,0BU12NL27U10L27BF5P0,0"
TixelL$ = "C4D44R44U44L44BF5P4,4H5C0D44R44U44L44R1D43R42U42L42R15ND42R10D32R16BG5P0,0"

Cls , 15: Color 0, 15

' Get Game Choice Cursor Locations
X = 296: For Z = 1 To 5: GameCursorY(Z) = X: X = X + 48: Next

Locate 15, 68: Print "Choose A Game To Play";
Locate 20, 77: Print "Tix";
Locate 23, 76: Print "Tixel";
Locate 26, 66: Print "Tixel With Extension Set";

GetGameChoiceInput:
Do While _MouseInput
For Z = 1 To 3
If _MouseX > 509 And _MouseX < 721 And _MouseY > GameCursorY(Z) - 1 And _MouseY < GameCursorY(Z) + 30 Then
Line (510, GameCursorY(Z))-(720, GameCursorY(Z) + 30), 0, B
If _MouseButton(1) = -1 Then GoSub ReleaseMouseButton: GameChoice = Z: GoTo EndGameChoiceLoop
Else Line (510, GameCursorY(Z))-(720, GameCursorY(Z) + 30), 15, B
End If
Next
Loop
GoTo GetGameChoiceInput

EndGameChoiceLoop:
' Setup Number of Pieces
If GameChoice = 1 Then Piece = 1: Pieces = 8 Else Piece = 2: Pieces = 10

If GameChoice = 1 Then
For Z = 1 To 2
RegularPieces(Z) = 0: PoolRegPieces(Z) = 0
ExpansionPieces(Z) = Pieces: PoolExpPieces(Z) = Pieces
Next
ElseIf GameChoice = 2 Then
For Z = 1 To 2
RegularPieces(Z) = Pieces: PoolRegPieces(Z) = Pieces
ExpansionPieces(Z) = 0: PoolExpPieces(Z) = 0
Next
ElseIf GameChoice = 3 Then
Cls , 15: Color 0, 15
For Y = 1 To 2
Locate 15, 58: Print "Player"; Y; "How Many Expansion Pieces? 0 - 4";: V = 0
For Z = 0 To 4
Locate 20 + V, 70: Print "Exchange"; Z; "Piece(s)";: V = V + 3
Next
GetExpansionInput:
Do While _MouseInput
For Z = 1 To 5
If _MouseX > 518 And _MouseX < 730 And _MouseY > GameCursorY(Z) - 1 And _MouseY < GameCursorY(Z) + 30 Then
Line (519, GameCursorY(Z))-(729, GameCursorY(Z) + 30), 0, B
If _MouseButton(1) = -1 Then
GoSub ReleaseMouseButton: Z = Z - 1
ExpansionPieces(Y) = Z: PoolExpPieces(Y) = Z
RegularPieces(Y) = Pieces - Z: PoolRegPieces(Y) = Pieces - Z
GoTo EndExpansionLoop
End If
Else Line (519, GameCursorY(Z))-(729, GameCursorY(Z) + 30), 15, B
End If
Next
Loop
GoTo GetExpansionInput
EndExpansionLoop:
Next
End If

' Get Game Board Size
Cls , 15: Color 0, 15

Locate 15, 69: Print "Choose A Game Board";
Locate 20, 70: Print "6 X 6 Game Board";
Locate 23, 70: Print "8 X 8 Game Board";

GetGameBoardInput:
Do While _MouseInput
For Z = 1 To 2
If _MouseX > 514 And _MouseX < 726 And _MouseY > GameCursorY(Z) - 1 And _MouseY < GameCursorY(Z) + 30 Then
Line (515, GameCursorY(Z))-(725, GameCursorY(Z) + 30), 0, B
If _MouseButton(1) = -1 Then GoSub ReleaseMouseButton: GameBoard = Z: GoTo EndGameBoardLoop
Else Line (515, GameCursorY(Z))-(725, GameCursorY(Z) + 30), 15, B
End If
Next
Loop
GoTo GetGameBoardInput

EndGameBoardLoop:

' Setup Game Board Borders
If GameBoard = 1 Then
BoardSize = 6: PieceSize = 53: StartingX = 330: StartingY = 79: Increase = 115: PoolX = 80: PoolY = 194: RotationX = 1097
Else BoardSize = 8: PieceSize = 38: StartingX = 320: StartingY = 67: Increase = 86: PoolX = 95: PoolY = 240: RotationX = 1100
End If

' Draw Board
Cls , 15

W = StartingY
For Z = 1 To BoardSize
X = StartingX
For Y = 1 To BoardSize
Line (X - PieceSize, W - PieceSize)-(X + PieceSize, W + PieceSize), 3, BF
BoardX(Z, Y) = X: BoardY(Z, Y) = W
X = X + Increase
Next
W = W + Increase
Next

' Draw Tixel Logo
If GameChoice = 1 Then
PSet (59, 20), 0: Draw TixelT$ + "BR11BU7" + TixI$ + "BR56BU15" + TixX$
Else
Circle (136, 42), 32, 0, 2.3, 3.98: Circle (135, 42), 32, 0, 2.3, 3.98: Circle (140, 42), 32, 0, 5.5, .8: Circle (141, 42), 32, 0, 5.5, .8
PSet (19, 20), 0: Draw TixelT$ + "BR10BU7" + TixelI$ + "BR49BU15" + TixX$ + "BR17BU12" + TixelE$ + "BU22BR34" + TixelL$
If GameChoice = 3 Then Color 0, 15: Locate 6, 9: Print "With Extension Set";
End If

StartGame:

If BoardSize = 6 Then V = 1 Else V = 0
Color 0, 15: Locate 8, 10: Print String$(V, 32); "P L A Y E R: "; Player;

GoSub UpdatePool

CheckForLegalMoves:
Playable = 0
For Z = 1 To BoardSize
For Y = 1 To BoardSize
Playable(Z, Y) = 0
' Check For Piece Placement
If BoardPlayer(Z, Y) = Player And BoardActive(Z, Y) = 1 Then
' Check For Piece Slide
If BonusMove = 1 And Z = LastRow And Y = LastCol GoTo Skip
If Z = 2 And BoardPlayer(1, Y) = 0 Then Playable = 1: Playable(Z, Y) = 1
If Z - 2 >= 1 Then If BoardPlayer(Z - 1, Y) = 0 And ((BoardPlayer(Z - 2, Y) = 0) Or (BoardPiece(Z - 2, Y) = 2 And BoardActive(Z - 2, Y) = 0 And BoardRotation(Z - 2, Y) = 3)) Then Playable = 1: Playable(Z, Y) = 1
If Y = BoardSize - 1 And BoardPlayer(Z, BoardSize) = 0 Then Playable = 1: Playable(Z, Y) = 1
If Y + 2 <= BoardSize Then If BoardPlayer(Z, Y + 1) = 0 And ((BoardPlayer(Z, Y + 2) = 0) Or (BoardPiece(Z, Y + 2) = 2 And BoardActive(Z, Y + 2) = 0 And BoardRotation(Z, Y + 2) = 4)) Then Playable = 1: Playable(Z, Y) = 1
If Z = BoardSize - 1 And BoardPlayer(BoardSize, Y) = 0 Then Playable = 1: Playable(Z, Y) = 1
If Z + 2 <= BoardSize Then If BoardPlayer(Z + 1, Y) = 0 And ((BoardPlayer(Z + 2, Y) = 0) Or (BoardPiece(Z + 2, Y) = 2 And BoardActive(Z + 2, Y) = 0 And BoardRotation(Z + 2, Y) = 1)) Then Playable = 1: Playable(Z, Y) = 1
If Y = 2 And BoardPlayer(Z, 1) = 0 Then Playable = 1: Playable(Z, Y) = 1
If Y - 2 >= 1 Then If BoardPlayer(Z, Y - 1) = 0 And ((BoardPlayer(Z, Y - 2) = 0) Or (BoardPiece(Z, Y - 2) = 2 And BoardActive(Z, Y - 2) = 0 And BoardRotation(Z, Y - 2) = 2)) Then Playable = 1: Playable(Z, Y) = 1
Skip:
End If
Next
Next

If FirstMove(Player) = 1 Then FirstMove(Player) = 0: Playable = 1

' Check if No Moves
If Playable = 0 Then
Locate 2, 125: Print " You Have No Playable Moves. "
Locate 4, 125: Print " Press <ENTER> To Continue. ";
GetENTER: A$ = InKey$: If A$ = "" GoTo GetENTER
If Asc(A$) <> 13 GoTo GetENTER
GoTo Winner
End If

Locate 2, 125: Print " Choose A Board Location. ";
Locate 3, 125: Print " ";

If BonusMove = 1 Then
Locate 4, 125: Print " Activate Non Active Piece. ";
Locate 5, 125: Print " Rotate An Active Piece. ";
Locate 6, 125: Print "Return Active Piece To Pool.";
End If

ChooseALocationInput:
Do While _MouseInput
For Z = 1 To BoardSize
For Y = 1 To BoardSize
If _MouseButton(1) = -1 And _MouseX > BoardX(Z, Y) - PieceSize And _MouseX < BoardX(Z, Y) + PieceSize And _MouseY > BoardY(Z, Y) - PieceSize And _MouseY < BoardY(Z, Y) + PieceSize Then
If BoardPlayer(Z, Y) = Opponant GoTo ChooseALocationInput Else Row1 = Z: Column1 = Y: GoSub ReleaseMouseButton: GoTo EndChoice1
End If
Next
Next
Loop
GoTo ChooseALocationInput

EndChoice1:
Piece = BoardPiece(Row1, Column1): Active = BoardActive(Row1, Column1): Rotation = BoardRotation(Row1, Column1)

' Check for Empty Pool and Selected Empty Board Space
If PoolPieces(Player) = 0 And Piece = 0 GoTo ChooseALocationInput

' Check if Last Piece Played Bonus Move
If BonusMove = 1 And Row1 = LastRow And Column1 = LastCol GoTo ChooseALocationInput

' Place A Piece On The Board
If BoardPlayer(Row1, Column1) = 0 And PoolPieces(Player) > 0 Then
Z = Row1: Y = Column1: GoSub CheckForPlacePiece
If V = 4 Then
Locate 3, 125: Print " ";
Locate 4, 125: Print " ";
Locate 5, 125: Print " ";
Locate 6, 125: Print " ";

Playable = 1: Active = 1: Rotate = 0
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1)

Circle (X1, X2), 10, 4: Paint (X1, X2), 4

If GameChoice = 1 Then Piece = 1 Else Piece = 2
If PoolRegPieces(Player) > 0 And PoolExpPieces(Player) > 0 Then GoSub ChoosePieceType

If Piece = 2 Then Escape = 0: GoSub ChooseARotation Else Rotation = 2

X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): X3 = Player

Line (X1 - PieceSize, X2 - PieceSize)-(X1 + PieceSize, X2 + PieceSize), 3, BF

BoardPlayer(Row1, Column1) = Player: BoardPiece(Row1, Column1) = Piece: BoardActive(Row1, Column1) = Active: BoardRotation(Row1, Column1) = Rotation
If Piece = 2 Then PoolRegPieces(Player) = PoolRegPieces(Player) - 1 Else PoolExpPieces(Player) = PoolExpPieces(Player) - 1

GoSub DrawPiece: GoTo EndMove
Else If BoardPlayer(Row1, Column1) = 0 GoTo ChooseALocationInput
End If
End If



' Check For Bonus Move
If BonusMove = 1 And BoardPlayer(Row1, Column1) = Player Then Playable(Row1, Column1) = 1: Playable = 1
If Playable = 0 GoTo ChooseALocationInput

If BonusMove = 1 Then
' Activate a Non Active Piece
If Active = 0 Then
Z = Row1: Y = Column1: GoSub CheckForPlacePiece
If V = 4 Then
Active = 1
If Piece = 1 Then
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): X3 = Player
Line (X1 - PieceSize, X2 - PieceSize)-(X1 + PieceSize, X2 + PieceSize), 3, BF
BoardActive(Row1, Column1) = Active
GoSub DrawPiece: GoTo EndMove
Else
Rotate = 0: Active = 1: Escape = 0: GoSub ChooseARotation
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): X3 = Player
Line (X1 - PieceSize, X2 - PieceSize)-(X1 + PieceSize, X2 + PieceSize), 3, BF
BoardActive(Row1, Column1) = Active: BoardRotation(Row1, Column1) = Rotate
GoSub DrawPiece: GoTo EndMove
End If
End If
End If
End If

' Check if can Slide
If BonusMove = 0 And BoardPlayer(Row1, Column1) = Player And Active = 1 Then
X = 0: X1 = Row1: X2 = Column1: GoSub CheckSlidePlayable: If X = 0 GoTo ChooseALocationInput
Else If BoardPlayer(Row1, Column1) = Player GoTo ChooseALocationInput
End If

X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): Row = Row1: Col = Column1

Circle (X1, X2), 10, 4: Paint (X1, X2), 4

Piece = BoardPiece(Row1, Column1)
Active = BoardActive(Row1, Column1)
Rotation = BoardRotation(Row1, Column1)

Locate 2, 125: Print "Choose Location To Slide To.";

If BonusMove = 1 Then
Locate 3, 125: Print " ";
Locate 4, 125: Print " Choose An Active Rotation. ";
Locate 5, 125: Print "Return Active Piece To Pool.";
Locate 6, 125: Print " ";
End If

If BonusMove = 1 Then

' Setup Buttons
If Piece = 2 Then V = 3 Else V = 2
X = 0: W = 0
For Z = 1 To V
PSet (1200, 157 + X), 6: Draw "L200D50NG10R200U50E10L220D70R220U70BL10BD8P3,6BR8P5,6BL20BD10P6,6"
Color 15, 6: Locate 12 + W, 131: Print Button$(Z);
ButtonY(Z) = 157 + X: X = X + 96: W = W + 6
Next

GetButtonInput:
Do While _MouseInput
For Z = 1 To V

' Check For Side Move
If _MouseButton(1) = -1 And _MouseX > 999 And _MouseX < 1201 And _MouseY > ButtonY(1) - 1 And _MouseY < ButtonY(1) + 51 Then
GoSub ReleaseMouseButton: Line (985, 10)-(1215, 450), 15, BF
If BoardPlayer(Row1, Column1) = Player And Active = 1 GoTo GetPlayableSlideMoves
End If

' Remove Piece nd Put in Pool
If _MouseButton(1) = -1 And _MouseX > 999 And _MouseX < 1201 And _MouseY > ButtonY(1) - 1 And _MouseY < ButtonY(2) + 51 Then
GoSub ReleaseMouseButton: Line (985, 10)-(1215, 450), 15, BF: Row = Row1: Col = Column1
BoardPlayer(Row1, Column1) = 0: BoardActive(Row1, Column1) = 0: BoardPiece(Row1, Column1) = 0: BoardRotation(Row1, Column1) = 0
If Piece = 1 Then PoolExpPieces(Player) = PoolExpPieces(Player) + 1 Else PoolRegPieces(Player) = PoolRegPieces(Player) + 1
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): GoSub RemovePlayableIndicators: GoSub RemovePiece: GoTo EndMove
End If

' Check For Piece Rotation
If _MouseButton(1) = -1 And _MouseX > 999 And _MouseX < 1201 And _MouseY > ButtonY(1) - 1 And _MouseY < ButtonY(3) + 51 Then
GoSub ReleaseMouseButton: Line (955, 10)-(1245, 450), 15, BF
Rotate = Rotation: Active = 1: Escape = 1: Update = 0: GoSub ChooseARotation
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): X3 = Player
Line (X1 - PieceSize, X2 - PieceSize)-(X1 + PieceSize, X2 + PieceSize), 3, BF
BoardActive(Row1, Column1) = Active: BoardRotation(Row1, Column1) = Rotation
GoSub RemovePlayableIndicators: GoSub RemovePiece: GoSub DrawPiece: GoTo EndMove
End If

Next
Loop
GoTo GetButtonInput
End If

GetPlayableSlideMoves:
For Z = 1 To BoardSize: For Y = 1 To BoardSize: Playable(Z, Y) = 0: Next: Next
X = 0: X1 = Row1: X2 = Column1: GoSub CheckSlidePlayable: If X = 0 GoTo ChooseALocationInput

ChooseAMoveInput:
' Get Board Location To Slide Piece
Do While _MouseInput
For Z = 1 To BoardSize
For Y = 1 To BoardSize
If (_MouseButton(1) = -1) * (_MouseX > BoardX(Z, Y) - PieceSize) * (_MouseX < BoardX(Z, Y) + PieceSize) * (_MouseY > BoardY(Z, Y) - PieceSize) * (_MouseY < BoardY(Z, Y) + PieceSize) Then
If Playable(Z, Y) > 0 Then Row2 = Z: Column2 = Y: Direction = Playable(Z, Y): GoSub ReleaseMouseButton: GoTo EndChoice2
End If
Next
Next
Loop
GoTo ChooseAMoveInput

EndChoice2:
X = 0: X1 = Row2: X2 = Column2:

GoSub RemovePlayableIndicators

' Remove Piece Front Starting Position
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): Row = Row1: Col = Column1: GoSub RemovePiece
BoardPlayer(Row, Col) = 0: BoardPiece(Row, Col) = 0: BoardActive(Row, Col) = 0: BoardRotation(Row, Col) = 0

' Draw Indicator at Selected Location
X1 = BoardX(Row2, Column2): X2 = BoardY(Row2, Column2)
Circle (X1, X2), 10, 4: Paint (X1, X2), 4

GoSub RotateAffectedPieces

' Get Activation and Rotation of Piece Moved
X1 = Row2: X2 = Column2: GoSub GetActivationRotation

' Setup Piece At New Location
BoardPlayer(Row2, Column2) = Player: BoardPiece(Row2, Column2) = Piece: BoardActive(Row2, Column2) = Active: BoardRotation(Row2, Column2) = Rotation
X1 = BoardX(Row2, Column2): X2 = BoardY(Row2, Column2): X3 = Player: GoSub DrawPiece

'Check if Piece Played Was Sacrified
If Active = 0 Then
Locate 2, 125: Print " Piece Played Was Scrificed. "
Locate 4, 125: Print " Play Bonus Move? ( Y or N ) ";
GetYN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYN
If A$ = "Y" Then BonusMove = 1: LastRow = Row2: LastCol = Column2: GoTo StartGame
If A$ <> "N" GoTo GetYN
End If

EndMove: BonusMove = 0: FirstMove(Player) = 0: Swap Player, Opponant: GoTo StartGame


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


UpdatePool:
Line (25, 137)-(251, 712), 15, BF
PoolPieces(Player) = PoolRegPieces(Player) + PoolExpPieces(Player)
V1 = 1: W1 = PoolY
For Z1 = 1 To Pieces / 2
X = PoolX
For Y1 = 1 To 2
X1 = X: X2 = W1: X3 = Player: Active = 0: Rotation = 1
If V1 <= RegularPieces(Player) Then
If V1 <= PoolRegPieces(Player) Then Piece = 2: GoSub DrawPiece
Else
If V1 <= RegularPieces(Player) + PoolExpPieces(Player) Then Piece = 1: GoSub DrawPiece
End If
X = X + Increase: V1 = V1 + 1
Next
W1 = W1 + Increase
Next
Return


DrawPiece:
If Piece = 2 Then Circle (X1 + Xsetback(GameBoard, Active, Rotation), X2 + Ysetback(GameBoard, Active, Rotation)), CircleSize(GameBoard), X3, Start(GameBoard, Active, Rotation), EndCir(GameBoard, Active, Rotation)
PSet (X1, X2), Point(X1 + Xsetback(GameBoard, Active, Rotation), X2 + Ysetback(GameBoard, Active, Rotation)): Draw Rotate$(Active, Rotation) + Piece$(GameBoard, Piece, X3)
Return


RemovePiece:
X1 = BoardX(Row, Col): X2 = BoardY(Row, Col)
If GameBoard = 1 Then X = 62 Else X = 47
Line (X1 - X, X2 - X)-(X1 + X, X2 + X), 15, BF
Line (X1 - PieceSize, X2 - PieceSize)-(X1 + PieceSize, X2 + PieceSize), 3, BF
PSet (X1, X2), 3: If Row = 1 Then Draw "TA0" + Box$(GameBoard) Else Draw "TA0" + Remove$(GameBoard)
PSet (X1, X2), 3: If Col = 1 Then Draw "TA90" + Box$(GameBoard) Else Draw "TA90" + Remove$(GameBoard)
PSet (X1, X2), 3: If Row = BoardSize Then Draw "TA180" + Box$(GameBoard) Else Draw "TA180" + Remove$(GameBoard)
PSet (X1, X2), 3: If Col = BoardSize Then Draw "TA270" + Box$(GameBoard) Else Draw "TA270" + Remove$(GameBoard)
Return


RemovePlayableIndicators:
For Z2 = 1 To BoardSize
For Y2 = 1 To BoardSize
If Playable(Z2, Y2) > 0 Then Playable(Z2, Y2) = 0: Paint (BoardX(Z2, Y2) - 1, BoardY(Z2, Y2)), 3
Next
Next
Return


CheckForPlacePiece:
V = 0
If Z = 1 Then V = V + 1
If Z - 1 >= 1 Then If (BoardPlayer(Z - 1, Y) = 0) Or (BoardPiece(Z - 1, Y) = 2 And BoardActive(Z - 1, Y) = 0 And BoardRotation(Z - 1, Y) = 3) Then V = V + 1
If Y = BoardSize Then V = V + 1
If Y + 1 <= BoardSize Then If (BoardPlayer(Z, Y + 1) = 0) Or (BoardPiece(Z, Y + 1) = 2 And BoardActive(Z, Y + 1) = 0 And BoardRotation(Z, Y + 1) = 4) Then V = V + 1
If Z = BoardSize Then V = V + 1
If Z + 1 <= BoardSize Then If (BoardPlayer(Z + 1, Y) = 0) Or (BoardPiece(Z + 1, Y) = 2 And BoardActive(Z + 1, Y) = 0 And BoardRotation(Z + 1, Y) = 1) Then V = V + 1
If Y = 1 Then V = V + 1
If Y - 1 >= 1 Then If (BoardPlayer(Z, Y - 1) = 0) Or (BoardPiece(Z, Y - 1) = 2 And BoardActive(Z, Y - 1) = 0 And BoardRotation(Z, Y - 1) = 2) Then V = V + 1
If V = 4 Then X = 1: Playable(Z, Y) = 1
Return


ChoosePieceType:
Locate 2, 125: Print " Choose A Piece Type. ";

If GameBoard = 1 Then V = 79 Else V = 60

X = 173
For Z = 1 To 2
X1 = RotationX: X2 = X: RotationY(Z) = X: Piece = Z: Rotation = 1: GoSub DrawPiece
X = X + 160
Next

GetPieceInput:
Do While _MouseInput
For Z = 1 To 2
If _MouseX > RotationX - V And _MouseX < RotationX + V And _MouseY > RotationY(Z) - V And _MouseY < RotationY(Z) + V Then
Line (RotationX - V, RotationY(Z) - V)-(RotationX + V, RotationY(Z) + V), 0, B
If _MouseButton(1) = -1 Then GoSub ReleaseMouseButton: Piece = Z: GoTo EndPieceLoop
Else Line (RotationX - V, RotationY(Z) - V)-(RotationX + V, RotationY(Z) + V), 15, B
End If
Next
Loop
GoTo GetPieceInput

EndPieceLoop:
Line (1010, 50)-(1185, 735), 15, BF
Return


ChooseARotation:
For Z = 2 To 6: Locate Z, 125: Print String$(32, 30);: Next

Locate 2, 125: Print " Choose A Rotation. ";

If GameBoard = 1 Then V = 79 Else V = 60
Sel(1) = 0: Sel(2) = 0: Sel(3) = 0: Sel(4) = 0
If Rotate = 0 Then Sel(1) = 1: Sel(2) = 1: Sel(3) = 1: Sel(4) = 1
If Rotate = 1 Then Sel(2) = 1: Sel(4) = 1
If Rotate = 2 Then Sel(1) = 1: Sel(3) = 1
If Rotate = 3 Then Sel(2) = 1: Sel(4) = 1
If Rotate = 4 Then Sel(1) = 1: Sel(3) = 1

X = 173
For A = 1 To 4
X1 = RotationX: X2 = X: RotationY(A) = X: Rotation = A
If Sel(A) = 1 Then X3 = Player Else X3 = 3
GoSub DrawPiece
X = X + 160
Next

GetRotationInput:
Do While _MouseInput
For A = 1 To 4
If _MouseX > RotationX - V And _MouseX < RotationX + V And _MouseY > RotationY(A) - V And _MouseY < RotationY(A) + V Then
If Sel(A) = 1 Then
Line (RotationX - V, RotationY(A) - V)-(RotationX + V, RotationY(A) + V), 0, B
Else Line (RotationX - V, RotationY(A) - V)-(RotationX + V, RotationY(A) + V), 15, B
End If
If _MouseButton(1) = -1 And Sel(A) = 1 Then GoSub ReleaseMouseButton: Rotation = A: GoTo EndRotationLoop
Else Line (RotationX - V, RotationY(A) - V)-(RotationX + V, RotationY(A) + V), 15, B
End If
Next
Loop
GoTo GetRotationInput

EndRotationLoop:
Line (1010, 50)-(1185, 735), 15, BF
Return


CheckSlidePlayable:
V = 0:
CheckUp:
W = 0
If X1 - V - 1 >= 1 Then
V = V + 1
If BoardPlayer(X1 - V, X2) = 0 Then
If Piece = 2 Then W = 1
If X1 - V = 1 Then W = 1
If X1 - V - 1 >= 1 Then
If BoardPlayer(X1 - V - 1, X2) = 0 Then W = 1
If BoardActive(X1 - V - 1, X2) = 0 Then W = 1
End If
End If
If W = 1 Then X = 1: Playable(X1 - V, X2) = 1: PSet (BoardX(X1 - V, X2), BoardY(X1 - V, X2)), 3: Draw Playable$(GameBoard): GoTo CheckUp
End If

V = 0:
CheckRight:
W = 0
If X2 + V + 1 <= BoardSize Then
V = V + 1
If BoardPlayer(X1, X2 + V) = 0 Then
If X2 + V = BoardSize Then W = 1
If Piece = 2 Then W = 1
If X2 + V + 1 <= BoardSize Then
If BoardPlayer(X1, X2 + V + 1) = 0 Then W = 1
If BoardActive(X1, X2 + V + 1) = 0 Then W = 1
End If
If W = 1 Then X = 1: Playable(X1, X2 + V) = 2: PSet (BoardX(X1, X2 + V), BoardY(X1, X2 + V)), 3: Draw Playable$(GameBoard): GoTo CheckRight
End If
End If

V = 0:
CheckDown:
W = 0
If X1 + V + 1 <= BoardSize Then
V = V + 1
If BoardPlayer(X1 + V, X2) = 0 Then
If X1 + V = BoardSize Then W = 1
If Piece = 2 Then W = 1
If X1 + V + 1 <= BoardSize Then
If BoardPlayer(X1 + V + 1, X2) = 0 Then W = 1
If BoardActive(X1 + V + 1, X2) = 0 Then W = 1
End If
If W = 1 Then X = 1: Playable(X1 + V, X2) = 3: PSet (BoardX(X1 + V, X2), BoardY(X1 + V, X2)), 3: Draw Playable$(GameBoard): GoTo CheckDown
End If
End If

V = 0:
CheckLeft:
W = 0
If X2 - V - 1 >= 1 Then
V = V + 1
If BoardPlayer(X1, X2 - V) = 0 Then
If X2 - V = 1 Then W = 1
If Piece = 2 Then W = 1
If X2 - V - 1 >= 1 Then
If BoardPlayer(X1, X2 - V - 1) = 0 Then W = 1
If BoardActive(X1, X2 - V - 1) = 0 Then W = 1
End If
If W = 1 Then X = 1: Playable(X1, X2 - V) = 4: PSet (BoardX(X1, X2 - V), BoardY(X1, X2 - V)), 3: Draw Playable$(GameBoard): GoTo CheckLeft
End If
End If
Return


RotateAffectedPieces:
Select Case Direction
Case 1:
For A = Row1 - 1 To Row2 Step -1
If Column1 - 1 >= 1 Then
If BoardActive(A, Column1 - 1) = 1 Then
Rotation = BoardRotation(A, Column1 - 1): Piece = BoardPiece(A, Column1 - 1)
BoardActive(A, Column1 - 1) = 0: BoardRotation(A, Column1 - 1) = Rotation
X1 = BoardX(A, Column1 - 1): X2 = BoardY(A, Column1 - 1): Row = A: Col = Column1 - 1
Active = 0: X3 = BoardPlayer(A, Column1 - 1): GoSub RemovePiece: GoSub DrawPiece
End If
End If
If Column1 + 1 <= BoardSize Then
If BoardActive(A, Column1 + 1) = 1 Then
Rotation = BoardRotation(A, Column1 + 1): Piece = BoardPiece(A, Column1 + 1)
If Piece = 2 Then If Rotation = 4 Then Rotation = 1 Else Rotation = Rotation + 1
BoardActive(A, Column1 + 1) = 0: BoardRotation(A, Column1 + 1) = Rotation
X1 = BoardX(A, Column1 + 1): X2 = BoardY(A, Column1 + 1): Row = A: Col = Column1 + 1
Active = 0: X3 = BoardPlayer(A, Column1 + 1): GoSub RemovePiece: GoSub DrawPiece
End If
End If
Next

Case 2:
For A = Column1 + 1 To Column2
If Row1 - 1 >= 1 Then
If BoardActive(Row1 - 1, A) = 1 Then
Rotation = BoardRotation(Row1 - 1, A): Piece = BoardPiece(Row1 - 1, A)
BoardActive(Row1 - 1, A) = 0: BoardRotation(Row1 - 1, A) = Rotation
X1 = BoardX(Row1 - 1, A): X2 = BoardY(Row1 - 1, A): Row = Row1 - 1: Col = A
Active = 0: X3 = BoardPlayer(Row1 - 1, A): GoSub RemovePiece: GoSub DrawPiece
End If
End If
If Row1 + 1 <= BoardSize Then
If BoardActive(Row1 + 1, A) = 1 Then
Rotation = BoardRotation(Row1 + 1, A): Piece = BoardPiece(Row1 + 1, A)
If Piece = 2 Then If Rotation = 4 Then Rotation = 1 Else Rotation = Rotation + 1
BoardActive(Row1 + 1, A) = 0: BoardRotation(Row1 + 1, A) = Rotation
X1 = BoardX(Row1 + 1, A): X2 = BoardY(Row1 + 1, A): Row = Row1 + 1: Col = A
Active = 0: X3 = BoardPlayer(Row1 + 1, A): GoSub RemovePiece: GoSub DrawPiece
End If
End If
Next

Case 3:
For A = Row1 + 1 To Row2
If Column1 - 1 >= 1 Then
If BoardActive(A, Column1 - 1) = 1 Then
Rotation = BoardRotation(A, Column1 - 1): Piece = BoardPiece(A, Column1 - 1)
If Piece = 2 Then If Rotation = 4 Then Rotation = 1 Else Rotation = Rotation + 1
BoardActive(A, Column1 - 1) = 0: BoardRotation(A, Column1 - 1) = Rotation
X1 = BoardX(A, Column1 - 1): X2 = BoardY(A, Column1 - 1): Row = A: Col = Column1 - 1
Active = 0: X3 = BoardPlayer(A, Column1 - 1): GoSub RemovePiece: GoSub DrawPiece
End If
End If
If Column1 + 1 <= BoardSize Then
If BoardActive(A, Column1 + 1) = 1 Then
Rotation = BoardRotation(A, Column1 + 1): Piece = BoardPiece(A, Column1 + 1)
BoardActive(A, Column1 + 1) = 0: BoardRotation(A, Column1 + 1) = Rotation
X1 = BoardX(A, Column1 + 1): X2 = BoardY(A, Column1 + 1): Row = A: Col = Column1 + 1
Active = 0: X3 = BoardPlayer(A, Column1 + 1): GoSub RemovePiece: GoSub DrawPiece
End If
End If

Next
Case 4:
For A = Column1 - 1 To Column2 Step -1
If Row1 - 1 >= 1 Then
If BoardActive(Row1 - 1, A) = 1 Then
Rotation = BoardRotation(Row1 - 1, A): Piece = BoardPiece(Row1 - 1, A)
If Piece = 2 Then If Rotation = 4 Then Rotation = 1 Else Rotation = Rotation + 1
BoardActive(Row1 - 1, A) = 0: BoardRotation(Row1, A) = Rotation
X1 = BoardX(Row1 - 1, A): X2 = BoardY(Row1 - 1, A): Row = Row1 - 1: Col = A
Active = 0: X3 = BoardPlayer(Row1 - 1, A): GoSub RemovePiece: GoSub DrawPiece
End If
End If
If Row1 + 1 <= BoardSize Then
If BoardActive(Row1 + 1, A) = 1 Then
Rotation = BoardRotation(Row1 + 1, A): Piece = BoardPiece(Row1 + 1, A)
BoardActive(Row1 + 1, A) = 0: BoardRotation(Row1 + 1, A) = Rotation: Row = Row1 + 1: Col = A
X1 = BoardX(Row1 + 1, A): X2 = BoardY(Row1 + 1, A): Row = Row1 + 1: Col = A
Active = 0: X3 = BoardPlayer(Row1 + 1, A): GoSub RemovePiece: GoSub DrawPiece
End If
End If

Next

End Select
Return


GetActivationRotation:
V = 0
If X1 = 1 Then V = V + 1
If X1 - 1 >= 1 Then If BoardPlayer(X1 - 1, X2) = 0 Or (BoardPiece(X1 - 1, X2) = 2 And BoardActive(X1 - 1, X2) = 0 And BoardRotation(X1 - 1, X2) = 3) Then V = V + 1
If X2 = BoardSize Then V = V + 1
If X2 + 1 <= BoardSize Then If BoardPlayer(X1, X2 + 1) = 0 Or (BoardPiece(X1, X2 + 1) = 2 And BoardActive(X1, X2 + 1) = 0 And BoardRotation(X1, X2 + 1) = 4) Then V = V + 1
If X1 = BoardSize Then V = V + 1
If X1 + 1 <= BoardSize Then If BoardPlayer(X1 + 1, X2) = 0 Or (BoardPiece(X1 + 1, X2) = 2 And BoardActive(X1 + 1, X2) = 0 And BoardRotation(X1 + 1, X2) = 1) Then V = V + 1
If X2 = 1 Then V = V + 1
If X2 - 1 >= 1 Then If BoardPlayer(X1, X2 - 1) = 0 Or (BoardPiece(X1, X2 - 1) = 2 And BoardActive(X1, X2 - 1) = 0 And BoardRotation(X1, X2 - 1) = 2) Then V = V + 1
If V = 4 Then
Active = 1: Rotation = 0: If Piece = 2 Then GoSub ChooseARotation Else Rotation = 1
Else
Active = 0: Rotation = 0
Select Case Direction
Case 1: If X1 - 1 >= 1 Then If BoardActive(X1 - 1, X2) = 1 Then Rotation = 1
Case 2: If X2 + 1 <= BoardSize Then If BoardActive(X1, X2 + 1) = 1 Then Rotation = 2
Case 3: If X1 + 1 <= BoardSize Then If BoardActive(X1 + 1, X2) = 1 Then Rotation = 3
Case 4: If X2 - 1 >= 1 Then If BoardActive(X1, X2 - 1) = 1 Then Rotation = 4
End Select
If Rotation = 0 Then If Piece = 2 Then GoSub ChooseARotation Else Rotation = 1
End If
Return


Winner:
Swap Player, Opponant

Color 0, 15: Locate 8, 10: Print String$(V, 32); "P L A Y E R: "; Player;:

GoSub UpdatePool

Locate 2, 125: Print " Player"; Player; "is the Winner!!! ";
Locate 3, 125: Print " ";
Locate 4, 124: Print "Play Another Game? ( Y or N )";

AnotherGame:
A$ = UCase$(InKey$): If A$ = "" GoTo AnotherGame
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo AnotherGame
Reply




Users browsing this thread: 1 Guest(s)