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

I've complete another game I wrote on the Tandy 2000 about 30 years ago. Outwit is a 2 player board game.

From the instruction sheet:
"EQUIPMENT: 1 playing board with 90 squares, including two corners of 9 squares each. 18 chips (9 dark and 9 light), one chip on each side has a dot on it, called the "power chip".
OBJECT: To be the first to slide all nine of your chips into your own corner of the board."
The chips are setup in the middle of the board at start. Each player plays alternately one chip in one direction only. a regular chip may move horizontally or vertically only. A power chip may move also diagonally. A regular chip must slide as far as it can go. Stopped only by reaching the edge of the board, another chip or the opponent's corner. A power chip can stop whenever it wants, but must stop for the same reasons as a regular chip.

Donald

   

Code: (Select All)
Option _Explicit

' I used a code snippet by bplus modified to enlarge the characters on the screen.

_Title "Outwit - Designer Unknown 1975 - Programmed by Donald L. Foster Jr. 2018 - Code Snippet by bplus"

Screen _NewImage(1084, 735, 256)

_PaletteColor 1, _RGB32(204, 124, 56) ' Player 1 Piece Color
_PaletteColor 2, _RGB32(109, 39, 0) ' Player 2 Piece Color
_PaletteColor 3, _RGB32(205, 76, 0) ' Board Background Color
_PaletteColor 4, _RGB32(245, 116, 0) ' Board Square Color
_PaletteColor 5, _RGB32(245, 205, 0) ' Player 1 Corner Color
_PaletteColor 6, _RGB32(139, 69, 19) ' Player 2 Corner Color
_PaletteColor 7, _RGB32(255, 215, 0) ' Gold Piece Color
_PaletteColor 8, _RGB32(80, 80, 80) ' Cursor Color

_Limit 10

Dim A As String
Dim U As _Unsigned Integer
Dim V As _Unsigned Integer
Dim W As _Unsigned Integer
Dim X As _Unsigned Integer
Dim Y As _Unsigned _Byte
Dim Z As _Unsigned _Byte

Dim X1 As _Unsigned Integer
Dim X2 As _Unsigned Integer
Dim X3 As _Unsigned Integer
Dim X4 As _Unsigned Integer

Dim Player As _Unsigned _Byte
Dim Opponent As _Unsigned _Byte
Dim Winner As _Unsigned _Byte
Dim Square As _Unsigned _Byte
Dim SquareColor1 As _Unsigned _Byte
Dim SquareColor2 As _Unsigned _Byte

Dim BoardX1 As _Unsigned Integer
Dim BoardY1 As _Unsigned Integer
Dim BoardX2 As _Unsigned Integer
Dim BoardY2 As _Unsigned Integer

Dim Piece As _Unsigned _Byte

Dim Row1 As _Unsigned _Byte
Dim Column1 As _Unsigned _Byte
Dim Row2 As _Unsigned _Byte
Dim Column2 As _Unsigned _Byte

Dim PlayerColor(2) As Integer
Dim Pieces(2) As _Unsigned _Byte

Dim BoardX(9, 10) As _Unsigned Integer
Dim BoardY(9, 10) As _Unsigned Integer
Dim BoardPlayer(9, 10) As _Unsigned _Byte
Dim BoardPiece(9, 10) As _Unsigned _Byte
Dim BoardSquare(9, 10) As _Unsigned _Byte
Dim Playable(9, 10) As _Unsigned _Byte


Dim Cursor As String
Dim Message As String

Player = 1: Opponent = 2
Pieces(1) = 0: Pieces(2) = 0
PlayerColor(1) = 1: PlayerColor(2) = 2

Cursor$ = "BU36BL36C15D72R72U72L72BF2D68R68U68L68BH1P15,15"

Cls , 15

' Draw Game Title Message
Message$ = " Outwit ": X1 = 815: X2 = 2: X3 = 0: X4 = 4: GoSub DrawMessage
Line (0, 0)-(100, 30), 15, BF

' Draw Board
Line (10, 30)-(10, 702), 0
Line (799, 30)-(799, 702), 0
Line (30, 10)-(779, 10), 0
Line (30, 722)-(779, 722), 0
Circle (30, 30), 20, 0, 1.4, 3.1
Circle (779, 30), 20, 0, 0, 1.6
Circle (30, 702), 20, 0, 2.9, 4.72
Circle (779, 702), 20, 0, 4.52, 0
Paint (30, 30), 3, 0
Line (28, 28)-(781, 706), 0, BF
X = 67: U = 9
For Z = 1 To 9
W = 67
For Y = 1 To 10
If Z < 4 And Y < 4 Then V = 6 Else If Z > 6 And Y > 7 Then V = 5 Else V = 4
Line (W - 36, X - 36)-(W + 36, X + 36), V, BF
If V = 6 Then BoardSquare(Z, Y) = 2 Else If V = 5 Then BoardSquare(Z, Y) = 1 Else BoardSquare(Z, Y) = 0
If Y = U Then BoardPlayer(Z, Y) = 1: BoardPiece(Z, Y) = 1: BoardSquare(Z, Y) = 3: Circle (W, X), 30, 0: Paint (W, X), 1, 0
If Y = U + 1 Then BoardPlayer(Z, Y) = 2: BoardPiece(Z, Y) = 1: BoardSquare(Z, Y) = 4: Circle (W, X), 30, 0: Paint (W, X), 2, 0
If Z = 5 And (Y = 5 Or Y = 6) Then BoardPiece(Z, Y) = 2: Circle (W, X), 13, 7: Paint (W, X), 7
BoardX(Z, Y) = W: BoardY(Z, Y) = X
W = W + 75
Next
X = X + 75: U = U - 1
Next


StartGame:

' Draw Player Indicator
Circle (941, 130), 30, 0: Paint (941, 130), PlayerColor(Player), 0: Circle (941, 130), 13, 7: Paint (941, 130), 7
Locate 12, 115: Print "Player"; Player;


StartMove: Locate 16, 105: Print " Choose a Piece to Move. ";

ChooseAPieceInput:
Do While _MouseInput
For Z = 1 To 9
For Y = 1 To 10
If _MouseButton(1) = -1 And _MouseX > BoardX(Z, Y) - 44 And _MouseX < BoardX(Z, Y) + 44 And _MouseY > BoardY(Z, Y) - 44 And _MouseY < BoardY(Z, Y) + 44 Then
If BoardPlayer(Z, Y) = Player Then Row1 = Z: Column1 = Y: GoSub ReleaseMouseButton: GoTo EndChoice1
End If
Next
Next
Loop
GoTo ChooseAPieceInput

EndChoice1:
Piece = BoardPiece(Row1, Column1): Square = BoardSquare(Row1, Column1): BoardX1 = BoardX(Row1, Column1): BoardY1 = BoardY(Row1, Column1)
If Square = 1 Then SquareColor1 = 5 Else If Square = 2 Then SquareColor1 = 6 Else SquareColor1 = 4

V = Point(BoardX1, BoardY1): PSet (BoardX1, BoardY1), V: Draw Cursor$

For Z = 1 To 9: For Y = 1 To 10: Playable(Z, Y) = 0: Next: Next

Playable(Row1, Column1) = 1

X = 0
CheckUp:
If Row1 - X - 1 >= 1 Then
If BoardPlayer(Row1 - X - 1, Column1) > 0 GoTo EndUp
If Square = 1 Then
If BoardSquare(Row1 - X - 1, Column1) = 0 GoTo EndUp
X = X + 1: GoTo CheckUp
Else
If BoardSquare(Row1 - X - 1, Column1) = 2 And Player = 1 GoTo EndUp
If Piece = 2 Then Playable(Row1 - X, Column1) = 1
X = X + 1: GoTo CheckUp
End If
EndUp: Playable(Row1 - X, Column1) = 1
Else
Playable(Row1 - X, Column1) = 1
End If

X = 0
CheckLeft:
If Column1 - X - 1 >= 1 Then
If BoardPlayer(Row1, Column1 - X - 1) > 0 GoTo EndLeft
If Square = 1 Then
If BoardSquare(Row1, Column1 - X - 1) = 0 GoTo EndLeft
X = X + 1: GoTo CheckLeft
Else
If BoardSquare(Row1, Column1 - X - 1) = 2 And Player = 1 GoTo EndLeft
If Piece = 2 Then Playable(Row1, Column1 - X - 1) = 1
X = X + 1: GoTo CheckLeft
End If
EndLeft: Playable(Row1, Column1 - X) = 1
Else
Playable(Row1, Column1 - X) = 1
End If


X = 0
CheckDown:
If Row1 + X + 1 <= 9 Then
If BoardPlayer(Row1 + X + 1, Column1) > 0 GoTo EndDown
If Square = 2 Then
If BoardSquare(Row1 + X + 1, Column1) = 0 GoTo EndDown
X = X + 1: GoTo CheckDown
Else
If BoardSquare(Row1 + X + 1, Column1) = 1 And Player = 2 GoTo EndDown
If Piece = 2 Then Playable(Row1 + X + 1, Column1) = 1
X = X + 1: GoTo CheckDown
End If
EndDown: Playable(Row1 + X, Column1) = 1
Else
Playable(Row1 + X, Column1) = 1
End If

X = 0
CheckRight:
If Column1 + X + 1 <= 10 Then
If BoardPlayer(Row1, Column1 + X + 1) > 0 GoTo EndRight
If Square = 2 Then
If BoardSquare(Row1, Column1 + X + 1) = 0 GoTo EndRight
X = X + 1: GoTo CheckRight
Else
If BoardSquare(Row1, Column1 + X + 1) = 1 And Player = 2 GoTo EndRight
If Piece = 2 Then Playable(Row1, Column1 + X + 1) = 1
X = X + 1: GoTo CheckRight
End If
EndRight: Playable(Row1, Column1 + X) = 1
Else
Playable(Row1, Column1 + X) = 1
End If

If Piece = 2 Then
X = 0
CheckUpLeft:
If Row1 - X - 1 >= 1 And Column1 - X - 1 >= 1 Then
If BoardPlayer(Row1 - X - 1, Column1 - X - 1) > 0 GoTo EndUpLeft
If Square = 1 Then
If BoardSquare(Row1 - X - 1, Column1 - X - 1) = 0 GoTo EndUpLeft
X = X + 1: GoTo CheckUpLeft
Else
If BoardSquare(Row1 - X - 1, Column1 - X - 1) = 2 And Player = 1 GoTo EndUpLeft
Playable(Row1 - X - 1, Column1 - X - 1) = 1: X = X + 1: GoTo CheckUpLeft
End If
EndUpLeft: Playable(Row1 - X, Column1 - X) = 1
Else
Playable(Row1 - X, Column1 - X) = 1
End If

X = 0
CheckDownLeft:
If Row1 + X + 1 <= 9 And Column1 - X - 1 >= 1 Then
If BoardPlayer(Row1 + X + 1, Column1 - X - 1) > 0 GoTo EndDownLeft
If Square = 1 Then
If BoardSquare(Row1 + X + 1, Column1 - X - 1) = 0 GoTo EndDownLeft
X = X + 1: GoTo CheckDownLeft
Else
If BoardSquare(Row1 + X + 1, Column1 - X - 1) = 2 And Player = 1 GoTo EndDownLeft
If BoardSquare(Row1 + X + 1, Column1 - X - 1) = 1 And Player = 2 GoTo EndDownLeft
Playable(Row1 + X + 1, Column1 - X - 1) = 1: X = X + 1: GoTo CheckDownLeft
End If
EndDownLeft: Playable(Row1 + X, Column1 - X) = 1
Else
Playable(Row1 + X, Column1 - X) = 1
End If

X = 0
CheckDownRight:
If Row1 + X + 1 <= 9 And Column1 + X + 1 <= 10 Then
If BoardPlayer(Row1 + X + 1, Column1 + X + 1) > 0 GoTo EndDownRight
If Square = 1 Then
If BoardSquare(Row1 + X + 1, Column1 + X + 1) = 0 GoTo EndDownRight
X = X + 1: GoTo CheckDownRight
Else
If BoardSquare(Row1 + X + 1, Column1 + X + 1) = 1 And Player = 2 GoTo EndDownRight
Playable(Row1 + X + 1, Column1 + X + 1) = 1: X = X + 1: GoTo CheckDownRight
End If
EndDownRight: Playable(Row1 + X, Column1 + X) = 1
Else
Playable(Row1 + X, Column1 + X) = 1
End If

X = 0
CheckUpRight:
If Row1 - X - 1 >= 1 And Column1 + X + 1 <= 10 Then
If BoardPlayer(Row1 - X - 1, Column1 + X + 1) > 0 GoTo EndUpRight
If Square = 1 Then
If BoardSquare(Row1 - X - 1, Column1 + X + 1) = 0 GoTo EndUpRight
X = X + 1: GoTo CheckUpRight
Else
If BoardSquare(Row1 - X - 1, Column1 + X + 1) = 1 And Player = 2 GoTo EndUpRight
If BoardSquare(Row1 - X - 1, Column1 + X + 1) = 2 And Player = 1 GoTo EndUpRight
Playable(Row1 - X - 1, Column1 + X + 1) = 1: X = X + 1: GoTo CheckUpRight
End If
EndUpRight: Playable(Row1 - X, Column1 + X) = 1
Else
Playable(Row1 - X, Column1 + X) = 1
End If
End If

Locate 16, 105: Print "Choose Location to Move to.";

ChooseALocationInput:
Do While _MouseInput
For Z = 1 To 9
For Y = 1 To 10
If _MouseButton(1) = -1 And _MouseX > BoardX(Z, Y) - 44 And _MouseX < BoardX(Z, Y) + 44 And _MouseY > BoardY(Z, Y) - 44 And _MouseY < BoardY(Z, Y) + 44 Then
If Playable(Z, Y) = 1 Then Row2 = Z: Column2 = Y: GoSub ReleaseMouseButton: GoTo EndChoice2
End If
Next
Next
Loop
GoTo ChooseALocationInput

EndChoice2:
If Row1 = Row2 And Column1 = Column2 Then Paint (BoardX1 - 36, BoardY1 - 36), SquareColor1, 0: GoTo StartMove

BoardX2 = BoardX(Row2, Column2): BoardY2 = BoardY(Row2, Column2)

If BoardSquare(Row2, Column2) = 1 Then SquareColor2 = 5 Else If BoardSquare(Row2, Column2) = 2 Then SquareColor2 = 6 Else SquareColor2 = 4
Line (BoardX2 - 36, BoardY2 - 36)-(BoardX2 + 36, BoardY2 + 36), SquareColor2, BF

BoardPlayer(Row2, Column2) = Player: BoardPiece(Row2, Column2) = Piece
BoardPlayer(Row1, Column1) = 0: BoardPiece(Row1, Column1) = 0

Line (BoardX1 - 36, BoardY1 - 36)-(BoardX1 + 36, BoardY1 + 36), SquareColor1, BF

If Square > 2 Then
If Piece = 2 Then Circle (BoardX1, BoardY1), 30, 0: 'PAINT (BoardX1, BoardY1), 7
V = Square + 2: Circle (BoardX1, BoardY1), 13, 0: Paint (BoardX1, BoardY1), V, 0
End If

Line (BoardX2 - 36, BoardY2 - 36)-(BoardX2 + 36, BoardY2 + 36), SquareColor2, BF
Circle (BoardX2, BoardY2), 30, 0: Paint (BoardX2, BoardY2), PlayerColor(Player), 0
If Piece = 2 Then Circle (BoardX2, BoardY2), 13, 7: Paint (BoardX2, BoardY2), 7

If (Square = 0 Or Square = 3 Or Square = 4) And BoardSquare(Row2, Column2) = Player Then Pieces(Player) = Pieces(Player) + 1

If Pieces(Player) = 9 Then GoTo Winner

Swap Player, Opponent: GoTo StartGame


DrawMessage:
Color 0, 15: Locate 1, 1: Print Message$;
W = 8 * Len(Message$): X = 16

For Y = 0 To X
For Z = 0 To W
If Point(Z, Y) <> 15 Then Line (X1 + Z * X4, X2 + Y * X4)-(X1 + Z * X4 + X4, X2 + Y * X4 + X4), 0, BF
Next
Next
Return


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


Winner:
Locate 16, 105: Print " Player"; Player; "is the Winner! ";

Locate 18, 104: Print "Play Another Game? ( Y or N )";

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


Messages In This Thread
Outwit Board Game - by SMcNeill - 12-23-2023, 11:48 PM
RE: Outwit Board Game - by mnrvovrfc - 12-24-2023, 02:11 AM



Users browsing this thread: 1 Guest(s)