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

Quixo is a 2 player abstract board game played with 25 woodeb cube blocks arranged in a 5 X 5 square with the blank sides of the cube facing up. Player 1 is the X on 1 side of the cube and player 2 is the O on the other side. There are 4 blank sides which are neutral sides.

The object of the game is to get 5 pieces in a row with your side facing up, horizontal, vertical or diagnol.

How to play:
On your turn, pick uo 1 of the blocks on 1 of the sides with your symbol or the neutral piece pattern facing up and remove it form it's location. Then place that block with your symbol facing up on 1 of the opposite sides of the board by clicking on 1 of the arrows that will appear on the outside of the board pointing to a piece that will push that your piece into the row of pieces and causing that row to shift their position to the next location until the empty location, where you took your piece from, is filled. Arrow appear to show your legal moves. you are not allowed to place the piece back where you just took it from and your not allowed to pick up a pieces with you opponent's symbol on top.

You win by getting 5 pieces of your symbol in a row, how if on your move you shift your opponents pieces and causes them to get 5 of their pieces facing up in a row, they win the game even if you made a 5 in a row for yourself also.

Hope you enjoy playing,

Donald

   

Code: (Select All)
_Title "QUIXO - Designed by Thierry Chapeau 1995 - Programmed by Donald L. Foster Jr. 2017"

Screen _NewImage(1025, 735, 256)

_PaletteColor 1, _RGB32(109, 39, 0) ' background
_PaletteColor 2, _RGB32(205, 134, 66) ' LT Square
_PaletteColor 3, _RGB32(184, 104, 36) ' MED Piece
_PaletteColor 4, _RGB32(154, 74, 6) ' DK Piece

DefInt A-Z

Player = 1: Opponant = 2: Move = 0

Arrow$ = "BU25C15L15D25L15F30E30L15U25L15BD10P0,15"
B$(1) = "TA0": B$(2) = "TA90": B$(3) = "TA180": B$(4) = "TA270"


Line (0, 0)-(1025, 735), 1, BF

' Draw Board
X = 0
For Z = 1 To 7
W = 0
For Y = 1 To 7
Line (55 - 51 + W, 55 - 51 + X)-(55 + 51 + W, 55 + 51 + X), 1, B
Board(Z, Y) = 0: X1 = 55 + W: X2 = 55 + X: X3 = 0
If Z > 1 And Z < 7 And Y > 1 And Y < 7 Then Board(Z, Y) = 2: BoardPlayer(Z, Y) = 0: GoSub DrawPiece
If Z = 2 And Y > 1 And Y < 7 Then X3 = 1: Board(Z, Y) = 1
If Y = 2 And Z > 1 And Z < 7 Then X3 = 2: Board(Z, Y) = 1
If Z = 6 And Y > 1 And Y < 7 Then X3 = 3: Board(Z, Y) = 1
If Y = 6 And Z > 1 And Z < 7 Then X3 = 4: Board(Z, Y) = 1
BoardX(Z, Y) = 55 + W: BoardY(Z, Y) = 55 + X
W = W + 104
Next
X = X + 104
Next

Color 15, 1: Locate 2, 100: Print "Q U I X O";

StartGame:

' Draw Player Indicator
X1 = 873: X2 = 159: X3 = Player: GoSub DrawPiece
Color 15, 1: Locate 15, 106: Print "Player:"; Player;

Color 15, 1: Locate 45, 97: Print " Choose a Piece to Remove ";

ChooseALocationMouseInput:
Do While _MouseInput
MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)

For Z = 1 To 7
For Y = 1 To 7
If (MouseLeftButton = -1) * (MouseX > BoardX(Z, Y) - 51) * (MouseX < BoardX(Z, Y) + 51) * (MouseY > BoardY(Z, Y) - 51) * (MouseY < BoardY(Z, Y) + 51) Then
If Board(Z, Y) = 1 And BoardPlayer(Z, Y) <> Opponant Then Row = Z: Column = Y: GoTo EndChoice1
End If
Next
Next
Loop
GoTo ChooseALocationMouseInput

EndChoice1:

' Remove Piece from Board
Line (BoardX(Z, Y) - 51, BoardY(Z, Y) - 51)-(BoardX(Z, Y) + 51, BoardY(Z, Y) + 51), 1, BF

' Draw Piece Under Indicator
X1 = 873: X2 = 367: X3 = Player: GoSub DrawPiece

' Set Arrows to 0
For Z = 2 To 6: Arrow(1, Z) = 0: Arrow(7, Z) = 0: Arror(Z, 1) = 0: Arrow(Z, 7) = 0: Next

' Get Arrows
If Row = 2 And Column = 2 Then Arrow(2, 7) = 4: Arrow(7, 2) = 3: GoTo DrawArrows
If Row = 2 And Column = 6 Then Arrow(2, 1) = 2: Arrow(7, 6) = 3: GoTo DrawArrows
If Row = 6 And Column = 2 Then Arrow(6, 7) = 4: Arrow(1, 2) = 1: GoTo DrawArrows
If Row = 6 And Column = 6 Then Arrow(6, 1) = 2: Arrow(1, 6) = 1: GoTo DrawArrows
If Row = 2 Then Arrow(2, 1) = 2: Arrow(2, 7) = 4: Arrow(7, Column) = 3
If Row = 6 Then Arrow(6, 1) = 2: Arrow(6, 7) = 4: Arrow(1, Column) = 1
If Column = 2 Then Arrow(1, 2) = 1: Arrow(7, 2) = 3: Arrow(Row, 7) = 4
If Column = 6 Then Arrow(1, 6) = 1: Arrow(7, 6) = 3: Arrow(Row, 1) = 2

DrawArrows:
For Z = 1 To 7
For Y = 1 To 7
If Arrow(Z, Y) > 0 Then X1 = BoardX(Z, Y): X2 = BoardY(Z, Y): X3 = Arrow(Z, Y): GoSub DrawArrow
Next
Next

' Choose Arrow
Color 15, 1: Locate 45, 97: Print "Choose Arrow to Place Piece";

GetArrowInput:
Do While _MouseInput
MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)

For Z = 1 To 7
For Y = 1 To 7
If (Arrow(Z, Y) > 0) * (MouseX > BoardX(Z, Y) - 40) * (MouseX < BoardX(Z, Y) + 40) * (MouseY > BoardY(Z, Y) - 40) * (MouseY < BoardY(Z, Y) + 40) Then
CanSelect = 1: Line (BoardX(Z, Y) - 40, BoardY(Z, Y) - 40)-(BoardX(Z, Y) + 40, BoardY(Z, Y) + 40), 15, B
ElseIf Board(Z, Y) = 0 Then
CanSelect = 0: Line (BoardX(Z, Y) - 40, BoardY(Z, Y) - 40)-(BoardX(Z, Y) + 40, BoardY(Z, Y) + 40), 1, B
End If
If MouseLeftButton = -1 And CanSelect = 1 Then Row2 = Z: Column2 = Y: Arrow = Arrow(Z, Y): GoTo EndChoice2
Next
Next
Loop
GoTo GetArrowInput

EndChoice2:

' Shift Pieces on Board
If Arrow = 1 Then
X = 0
Arrow1: If Row - X - 1 = 1 Then W1 = 2: W2 = Column: GoTo MovePieceToBoard
BoardPlayer(Row - X, Column) = BoardPlayer(Row - X - 1, Column)
X1 = BoardX(Row - X, Column): X2 = BoardY(Row - X, Column): X3 = BoardPlayer(Row - X, Column): GoSub DrawPiece: X = X + 1: GoTo Arrow1
End If

If Arrow = 2 Then
X = 0
Arrow2: If Column - X - 1 = 1 Then W1 = Row: W2 = 2: GoTo MovePieceToBoard
BoardPlayer(Row, Column - X) = BoardPlayer(Row, Column - X - 1)
X1 = BoardX(Row, Column - X): X2 = BoardY(Row, Column - X): X3 = BoardPlayer(Row, Column - X): GoSub DrawPiece: X = X + 1: GoTo Arrow2
End If

If Arrow = 3 Then
X = 0
Arrow3: If Row + X + 1 = 7 Then W1 = 6: W2 = Column: GoTo MovePieceToBoard
BoardPlayer(Row + X, Column) = BoardPlayer(Row + X + 1, Column)
X1 = BoardX(Row + X, Column): X2 = BoardY(Row + X, Column): X3 = BoardPlayer(Row + X, Column): GoSub DrawPiece: X = X + 1: GoTo Arrow3
End If

If Arrow = 4 Then
X = 0
Arrow4: If Column + X + 1 = 7 Then W1 = Row: W2 = 6: GoTo MovePieceToBoard
BoardPlayer(Row, Column + X) = BoardPlayer(Row, Column + X + 1)
X1 = BoardX(Row, Column + X): X2 = BoardY(Row, Column + X): X3 = BoardPlayer(Row, Column + X): GoSub DrawPiece: X = X + 1: GoTo Arrow4
End If

MovePieceToBoard:
Line (822, 316)-(924, 418), 1, BF
BoardPlayer(W1, W2) = Player: X1 = BoardX(W1, W2): X2 = BoardY(W1, W2): X3 = Player: GoSub DrawPiece

' Remove Arrows
For Z = 1 To 7
For Y = 1 To 7
If Arrow(Z, Y) > 0 Then Arrow(Z, Y) = 0: Line (BoardX(Z, Y) - 51, BoardY(Z, Y) - 51)-(BoardX(Z, Y) + 51, BoardY(Z, Y) + 51), 1, BF
Next
Next

' Check for Winner
Winner = 0: Winner(1) = 0: Winner(2) = 0
For Z = 2 To 6
If BoardPlayer(Z, 2) = BoardPlayer(Z, 3) And BoardPlayer(Z, 3) = BoardPlayer(Z, 4) And BoardPlayer(Z, 4) = BoardPlayer(Z, 5) And BoardPlayer(Z, 5) = BoardPlayer(Z, 6) Then Winner(BoardPlayer(Z, 2)) = 1
If BoardPlayer(2, Z) = BoardPlayer(3, Z) And BoardPlayer(3, Z) = BoardPlayer(4, Z) And BoardPlayer(4, Z) = BoardPlayer(5, Z) And BoardPlayer(5, Z) = BoardPlayer(6, Z) Then Winner(BoardPlayer(2, Z)) = 1
Next
If BoardPlayer(2, 2) = BoardPlayer(3, 3) And BoardPlayer(3, 3) = BoardPlayer(4, 4) And BoardPlayer(4, 4) = BoardPlayer(5, 5) And BoardPlayer(5, 5) = BoardPlayer(6, 6) Then Winner(BoardPlayer(Z, 2)) = 1
If BoardPlayer(2, 6) = BoardPlayer(3, 5) And BoardPlayer(3, 5) = BoardPlayer(4, 4) And BoardPlayer(4, 4) = BoardPlayer(5, 3) And BoardPlayer(5, 3) = BoardPlayer(6, 2) Then Winner(BoardPlayer(2, 6)) = 1

' Is there a Winner?
If Winner(Opponant) = 1 Then Winner = Opponant Else If Winner(Player) Then Winner = Player
If Winner > 0 Then GoTo Winner

Swap Player, Opponant: GoTo StartGame


DrawPiece:
Line (X1 - 51, X2 - 51)-(X1 + 51, X2 + 51), 1, BF: V = 3
Line (X1 - 41, X2 - 51)-(X1 + 41, X2 - 51), 3
Line (X1 - 51, X2 - 41)-(X1 - 51, X2 + 41), 3
Line (X1 - 41, X2 + 51)-(X1 + 41, X2 + 51), 3
Line (X1 + 51, X2 - 41)-(X1 + 51, X2 + 41), 3
Circle (X1 - 41, X2 - 41), 10, 3, 1.5, 3.1
Circle (X1 - 41, X2 + 41), 10, 3, 3.1, 4.8
Circle (X1 + 41, X2 + 41), 10, 3, 4.6, 0
Circle (X1 + 41, X2 - 41), 10, 3, 0, 1.7
PSet (X1 - 41, X2 - 41), 3: Draw "TA0D83NG6R83U83NE6L83BL5BD10P2,3BR45P3,3BR48P4,3"

If X3 = 1 Then
Circle (X1 - 94, X2 - 94), 140, 0, 5.17, 5.82: Circle (X1 + 94, X2 + 94), 140, 0, 2.02, 2.68: Paint (X1, X2), 0
Circle (X1 - 94, X2 + 94), 140, 0, .46, 1.11: Circle (X1 + 94, X2 - 94), 140, 0, 3.6, 4.26: Paint (X1 - 20, X2 - 20), 0: Paint (X1 + 20, X2 + 20), 0
PSet (X1, X2 + 23), 0: Draw "TA0G5F5E5H5BD3P0,0"
ElseIf X3 = 2 Then
Circle (X1, X2), 34, 0: Circle (X1, X2), 31, 0, , , 1.4: Paint (X1 + 28, X2), 0
Circle (X1, X2 + 22), 5, 0: Paint (X1, X2 + 22), 0
End If
Return


DrawArrow:
PSet (X1, X2), 1: Draw B$(X3) + Arrow$
Return


Winner:
X1 = 873: X2 = 159: X3 = Winner: GoSub DrawPiece
Color 15, 1: Locate 15, 106: Print "Player:"; Winner;

Color 15, 1: Locate 43, 97: Print " Player"; Winner; "is the Winner! ";
Color 15, 1: Locate 45, 97: Print " Play Another Game? Y or N ";
GetYesNo: A$ = UCase$(InKey$): If A$ = "" GoTo GetYesNo
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo GetYesNo
Reply


Messages In This Thread
Quixo - by SMcNeill - 12-23-2023, 11:43 PM



Users browsing this thread: 1 Guest(s)