_Title "Connection Board Game - Programmed by Donald L. Foster Jr. 2020-2021"
Dim As Integer Player
, Opponent
, Row
, Column
, Progress
, Counter
Dim As Integer BoardX
(13, 13), BoardY
(13, 13), BoardPlayer
(13, 13), Checked
(13, 13)
Player = 1: Opponent = 2: Counter = 1: StartingX = 456: StartingY = 67
PlayerColor(1) = 1: PlayerColor(2) = 2
BoardHex$ = "C0TA0BL33D19TA60D38TA120D38TA180D38TA240D38TA300D38TA0D19"
' Draw Game Board
PSet (43, 74), 0:
Draw "TA0D37TA60D36TA0D37TA60D36TA0D37TA60D35TA0D37TA60D36TA0D37TA60D36TA0D37TA60D36TA0D37TA60D36TA0D37TA60D35TA0D37TA60D36TA0D37TA60D36TA0D38" Draw "TA60D37TA120D37TA60D36TA120D36TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D36TA120D37" Draw "TA0U37TA240D36TA0U37TA240D35TA0U36TA240D36TA0U37TA240D36TA0U37TA240D36TA0U37TA240D36TA0U37TA240D37TA0U37TA240D36TA0U37TA240D36TA0U37TA240D36TA0U39" Draw "TA240D36TA300D36TA240D36TA300D36TA240D36TA300D36TA240D36TA300D37TA240D37TA300D36TA240D36TA300D36TA240D37TA300D37TA240D36TA300D36TA240D36TA300D37TA240D37TA300D36TA240D36TA300D37" Draw "TA240D20TA330D30TA29.5D699TA150ND30TA0R699TA330U30TA240ND28TA330U28TA29.5U699TA150NU30TA0L699TA330D30TA0BD10P1,0BE20P2,0BR695P1,0BD630P2,0" X = 92: Increase = 0: Indent = 0
Starting = 75
PSet (Starting
+ Indent
+ Increase
, X
), 15:
Draw "C0TA0BL31BU18D36TA60D36TA120D36TA180D36TA240D36TA300D36BR10P3,0" ' CIRCLE (Starting + Indent + Increase, X), 28, 0
BoardX(Z, Y) = Starting + Indent + Increase: BoardY(Z, Y) = X
If Y
= 11 Then Indent
= Indent
+ 31: Increase
= 0 Else Increase
= Increase
+ 63 X = X + 55
StartGame:
' Draw Player Indicator
PSet (943, 100), 15:
Draw BoardHex$:
Paint (943, 100), PlayerColor
(Player
), 0 X1
= 943: X2
= 100: X3
= Player:
GoSub DrawPiece
Locate 44, 5:
Print "Choose Location to Place Your Piece";
GetLocation:
GoSub ReleaseButton: BoardPlayer
(Z
, Y
) = Player: X1
= BoardX
(Z
, Y
): X2
= BoardY
(Z
, Y
): X3
= Player:
GoSub DrawPiece: Row
= Z: Column
= Y:
GoTo CheckForWinner
CheckForWinner:
If Player
= 1 Then Row
= V: Column
= 1 Else Row
= 1: Column
= V
If BoardPlayer
(Row
, Column
) = Player
Then Progress = 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1
CheckWinner:
If (Player
= 1 And Column
= 11) Or (Player
= 2 And Row
= 11) GoTo Winner
' Check Right
If BoardPlayer
(Row
, Column
+ 1) = Player
And Checked
(Row
, Column
+ 1) = 0 Then Progress
= Progress
+ 1: Column
= Column
+ 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
' Check Down
If BoardPlayer
(Row
+ 1, Column
) = Player
And Checked
(Row
+ 1, Column
) = 0 Then Progress
= Progress
+ 1: Row
= Row
+ 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
' Check Left
If BoardPlayer
(Row
, Column
- 1) = Player
And Checked
(Row
, Column
- 1) = 0 Then Progress
= Progress
+ 1: Column
= Column
- 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
' Check Up
If BoardPlayer
(Row
- 1, Column
) = Player
And Checked
(Row
- 1, Column
) = 0 Then Progress
= Progress
+ 1: Row
= Row
- 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
' Check Down Left
If BoardPlayer
(Row
+ 1, Column
- 1) = Player
And Checked
(Row
+ 1, Column
- 1) = 0 Then Progress
= Progress
+ 1: Row
= Row
+ 1: Column
= Column
- 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
' Check Up Right
If BoardPlayer
(Row
- 1, Column
+ 1) = Player
And Checked
(Row
- 1, Column
+ 1) = 0 Then Progress
= Progress
+ 1: Row
= Row
- 1: Column
= Column
+ 1: StepRow
(Progress
) = Row: StepColumn
(Progress
) = Column: Checked
(Row
, Column
) = 1:
GoTo CheckWinner
If Progress
> 1 Then Progress
= Progress
- 1:
GoTo CheckWinner
ReleaseButton:
DrawPiece:
Winner:
PSet (BoardX
(StepRow
(1), StepColumn
(1)), BoardY
(StepRow
(1), StepColumn
(1))), 15 For Z
= 2 To Progress:
Line -(BoardX
(StepRow
(Z
), StepColumn
(Z
)), BoardY
(StepRow
(Z
), StepColumn
(Z
))), 15:
Next
PSet (BoardX
(StepRow
(1), StepColumn
(1)), BoardY
(StepRow
(1), StepColumn
(1))), 15:
Draw "TA300D35" PSet (BoardX
(StepRow
(Progress
), StepColumn
(Progress
)), BoardY
(StepRow
(Progress
), StepColumn
(Progress
))), 15:
Draw "TA120D35" PSet (BoardX
(StepRow
(1), StepColumn
(1)), BoardY
(StepRow
(1), StepColumn
(1))), 15:
Draw "TA0U35" PSet (BoardX
(StepRow
(Progress
), StepColumn
(Progress
)), BoardY
(StepRow
(Progress
), StepColumn
(Progress
))), 15:
Draw "TA0D35"
Locate 42, 5:
Print " Player"; Player;
"is the Winner!";
GetYorN: