12-23-2023, 11:46 PM
Quote:Hello all,
Block It! is a abstract strategy 2 to 4 player board game.
Object of game: To place all you blocks on the board first
Game consist of 2 game boards to choose from (black or white), 25 pieces with 4 colors arranged 5x5 on the board that can be rotated. Each player has 2 or 3 blocks of their color started off the board and a 6 sided dice showing types of moves players use on each turn.
The game starts off with the 25 pieces randomly arranged on the board. Each piece has a white stem so the pieces can be picked up and rotated. The pieces have 4 colors in each corner of the piece representing each players color. The players are trying to arrange 4 blocks in a square shape pattern trying to match the 4 inner corners colors to their color. Once all 4 corners match the player's color, that player places 1 of their blocks in the center of the 4 pieces claiming that spot on the board. Those 4 pieces a now locked down to the board and can not be rotated. If at the start of a players turn, there is already a new matching pattern with their color, the player place 1 of their blocks in that space, then the player takes their turn. If a the end of their turn, a new pattern of their color is formed, they place 1 of their blocks in the pattern.
A turn consist of rolling the the dice and performing the move indicated on the dice. The 6 moves are: rotate clockwise once, rotate clockwise twice, rotate counter clockwise once, rotate counter clockwise twice, swap any 2 pieces, and remove any players block. The rotate moves show 1x or 2x and an arrow showing the direction of rotation. on the 2x, you rotate 2 separate pieces or the same piece twice. Click on the piece you want to rotate. The swap moves has 2 arrows facing in opposite directions. You are asked to choose the 2 pieces to swap. The move a block move has a outline of a block with an X through it. Clock on any players block and it is removed from the board.
I have included a copy of the rules
Hope you enjoy playing
Donald
Block it! Rules.pdf (Size: 60.39 KB / Downloads: 43)
Code: (Select All)
_Title "Block It! - Designed by Hans van Tol 2003 - Programmed by Donald L. Foster Jr. 2018"
Screen _NewImage(1025, 735, 256)
_PaletteColor 1, _RGB32(100, 100, 100) ' background
_PaletteColor 2, _RGB32(250, 0, 0) ' Red Board
_PaletteColor 3, _RGB32(220, 0, 0) ' Red Piece
_PaletteColor 4, _RGB32(0, 150, 240) ' Blue Board
_PaletteColor 5, _RGB32(0, 120, 210) ' Blue Piece
_PaletteColor 6, _RGB32(240, 230, 0) ' Yellow Board
_PaletteColor 7, _RGB32(210, 200, 0) ' Yellow Piece
_PaletteColor 8, _RGB32(0, 190, 0) ' Green Board
_PaletteColor 9, _RGB32(0, 160, 0) ' Green Piece
_PaletteColor 10, _RGB32(30, 30, 30) ' Light Black
_PaletteColor 11, _RGB32(100, 100, 100) ' Block
Randomize Timer
DefInt A-Z
Dim Piece$(25, 4), Placed(25)
Player = 1: Blocks = 0
Blocks(1) = 0: Blocks(2) = 0: Blocks(3) = 0: Blocks(4) = 0
BoardColor(1, 1) = 2: BoardColor(1, 2) = 4: BoardColor(1, 3) = 6: BoardColor(1, 4) = 10
BoardColor(2, 1) = 2: BoardColor(2, 2) = 4: BoardColor(2, 3) = 6: BoardColor(2, 4) = 8
PlayerColor(1, 1) = 3: PlayerColor(1, 2) = 5: PlayerColor(1, 3) = 7: PlayerColor(1, 4) = 0
PlayerColor(2, 1) = 3: PlayerColor(2, 2) = 5: PlayerColor(2, 3) = 7: PlayerColor(2, 4) = 9
For Z = 1 To 5: For Y = 1 To 5: Locked = 0: Next: Next
' Setup Pieces
X$ = "3142412341323142314242312134124321344123413221432341312421432413243142132431421343124132132413243241"
Remove$(1) = "BR3BU30C0D27R30BD6L30D30BL6U30L30BU6R30U30BR2BD5P15,0"
Remove$(2) = "BR3BU30C15D27R30BD6L30D30BL6U30L30BU6R30U30R1C0D65R1U65R1D65R1U65D65R1U65D31R30L65D1R65D1L65D1R65D1L65"
X = 1: For Y = 1 To 25
W$ = Mid$(X$, X, 4):
Piece$(Y, 1) = W$
Piece$(Y, 2) = "": Piece$(Y, 2) = Mid$(W$, 3, 1) + Mid$(W$, 1, 1) + Mid$(W$, 4, 1) + Mid$(W$, 2, 1)
Piece$(Y, 3) = "": Piece$(Y, 3) = Mid$(W$, 4, 1) + Mid$(W$, 3, 1) + Mid$(W$, 2, 1) + Mid$(W$, 1, 1)
Piece$(Y, 4) = "": Piece$(Y, 4) = Mid$(W$, 2, 1) + Mid$(W$, 4, 1) + Mid$(W$, 1, 1) + Mid$(W$, 3, 1)
X = X + 4:
Next
Cls , 1: Color 15, 1: Locate 15, 52: Print "B L O C K I T !";
' Get How Many Players
Color 0, 1: Locate 20, 51: Print "How Many Players? (2 to 4) ";
GetPlayers: A$ = InKey$: If A$ = "" GoTo GetPlayers Else If Val(A$) < 2 Or Val(A$) > 4 GoTo GetPlayers Else Players = Val(A$): Print A$;
If Players > 2 Then Blocks = 2 Else Blocks = 3
For Z = 1 To Players: Blocks(Z) = Blocks: Next
' Choose Game Board
Color 0, 1: Locate 23, 47: Print "Choose Game Board. (White or Black) ";
GetGameBoard:
A$ = UCase$(InKey$)
If A$ = "" GoTo GetGameBoard
If A$ = "W" Then GameBoard = 1
If A$ = "B" Then GameBoard = 2
If GameBoard = 0 GoTo GetGameBoard
Print A$;
' Get How Many Blocks
If Players > 2 Then
Color 0: Locate 26, 52: Print "How Many Blocks? (2 or 3) ";
GetBlocks: A$ = InKey$: If A$ = "" GoTo GetBlocks Else If Val(A$) < 2 Or Val(A$) > 3 GoTo GetBlocks Else Blocks = Val(A$): Print A$;
End If
For Z = 1 To Players: Blocks(Z) = Blocks: Next
Cls , 1
' Draw Board
If GameBoard = 1 Then V1 = 0: V2 = 15 Else V1 = 15: V2 = 0
Line (30, 10)-(705, 10), V1
Line (30, 725)-(705, 725), V1
Line (10, 30)-(10, 705), V1
Line (725, 30)-(725, 705), V1
Circle (30, 30), 20, V1, 1.5, 3.1
Circle (705, 30), 20, V1, 0, 1.7
Circle (30, 705), 20, V1, 3.1, 4.8
Circle (705, 705), 20, V1, 4.6, 0
Paint (515, 515), V2, V1
' Setup Board and Draw Pieces on Board
For Z = 1 To 25: Placed(Z) = 0: Next
X = 0
For Z = 1 To 5
V = 0
For Y = 1 To 5
Placed: W = Int(Rnd * 25) + 1: If Placed(W) = 1 GoTo Placed Else Placed(W) = 1: BoardPiece(Z, Y) = W
Block: T1 = W: T2 = Int(Rnd * 4) + 1: BoardRotate(Z, Y) = T2: Rotate$ = Piece$(W, T2)
If Z > 1 And Y > 1 Then
BlockX(Z - 1, Y - 1) = 52 + V: BlockY(Z - 1, Y - 1) = 52 + X
B1 = Z - 1: B2 = Y - 1: Setup = 1: SetUpBlock = 0: GoSub CheckBlock: If SetUpBlock = 1 GoTo Block
End If
BoardX(Z, Y) = 115 + V: BoardY(Z, Y) = 115 + X: X1 = 115 + V: X2 = 115 + X: GoSub DrawPiece
V = V + 126
Next
X = X + 126
Next
Color 15, 1: Locate 2, 98: Print "B L O C K I T !";
GoSub UpdateBlockStorage
StartGame:
Setup = 0: Selected = 1: Blocks = 0
' Draw Player Indicator
X1 = 873: X2 = 100: X3 = Player: GoSub DrawBlock
Color 15, 1: Locate 10, 106: Print "Player:"; Player;
' Set Playable Moves to 0
For Z = 1 To 4: For Y = 1 To 4: Playable(Z, Y) = 0: Next: Next
' Check if Block Can be Placed
Block = 0
For Z = 1 To 4
For Y = 1 To 4
If Block(Z, Y) = 0 Then
T1 = BoardPiece(Z, Y): T2 = BoardRotate(Z, Y): Piece$ = Piece$(T1, T2): B1 = Val(Mid$(Piece$, 4, 1))
T1 = BoardPiece(Z, Y + 1): T2 = BoardRotate(Z, Y + 1): Piece$ = Piece$(T1, T2): B2 = Val(Mid$(Piece$, 3, 1))
T1 = BoardPiece(Z + 1, Y): T2 = BoardRotate(Z + 1, Y): Piece$ = Piece$(T1, T2): B3 = Val(Mid$(Piece$, 2, 1))
T1 = BoardPiece(Z + 1, Y + 1): T2 = BoardRotate(Z + 1, Y + 1): Piece$ = Piece$(T1, T2): B4 = Val(Mid$(Piece$, 1, 1))
If B1 = B2 And B2 = B3 And B3 = B4 And B1 = Player Then Block = 1: Playable(Z, Y) = B1
End If
Next
Next
' Block Can be Placed
If Block = 1 Then
Color 15, 1: Locate 23, 97: Print "You Have a Matching Pattern ";
Color 15, 1: Locate 25, 97: Print "Press <ENTER> to Place Block ";
GetENTER: A$ = InKey$: If A$ = "" GoTo GetENTER Else If Asc(A$) <> 13 GoTo GetENTER
GoSub PlaceBlock
End If
' Check if Block Can be Removed
Remove = 0
For Z = 1 To 4
For Y = 1 To 4
If Block(Z, Y) > 0 Then If Block(Z, Y) <> Player Then Remove = 1
Next
Next
RollDice:
X1 = 873: X2 = 270: For Z = 1 To 20: Dice = Int(Rnd * 6) + 1: X3 = Dice: GoSub DrawDice: _Delay .15: Next
' Display Dice Roll Message
If Dice = 5 Then
Color 15, 1: Locate 23, 97: Print " Choose a Piece to Swap ";
ElseIf Dice = 6 Then
Else
Color 15, 1: Locate 23, 97: Print " Choose a Piece to Rotate ";
End If
If Dice < 6 Then
ChoosePieceMouseInput:
If Dice = 1 Or Dice = 2 Then Color 15, 1: Locate 25, 97: Print " ";
If Dice = 3 Or Dice = 4 Then Color 15, 1: Locate 25, 97: Print " Rotating Piece"; Selected; "of 2 ";
If Dice = 5 And Selected = 1 Then Color 15, 1: Locate 25, 97: Print " Choose First Piece ";
If Dice = 5 And Selected = 2 Then Color 15, 1: Locate 25, 97: Print " Choose Second Piece ";
Do While _MouseInput
MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)
For Z = 1 To 5
For Y = 1 To 5
If (MouseLeftButton = -1) * (MouseX > BoardX(Z, Y) - 60) * (MouseX < BoardX(Z, Y) + 60) * (MouseY > BoardY(Z, Y) - 60) * (MouseY < BoardY(Z, Y) + 60) Then
If Locked(Z, Y) = 0 Then Row = Z: Column = Y: GoSub ButtonReleased: GoTo EndChoice1
End If
Next
Next
Loop
GoTo ChoosePieceMouseInput
EndChoice1:
If Dice < 5 Then
Piece = BoardPiece(Row, Column): Rotation = BoardRotate(Row, Column)
If Dice = 1 Or Dice = 3 Then If Rotation = 4 Then Rotation = 1 Else Rotation = Rotation + 1
If Dice = 2 Or Dice = 4 Then If Rotation = 1 Then Rotation = 4 Else Rotation = Rotation - 1
T1 = BoardPiece(Row, Column): T2 = Rotation: BoardRotate(Row, Column) = Rotation
X1 = BoardX(Row, Column): X2 = BoardY(Row, Column): Rotate$ = Piece$(Piece, Rotation): GoSub DrawPiece
If Dice > 2 And Selected = 1 Then Selected = Selected + 1: GoTo ChoosePieceMouseInput
Else
If Selected = 1 Then Row1 = Row: Column1 = Column Else Row2 = Row: Column2 = Column
If GameBoard = 1 Then F1 = 0: F2 = 15 Else F1 = 15: F2 = 0
Line (BoardX(Row, Column) - 63, BoardY(Row, Column) - 63)-(BoardX(Row, Column) + 63, BoardY(Row, Column) + 63), F1, B
If Selected = 1 Then Selected = Selected + 1: GoTo ChoosePieceMouseInput
Swap BoardPiece(Row1, Column1), BoardPiece(Row2, Column2): Swap BoardRotate(Row1, Column1), BoardRotate(Row2, Column2)
T1 = BoardPiece(Row1, Column1): T2 = BoardRotate(Row1, Column1): Rotate$ = Piece$(T1, T2)
X1 = BoardX(Row1, Column1): X2 = BoardY(Row1, Column1): GoSub DrawPiece
T1 = BoardPiece(Row2, Column2): T2 = BoardRotate(Row2, Column2): Rotate$ = Piece$(T1, T2)
X1 = BoardX(Row2, Column2): X2 = BoardY(Row2, Column2): GoSub DrawPiece
Line (BoardX(Row1, Column1) - 63, BoardY(Row1, Column1) - 63)-(BoardX(Row1, Column1) + 63, BoardY(Row1, Column1) + 63), F2, B
Line (BoardX(Row2, Column2) - 63, BoardY(Row2, Column2) - 63)-(BoardX(Row2, Column2) + 63, BoardY(Row2, Column2) + 63), F2, B
End If
Else
If Remove = 0 Then
Color 15, 1: Locate 23, 97: Print " No Blocks to Ronove ";
Color 15, 1: Locate 25, 97: Print " Press <ENTER> to Continue ";
GetENTER2: A$ = InKey$: If A$ = "" GoTo GetENTER2 Else If Asc(A$) <> 13 GoTo GetENTER2
Color 15, 1: Locate 23, 97: Print " ";
Color 15, 1: Locate 25, 97: Print " ";
GoTo RollDice
End If
Color 15, 1: Locate 23, 97: Print " Choose a Block to Ronove ";
Color 15, 1: Locate 25, 97: Print " ";
RemoveBlockMouseInput:
Do While _MouseInput
MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)
For Z = 1 To 4
For Y = 1 To 4
If (MouseLeftButton = -1) * (MouseX > BlockX(Z, Y) - 30) * (MouseX < BlockX(Z, Y) + 30) * (MouseY > BlockY(Z, Y) - 30) * (MouseY < BlockY(Z, Y) + 30) Then
If Block(Z, Y) = 0 Or Block(Z, Y) = Player GoTo RemoveBlockMouseInput
Row = Z: Column = Y: GoSub ButtonReleased: GoTo EndChoice2
End If
Next
Next
Loop
GoTo RemoveBlockMouseInput
EndChoice2:
F1 = Block(Row, Column): F2 = BoardColor(GameBoard, F1): Block(Row, Column) = 0
Locked(Row, Column) = 0: Locked(Row, Column + 1) = 0: Locked(Row + 1, Column) = 0: Locked(Row + 1, Column + 1) = 0
X3 = F1: Blocks(F1) = Blocks(F1) + 1: GoSub UpdateBlockStorage
Line (BlockX(Row, Column) - 30, BlockY(Row, Column) - 30)-(BlockX(Row, Column) + 30, BlockY(Row, Column) + 30), F2, BF
PSet (BlockX(Row, Column), BlockY(Row, Column)), 1: Draw Remove$(GameBoard): Remove = 0: GoTo EndTurn
End If
' Set Playable Moves to 0
For Z = 1 To 4: For Y = 1 To 4: Playable(Z, Y) = 0: Next: Next
' Check if Block Can be Placed
Block = 0
For Z = 1 To 4
For Y = 1 To 4
If Block(Z, Y) = 0 Then
T1 = BoardPiece(Z, Y): T2 = BoardRotate(Z, Y): Piece$ = Piece$(T1, T2): B1 = Val(Mid$(Piece$, 4, 1))
T1 = BoardPiece(Z, Y + 1): T2 = BoardRotate(Z, Y + 1): Piece$ = Piece$(T1, T2): B2 = Val(Mid$(Piece$, 3, 1))
T1 = BoardPiece(Z + 1, Y): T2 = BoardRotate(Z + 1, Y): Piece$ = Piece$(T1, T2): B3 = Val(Mid$(Piece$, 2, 1))
T1 = BoardPiece(Z + 1, Y + 1): T2 = BoardRotate(Z + 1, Y + 1): Piece$ = Piece$(T1, T2): B4 = Val(Mid$(Piece$, 1, 1))
If B1 = B2 And B2 = B3 And B3 = B4 And B1 = Player Then Block = 1: Playable(Z, Y) = B1
End If
Next
Next
' Block Can be Placed
If Block = 1 Then
Color 15, 1: Locate 23, 97: Print "You Have a Matching Pattern ";
Color 15, 1: Locate 25, 97: Print "Press <ENTER> to Place Block ";
GetENTER1: A$ = InKey$: If A$ = "" GoTo GetENTER1 Else If Asc(A$) <> 13 GoTo GetENTER1
GoSub PlaceBlock
End If
EndTurn:
X1 = 873: X2 = 270: Line (X1 - 35, X2 - 35)-(X1 + 35, X2 + 35), 1, BF
' Remove Messages
Color 15, 1: Locate 23, 97: Print " ";
Color 15, 1: Locate 25, 97: Print " ";
If Blocks(Player) = 0 Then Winner = Player: GoTo Winner
' Get Next Player
If Player = Players Then Player = 1 Else Player = Player + 1
GoTo StartGame
ButtonReleased:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo ButtonReleased
DrawPiece:
If GameBoard = 1 Then X5 = 0 Else X5 = 15
W3 = -60: W5 = 1
For W1 = 1 To 2
W4 = -60
For W2 = 1 To 2
X4 = BoardColor(GameBoard, Val(Mid$(Rotate$, W5, 1)))
Line (X1, X2)-(X1 + W4, X2 + W3), X4, BF
W4 = W4 + 120: W5 = W5 + 1
Next
W3 = W3 + 120
Next
Circle (X1, X2), 10, 15: Paint (X1, X2), 15
Line (X1 - 60, X2 - 60)-(X1 + 60, X2 + 60), X5, B
Return
CheckBlock:
B3 = 0: B = 0
T1 = BoardPiece(B1, B2): T2 = BoardRotate(B1, B2): Piece$ = Piece$(T1, T2): B11 = Val(Mid$(Piece$, 4, 1))
T1 = BoardPiece(B1, B2 + 1): T2 = BoardRotate(B1, B2 + 1): Piece$ = Piece$(T1, T2): B12 = Val(Mid$(Piece$, 3, 1))
T1 = BoardPiece(B1 + 1, B2): T2 = BoardRotate(B1 + 1, B2): Piece$ = Piece$(T1, T2): B13 = Val(Mid$(Piece$, 2, 1))
T1 = BoardPiece(B1 + 1, B2 + 1): T2 = BoardRotate(B1 + 1, B2 + 1): Piece$ = Piece$(T1, T2): B14 = Val(Mid$(Piece$, 1, 1))
If B11 = B12 And B12 = B13 And B13 = B14 Then
If Block(B1, B2) = 0 Then
If Setup = 1 Then SetUpBlock = 1
If B11 = Player Then Block = 1: HasBlock(B11) = 1: Playable(B1, B2) = B11
End If
If Block(B1, B2) > 0 Then If Block(B1, B2) = Player Then Remove = 0 Else If Block(B1, B2) <> Player Then Remove = 1
End If
Return
UpdateBlockStorage:
Line (765, 420)-(985, 720), 1, BF
X2 = 450
For Z1 = 1 To Players
If Blocks = 2 Then X1 = 838 Else X1 = 795
For Z2 = 1 To Blocks(Z1)
X3 = Z1: GoSub DrawBlock
X1 = X1 + 80
Next
X2 = X2 + 80
Next
Return
PlaceBlock:
For Z = 1 To 4
For Y = 1 To 4
If Playable(Z, Y) = Player And Block(Z, Y) = 0 Then
Locked(Z, Y) = 1: Locked(Z, Y + 1) = 1: Locked(Z + 1, Y) = 1: Locked(Z + 1, Y + 1) = 1
Blocks(Player) = Blocks(Player) - 1: GoSub UpdateBlockStorage: Playable(Z, Y) = 0
Block(Z, Y) = Player: X1 = BlockX(Z, Y): X2 = BlockY(Z, Y): X3 = Player: GoSub DrawBlock
End If
Next
Next
Return
DrawBlock:
For C = 1 To 2
If C = 1 Then C1 = 11: C2 = 11 Else C1 = 0: C2 = PlayerColor(GameBoard, X3)
Line (X1 - 20, X2 - 30)-(X1 + 20, X2 - 30), C1
Line (X1 - 20, X2 + 30)-(X1 + 20, X2 + 30), C1
Line (X1 - 30, X2 - 20)-(X1 - 30, X2 + 20), C1
Line (X1 + 30, X2 - 20)-(X1 + 30, X2 + 20), C1
Circle (X1 - 20, X2 - 20), 10, C1, 1.5, 3.1
Circle (X1 + 20, X2 - 20), 10, C1, 0, 1.7
Circle (X1 - 20, X2 + 20), 10, C1, 3.1, 4.8
Circle (X1 + 20, X2 + 20), 10, C1, 4.6, 0
Paint (X1, X2), C2, C1
Next
Return
DrawDice:
Line (X1 - 35, X2 - 35)-(X1 + 35, X2 + 35), 1, BF
Line (X1 - 25, X2 - 35)-(X1 + 25, X2 - 35), 0
Line (X1 - 25, X2 + 35)-(X1 + 25, X2 + 35), 0
Line (X1 - 35, X2 - 25)-(X1 - 35, X2 + 25), 0
Line (X1 + 35, X2 - 25)-(X1 + 35, X2 + 25), 0
Circle (X1 - 25, X2 - 25), 10, 0, 1.5, 3.1
Circle (X1 + 25, X2 - 25), 10, 0, 0, 1.7
Circle (X1 - 25, X2 + 25), 10, 0, 3.1, 4.8
Circle (X1 + 25, X2 + 25), 10, 0, 4.6, 0
Paint (X1, X2), 15, 0
If X3 < 5 Then
Circle (X1, X2 - 3), 17, 0: Paint (X1, X2 - 3), 0: Circle (X1, X2 - 3), 15, 15: Paint (X1, X2 - 3), 15
If X3 = 1 Or X3 = 3 Then Line (X1 + 20, X2 - 3)-(X1, X2 - 25), 15, BF: PSet (X1, X2 - 17), 0: Draw "U10F8G8U10BR3P0,0"
If X3 = 2 Or X3 = 4 Then Line (X1 - 20, X2 - 3)-(X1, X2 - 25), 15, BF: PSet (X1, X2 - 17), 0: Draw "U10G8F8U10BL3P0,0"
Color 0, 15: Locate 19, 109: If X3 < 3 Then Print "1x"; Else Print "2x";
End If
If X3 = 5 Then PSet (X1, X2 + 10), 0: Draw "NU40R20U20NL40BG5P0,0E5U20L40D20BE5P0,0G5D20R20BD7NL15R20D1L35D5H5E5D5BL2P0,0BL3BD7R35D1NL35D5E5H5D5BR2P0,0"
If X3 = 6 Then PSet (X1, X2 - 5), 2: Draw "E15R15G20F20L15H15G15L15E20H20R15F15BD5P2,2BL18BU8C0D25R25U25L25E10R25NG10D25G10"
Return
Winner:
X1 = 873: X2 = 100: X3 = Winner: GoSub DrawBlock
Color 15, 1: Locate 10, 106: Print "Player:"; Winner;
Color 15, 1: Locate 23, 97: Print " Player"; Winner; "is the Winner! ";
Color 15, 1: Locate 25, 97: Print "Play Another Game? (Y or N) ";
GetYorN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
If A$ = "Y" Then Run
If A$ = "N" Then System
If Asc(A$) <> 13 GoTo GetYorN