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

Here is my take on the 2 player abstract strategy board game Stonehenge where players a racing to be the first player to claim 8 separate lines.

Hope you enjoy playing

Donald

https://youtu.be/4_hu9PpVbfU

[Image: Stone-Henge-Screenshot.png]


[Image: Stonehemge-play.webp]


[Image: Stonehemge-play4.webp]


.pdf   Stone Henge Description.pdf (Size: 49.57 KB / Downloads: 80)
.pdf   Stonehenge_English_Rules.pdf (Size: 53.45 KB / Downloads: 90)

Code: (Select All)
_TITLE "Stone Henge Board Game"

SCREEN _NEWIMAGE(1325, 740, 256)

_PALETTECOLOR 1, _RGB32(72, 72, 72) ' Background Color
_PALETTECOLOR 2, _RGB32(50, 50, 50) ' Board Color
_PALETTECOLOR 3, _RGB32(170, 170, 170) ' Druid Space Color
_PALETTECOLOR 4, _RGB32(0, 255, 0) ' MegalLith Space Color
_PALETTECOLOR 5, _RGB32(255, 255, 0) ' MegalLith Line Color
_PALETTECOLOR 6, _RGB32(254, 254, 0) ' MegalLith Line Color
_PALETTECOLOR 7, _RGB32(155, 0, 0) ' Player 2 Druid Piece Color

DIM AS _BYTE X, Y, Z, Player, Opponent, Row, Column
DIM AS INTEGER X1, X2
DIM SHARED AS _BYTE Selected, HidePieces, Piece, DruidPieces(2, 6), Megaliths(2), Columns(5), DruidSpace(7, 12), MegalithSpace(7, 12)
DIM SHARED AS _BYTE BoardPlayer(7, 12), BoardPiece(7, 12), LineTotal(2, 15), EligibleWinner(15), LineWinner(15), PieceColor(2)
DIM SHARED AS _BYTE LineSize(15), LineComplete(15), LineRow(15, 5), LineColumn(15, 5), DruidShown(7, 12)
DIM SHARED AS _BYTE LastRow, LastColumn, Megalith
DIM SHARED AS INTEGER BoardX(7, 12), BoardY(7, 12), DruidX(2, 6), DruidY(2, 6)

DruidPieces(1, 1) = 2: DruidPieces(1, 2) = 2: DruidPieces(1, 3) = 2: DruidPieces(1, 4) = 1: DruidPieces(1, 5) = 1: DruidPieces(1, 6) = 1
DruidPieces(2, 1) = 2: DruidPieces(2, 2) = 2: DruidPieces(2, 3) = 2: DruidPieces(2, 4) = 1: DruidPieces(2, 5) = 1: DruidPieces(2, 6) = 1
Megaliths(1) = 8: Megaliths(2) = 8
Columns(1) = 4: Columns(2) = 5: Columns(3) = 4: Columns(4) = 3: Columns(5) = 2
Player = 1: Opponent = 2: PieceColor(1) = 0: PieceColor(2) = 7

' Setup Line Sizes
DATA 2,3,4,5,4,2,3,4,5,4,2,3,4,5,4
FOR Z = 1 TO 15: READ LineSize(Z): NEXT

' Setup Line Rows and Column
DATA 2,4,3,3,2,6,3,5,4,4,2,8,3,7,4,6,5,5,2,10,3,9,4,8,5,7,6,6,3,11,4,10,5,9,6,8
DATA 2,10,3,11,2,8,3,9,4,10,2,6,3,7,4,8,5,9,2,4,3,5,4,6,5,7,6,8,3,3,4,4,5,5,6,6
DATA 6,6,6,8,5,5,5,7,5,9,4,4,4,6,4,8,4,10,3,3,3,5,3,7,3,9,3,11,2,4,2,6,2,8,2,10
FOR Z = 1 TO 15: FOR Y = 1 TO LineSize(Z): READ LineRow(Z, Y), LineColumn(Z, Y): NEXT: NEXT

' Clear Drois Piece Spaces and Megalith Spaces
FOR Z = 1 TO 7: FOR Y = 1 TO 12: DruidSpace(Z, Y) = 0: MegalithSpace(Z, Y) = 0: NEXT: NEXT

' Setup Druid Spaces
DATA 2,4,2,6,2,8,2,10,3,3,3,5,3,7,3,9,3,11,4,4,4,6,4,8,4,10,5,5,5,7,5,9,6,6,6,8
FOR Z = 1 TO 18: READ Row, Column: DruidSpace(Row, Column) = 1: NEXT

' Setup Megalith Spaces
DATA 1,5,1,7,1,9,1,11,2,12,4,12,5,11,6,10,7,9,7,7,6,4,5,3,4,2,3,1,2,2
FOR Z = 1 TO 15: READ Row, Column: MegalithSpace(Row, Column) = Z: NEXT

' Setup BoardX and BoardY
X1 = 70
FOR Z = 1 TO 7
   X2 = 70
   FOR Y = 1 TO 12
      BoardX(Z, Y) = X2: BoardY(Z, Y) = X1
      X2 = X2 + 58
   NEXT
   X1 = X1 + 100
NEXT

' Draw Board
CLS , 1: LINE (10, 10)-(770, 730), 15, BF: LINE (12, 12)-(768, 728), 2, BF

' Draw Megalith Lines
PSET (BoardX(1, 5) + 3, BoardY(1, 5)), 6: DRAW "TA60L200U5R200D5TA0BL2P6,6"
PSET (BoardX(1, 7) + 3, BoardY(1, 7)), 6: DRAW "TA60L350U5R350D5TA0BL2P6,6"
PSET (BoardX(1, 9) + 3, BoardY(1, 9)), 6: DRAW "TA60L450U5R450D5TA0BL2P6,6"
PSET (BoardX(1, 11) + 3, BoardY(1, 11)), 6: DRAW "TA60L550U5R550D5TA0BL2P6,6"
PSET (BoardX(2, 12) + 3, BoardY(2, 12)), 6: DRAW "TA60L450U5R450D5TA0BL2P6,6"
PSET (BoardX(4, 12) - 3, BoardY(4, 12)), 5: DRAW "TA120R200D5L200U5TA0BU2P5,5"
PSET (BoardX(5, 11) - 3, BoardY(5, 11)), 5: DRAW "TA120R350D5L350U5TA0BU2P5,5"
PSET (BoardX(6, 10) - 3, BoardY(6, 10)), 5: DRAW "TA120R450D5L450U5TA0BU2P5,5"
PSET (BoardX(7, 9) - 3, BoardY(7, 9)), 5: DRAW "TA120R550D5L550U5TA0BU2P5,5"
PSET (BoardX(7, 7) - 3, BoardY(7, 7)), 5: DRAW "TA120R450D5L450U5TA0BU2P5,5"
LINE (BoardX(2, 2), BoardY(2, 2) - 2)-(BoardX(2, 10), BoardY(2, 10) + 2), 5, BF
LINE (BoardX(3, 1), BoardY(3, 1) - 2)-(BoardX(3, 11), BoardY(3, 11) + 2), 5, BF
LINE (BoardX(4, 2), BoardY(4, 2) - 2)-(BoardX(4, 10), BoardY(4, 10) + 2), 5, BF
LINE (BoardX(5, 3), BoardY(5, 3) - 2)-(BoardX(5, 9), BoardY(5, 9) + 2), 5, BF
LINE (BoardX(6, 4), BoardY(6, 4) - 2)-(BoardX(6, 8), BoardY(6, 8) + 2), 5, BF

' Draw Druid Spaces and Megalith Spaces
FOR Z = 1 TO 7
   FOR Y = 1 TO 12
      IF DruidSpace(Z, Y) = 1 THEN CIRCLE (BoardX(Z, Y), BoardY(Z, Y)), 35, 3: PAINT (BoardX(Z, Y), BoardY(Z, Y)), 3
      IF MegalithSpace(Z, Y) > 0 THEN CIRCLE (BoardX(Z, Y), BoardY(Z, Y)), 25, 4: PAINT (BoardX(Z, Y), BoardY(Z, Y)), 4
   NEXT
NEXT

fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"

' Display Game Title
COLOR 4, 1: font& = _LOADFONT(fontpath$, 45): _FONT font&: _PRINTSTRING (835, 10), "S T O N E   H E N G E"

' Hide Druid Piece Values?
COLOR 15, 1: font& = _LOADFONT(fontpath$, 25): _FONT font&: _PRINTSTRING (848, 700), "Hide Druid Piece Values? ( Y or N )"

HidePiecesInput: A$ = UCASE$(INKEY$): IF A$ = "" GOTO HidePiecesInput
IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
IF A$ = "Y" THEN HidePieces = 1 ELSE IF A$ = "N" THEN HidePieces = 0 ELSE GOTO HidePiecesInput

COLOR 5, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (848, 700), STRING$(250, 32)

IF HidePieces = 1 THEN COLOR 3, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (871, 60), "Druid Piece Values Hiden"

COLOR 15, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (861, 210), "D  R  U  I  D    P  I  E  C  E  S"

' Display Player Pieces
X1 = 310
FOR Z = 1 TO 3
   DrawDruidPiece 827, X1, 1, Z, 1: DrawDruidPiece 962, X1, 1, 3 + Z, 1: DrawDruidPiece 1097, X1, 2, Z, 1: DrawDruidPiece 1232, X1, 2, 3 + Z, 1
   DruidX(1, Z) = 827: DruidY(1, Z) = X1: DruidX(1, 3 + Z) = 962: DruidY(1, 3 + Z) = X1
   DruidX(2, Z) = 1097: DruidY(2, Z) = X1: DruidX(2, 3 + Z) = 1232: DruidY(2, 3 + Z) = X1
   X1 = X1 + 100
NEXT

COLOR 3, 1: font& = _LOADFONT(fontpath$, 35): _FONT font&
FOR Z = 1 TO 2: FOR Y = 1 TO 6: _PRINTSTRING (DruidX(Z, Y) + 47, DruidY(Z, Y) - 35), " X": NEXT: NEXT

DrawMegaLith 830, 620, 1: COLOR 3, 1: _PRINTSTRING (870, 605), "X"
DrawMegaLith 1197, 620, 2: COLOR 3, 1: _PRINTSTRING (1237, 605), "X"

GameLoop:
' Display Player's Indicator
DrawMegaLith 1047, 130, Player
COLOR 15, 1: font& = _LOADFONT(fontpath$, 20): _FONT font&: _PRINTSTRING (1005, 165), "Player: " + STR$(Player)

UpdateDruidList: EndTurnButton 0

COLOR 15, 1: font& = _LOADFONT(fontpath$, 25): _FONT font&: _PRINTSTRING (890, 705), "Choose Druid Piece to Play"

COLOR 5, 1: font& = _LOADFONT(fontpath$, 35): _FONT font&

PieceInput:
DO WHILE _MOUSEINPUT
   FOR Z = 1 TO 6
      IF _MOUSEX > DruidX(Player, Z) - 35 AND _MOUSEX < DruidX(Player, Z) + 35 AND _MOUSEY > DruidY(Player, Z) - 35 AND _MOUSEY < DruidY(Player, Z) + 35 THEN Selected = 1 ELSE Selected = 0

      IF HidePieces = 1 AND Selected = 1 THEN
         _PRINTSTRING (DruidX(Player, Z) + 50, DruidY(Player, Z)), STR$(DruidPieces(Player, Z))
      ELSEIF HidePieces = 1 AND Selected = 0 THEN
         _PRINTSTRING (DruidX(Player, Z) + 52, DruidY(Player, Z)), " ?"
      END IF

      IF _MOUSEBUTTON(1) = -1 AND DruidPieces(Player, Z) > 0 AND Selected = 1 THEN GOSUB ReleaseButton: Piece = Z: GOTO ChooseBoardSpace

   NEXT
LOOP
A$ = INKEY$: IF A$ <> "" THEN IF ASC(A$) = 27 AND Full = 0 THEN _FULLSCREEN _SQUAREPIXELS , _SMOOTH: Full = 1 ELSE IF ASC(A$) = 27 THEN _FULLSCREEN _OFF: Full = 0
GOTO PieceInput

ChooseBoardSpace:
IF HidePieces = 0 THEN
   LINE (DruidX(Player, Piece) - 45, DruidY(Player, Piece) - 45)-(DruidX(Player, Piece) + 45, DruidY(Player, Piece) + 45), 15, B
ELSE
   _PRINTSTRING (DruidX(Player, Piece) + 52, DruidY(Player, Piece)), " ?"
END IF

COLOR 15, 1: font& = _LOADFONT(fontpath$, 25): _FONT font&: _PRINTSTRING (890, 705), STRING$(300, 32)
_PRINTSTRING (825, 672), "Choose a Different Druid Piece to Play"
_PRINTSTRING (807, 705), "Choose Board Space to Place Druid Piece"

COLOR 5, 1: font& = _LOADFONT(fontpath$, 35): _FONT font&

BoardSpaceInput:
DO WHILE _MOUSEINPUT

   ' Choose Different Piece
   FOR Z = 1 TO 6
      IF _MOUSEX > DruidX(Player, Z) - 35 AND _MOUSEX < DruidX(Player, Z) + 35 AND _MOUSEY > DruidY(Player, Z) - 35 AND _MOUSEY < DruidY(Player, Z) + 35 THEN Selected = 1 ELSE Selected = 0
      IF HidePieces = 1 AND Selected = 1 THEN
         _PRINTSTRING (DruidX(Player, Z) + 50, DruidY(Player, Z)), STR$(DruidPieces(Player, Z))
      ELSEIF HidePieces = 1 AND Selected = 0 THEN
         _PRINTSTRING (DruidX(Player, Z) + 52, DruidY(Player, Z)), " ?"
      END IF
      IF _MOUSEBUTTON(1) = -1 AND DruidPieces(Player, Z) > 0 AND Selected = 1 THEN
         GOSUB ReleaseButton: IF DruidPieces(Player, Z) = 0 GOTO BoardSpaceInput
         LINE (DruidX(Player, Piece) - 45, DruidY(Player, Piece) - 45)-(DruidX(Player, Piece) + 45, DruidY(Player, Piece) + 45), 1, B: Piece = Z: GOTO ChooseBoardSpace
      END IF
   NEXT

   ' Choose Board Location
   FOR Z = 1 TO 7
      FOR Y = 1 TO 12
         IF _MOUSEX > BoardX(Z, Y) - 35 AND _MOUSEX < BoardX(Z, Y) + 35 AND _MOUSEY > BoardY(Z, Y) - 35 AND _MOUSEY < BoardY(Z, Y) + 35 AND _MOUSEBUTTON(1) = -1 THEN
            GOSUB ReleaseButton: IF DruidSpace(Z, Y) = 0 OR BoardPlayer(Z, Y) > 0 GOTO BoardSpaceInput ELSE Row = Z: Column = Y: GOTO PlaceDruidPiece
         END IF
      NEXT
   NEXT

LOOP
A$ = INKEY$: IF A$ <> "" THEN IF ASC(A$) = 27 AND Full = 0 THEN _FULLSCREEN _SQUAREPIXELS , _SMOOTH: Full = 1 ELSE IF ASC(A$) = 27 THEN _FULLSCREEN _OFF: Full = 0
GOTO BoardSpaceInput

PlaceDruidPiece:
LastRow = Row: LastColumn = Column

' Place Druid Piece on the Board
IF HidePieces = 1 THEN X = 0 ELSE X = 1
BoardPlayer(Row, Column) = Player: BoardPiece(Row, Column) = Piece: DrawDruidPiece BoardX(Row, Column), BoardY(Row, Column), Player, Piece, X

' Update Druid Piece Count
DruidPieces(Player, Piece) = DruidPieces(Player, Piece) - 1: UpdateDruidList: EndTurnButton 1: GetLineTotals Player, Opponent

' Remove Cursor from Chosen Druid Piece
IF HidePieces = 0 THEN
   IF DruidPieces(Player, Piece) = 0 THEN
      LINE (DruidX(Player, Piece) - 45, DruidY(Player, Piece) - 45)-(DruidX(Player, Piece) + 85, DruidY(Player, Piece) + 45), 1, BF
   ELSE
      LINE (DruidX(Player, Piece) - 45, DruidY(Player, Piece) - 45)-(DruidX(Player, Piece) + 45, DruidY(Player, Piece) + 45), 1, B
   END IF
END IF

COLOR 15, 1: font& = _LOADFONT(fontpath$, 25): _FONT font&: _PRINTSTRING (825, 672), STRING$(250, 32): _PRINTSTRING (807, 705), STRING$(250, 32)
_PRINTSTRING (820, 672), "Click <END TURN> Button to End Turn"
_PRINTSTRING (812, 705), "Choose a Megalith Space to Claim a Line"

EndTurnInput:
DO WHILE _MOUSEINPUT

   ' End Turn
   IF _MOUSEX > 965 AND _MOUSEX < 1127 AND _MOUSEY > 595 AND _MOUSEY < 645 AND _MOUSEBUTTON(1) = -1 THEN GOSUB ReleaseButton: GOTO EndTurn

   ' Choose Megalith
   FOR Z = 1 TO 7
      FOR Y = 1 TO 12
         Megalith = MegalithSpace(Z, Y)
         IF _MOUSEX > BoardX(Z, Y) - 25 AND _MOUSEX < BoardX(Z, Y) + 25 AND _MOUSEY > BoardY(Z, Y) - 25 AND _MOUSEY < BoardY(Z, Y) + 25 AND _MOUSEBUTTON(1) = -1 AND Megalith > 0 THEN
            IF EligibleWinner(Megalith) = Player AND LineWinner(Megalith) = 0 THEN GOSUB ReleaseButton: Row = Z: Column = Y: GOTO PlaceMegalith
         END IF
      NEXT
   NEXT

LOOP
A$ = INKEY$: IF A$ <> "" THEN IF ASC(A$) = 27 AND Full = 0 THEN _FULLSCREEN _SQUAREPIXELS , _SMOOTH: Full = 1 ELSE IF ASC(A$) = 27 THEN _FULLSCREEN _OFF: Full = 0
GOTO EndTurnInput

PlaceMegalith:
LineWinner(Megalith) = Player: Megaliths(Player) = Megaliths(Player) - 1: UpdateDruidList
DrawMegaLith BoardX(Row, Column), BoardY(Row, Column), Player

IF Megaliths(Player) = 0 THEN LINE (965, 595)-(1127, 645), 1, BF: DisplayWinner Player ELSE GOTO EndTurnInput

EndTurn:
COLOR 15, 1: _PRINTSTRING (820, 672), STRING$(250, 32): _PRINTSTRING (812, 705), STRING$(250, 32)

SWAP Player, Opponent: GOTO GameLoop

ReleaseButton:
DO WHILE _MOUSEINPUT
   IF _MOUSEBUTTON(1) = 0 THEN RETURN
LOOP
GOTO ReleaseButton

SUB DrawDruidPiece (X, Y, Player, DruidPiece, Show)
   CIRCLE (X, Y), 35, 15: PAINT (X, Y), 15: CIRCLE (X, Y), 32, PieceColor(Player): PAINT (X, Y), PieceColor(Player)
   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   IF Show = 1 THEN
      COLOR 15, PieceColor(Player): font& = _LOADFONT(fontpath$, 43): _FONT font&
      _PRINTSTRING (X - 24, Y - 20), STR$(DruidPiece)
   END IF
END SUB

SUB DrawMegaLith (X, Y, Player)
   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   DIM AS _BYTE W: W = PieceColor(Player)
   LINE (X - 18, Y - 25)-(X + 18, Y - 25), 15: LINE (X - 18, Y + 25)-(X + 18, Y + 25), 15: LINE (X - 25, Y - 18)-(X - 25, Y + 18), 15: LINE (X + 25, Y - 18)-(X + 25, Y + 18), 15
   CIRCLE (X - 18, Y - 18), 7, 15, 1.3, 3.1: CIRCLE (X + 18, Y - 18), 7, 15, 0, 1.6: CIRCLE (X - 18, Y + 18), 7, 15, 2.9, 4.8: CIRCLE (X + 18, Y + 18), 7, 15, 4.4, 0: PAINT (X, Y), W, 15
   COLOR 5, W: font& = _LOADFONT(fontpath$, 35): _FONT font&: _PRINTSTRING (X - 19, Y - 15), STR$(Player)
END SUB

SUB UpdateDruidList
   DIM AS _BYTE Z, Y
   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   COLOR 5, 1: font& = _LOADFONT(fontpath$, 35): _FONT font&
   FOR Z = 1 TO 2
      FOR Y = 1 TO 6
         IF HidePieces = 1 THEN Druid$ = " ?" ELSE IF DruidPieces(Z, Y) > 0 THEN Druid$ = STR$(DruidPieces(Z, Y)) ELSE Druid$ = "  "
         _PRINTSTRING (DruidX(Z, Y) + 50, DruidY(Z, Y)), Druid$
      NEXT
   NEXT
   COLOR 5, 1: _PRINTSTRING (898, 602), STR$(Megaliths(1)): _PRINTSTRING (1265, 602), STR$(Megaliths(2))
END SUB

SUB EndTurnButton (Show)
   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   font& = _LOADFONT(fontpath$, 25): _FONT font&
   CIRCLE (975, 605), 10, 3, 1.3, 3.1: CIRCLE (1117, 605), 10, 3, 0, 1.6: CIRCLE (975, 635), 10, 3, 2.9, 4.8: CIRCLE (1117, 635), 10, 3, 4.4, 0
   LINE (975, 595)-(1117, 595), 3: LINE (975, 645)-(1117, 645), 3: LINE (965, 605)-(965, 635), 3: LINE (1127, 605)-(1127, 635), 3: PAINT (975, 605), 3
   IF Show = 1 THEN COLOR 0, 3 ELSE COLOR 15, 3
   _PRINTSTRING (983, 610), "END TURN"
END SUB

SUB GetLineTotals (Player, Opponent)
   DIM AS _BYTE Row, Column, X, Y, Z, HighestPiece(2), LineCount(15)

   ' Get Piece Count for Each Line
   FOR Z = 1 TO 15
      LineCount(Z) = 0
      FOR Y = 1 TO LineSize(Z)
         IF BoardPlayer(LineRow(Z, Y), LineColumn(Z, Y)) > 0 THEN LineCount(Z) = LineCount(Z) + 1
      NEXT
   NEXT

   ' Uncover Pieces
   IF HidePieces = 1 THEN
      FOR Z = 1 TO 15
         IF LineComplete(Z) = 0 THEN
            IF LineCount(Z) = LineSize(Z) THEN
               LineComplete(Z) = 1
               FOR Y = 1 TO LineSize(Z)
                  Row = LineRow(Z, Y): Column = LineColumn(Z, Y)
                  IF DruidShown(Row, Column) = 0 THEN
                     DruidShown(Row, Column) = 1
                     DrawDruidPiece BoardX(Row, Column), BoardY(Row, Column), BoardPlayer(Row, Column), BoardPiece(Row, Column), 1
                  END IF
               NEXT
            END IF
         END IF
      NEXT
   END IF

   ' Get Player Line Totals
   FOR Z = 1 TO 15
      IF EligibleWinner(Z) = 0 AND LineWinner(Z) = 0 THEN
         LineTotal(1, Z) = 0: LineTotal(2, Z) = 0: X = 0
         FOR Y = 1 TO LineSize(Z)
            Row = LineRow(Z, Y): Column = LineColumn(Z, Y): IF Row = LastRow AND Column = LastColumn THEN X = 1
            IF BoardPlayer(Row, Column) = 1 THEN LineTotal(1, Z) = LineTotal(1, Z) + BoardPiece(Row, Column)
            IF BoardPlayer(Row, Column) = 2 THEN LineTotal(2, Z) = LineTotal(2, Z) + BoardPiece(Row, Column)
         NEXT
         IF LineCount(Z) = LineSize(Z) THEN
            LineComplete(Z) = 1
            IF LineTotal(1, Z) > LineTotal(2, Z) THEN EligibleWinner(Z) = 1
            IF LineTotal(1, Z) < LineTotal(2, Z) THEN EligibleWinner(Z) = 2
            IF LineTotal(1, Z) = LineTotal(2, Z) AND X = 1 THEN EligibleWinner(Z) = Opponent
         END IF
      END IF
   NEXT

   ' Get Player's Highest Available Druid Piece
   HighestPiece(1) = 0: HighestPiece(2) = 0
   FOR Z = 1 TO 6
      IF DruidPieces(1, Z) > 0 THEN HighestPiece(1) = Z
      IF DruidPieces(2, Z) > 0 THEN HighestPiece(2) = Z
   NEXT

   ' Get Line Eligible Players
   FOR Z = 1 TO 15
      IF EligibleWinner(Z) = 0 AND LineWinner(Z) = 0 THEN
         LineTotal(1, Z) = 0: LineTotal(2, Z) = 0: X = 0
         FOR Y = 1 TO LineSize(Z)
            Row = LineRow(Z, Y): Column = LineColumn(Z, Y):
            IF BoardPlayer(Row, Column) > 0 THEN LineTotal(BoardPlayer(Row, Column), Z) = LineTotal(BoardPlayer(Row, Column), Z) + BoardPiece(Row, Column)
         NEXT
         IF LineCount(Z) = LineSize(Z) - 1 THEN IF LineTotal(Player, Z) >= LineTotal(Opponent, Z) + HighestPiece(Opponent) THEN EligibleWinner(Z) = Player
      END IF
   NEXT

END SUB

SUB DisplayWinner (Player)
   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   COLOR 15, 1: font& = _LOADFONT(fontpath$, 25): _FONT font&
   _PRINTSTRING (815, 672), STRING$(250, 32): _PRINTSTRING (807, 705), STRING$(250, 32)
   _PRINTSTRING (910, 672), "Player " + STR$(Player) + " is the Winner!"
   _PRINTSTRING (876, 705), "Play Another Game? ( Y or N )"
   GetYorN: A$ = UCASE$(INKEY$): IF A$ = "" GOTO GetYorN
   IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
   IF A$ = "Y" THEN RUN ELSE IF A$ = "N" THEN SYSTEM ELSE GOTO GetYorN
END SUB
Reply
#2
Why the hell is your "rep" only 7? It should be at least 9. There, it is now. Seriously, it should be more like 100. I think you should also be showcased in the prolific programmers forum. I know, the "Games" forum has this...

Quote:Donald has created dozens, if not hundreds, of classic board games for QB64 and QB64PE. This is his own little slice of the web, and a place for all his work to be gathered into one spot to showcase it and how prolific a game designer that he is. No one else's stuff should go in here. Work hard, hard game makers, and you two may get your own subforum in time!
 

Well, besides the wrong use of the word "too" that forum never remained exclusive. Maybe that was a good thing, because I think it really should be open to all game posters, but the addition of your works into the prolific forum would be nice to see. All your games have continuity and do a great job of preserving the original board game designs.

Anyway, +2 for this new addition and we'll see what can be done about what I previously mentioned.

Pete
Reply
#3
(05-28-2024, 07:37 PM)Pete Wrote: Why the hell is your "rep" only 7? It should be at least 9. There, it is now. Seriously, it should be more like 100. I think you should also be showcased in the prolific programmers forum. I know, the "Games" forum has this...

Quote:Donald has created dozens, if not hundreds, of classic board games for QB64 and QB64PE. This is his own little slice of the web, and a place for all his work to be gathered into one spot to showcase it and how prolific a game designer that he is. No one else's stuff should go in here. Work hard, hard game makers, and you two may get your own subforum in time!
 

Well, besides the wrong use of the word "too" that forum never remained exclusive. Maybe that was a good thing, because I think it really should be open to all game posters, but the addition of your works into the prolific forum would be nice to see. All your games have continuity and do a great job of preserving the original board game designs.

Anyway, +2 for this new addition and we'll see what can be done about what I previously mentioned.

Pete
Take a look at where you're at @Pete.  This *is* the Games forum, which is opened for all game posters.  Donald's just got so many works, that we've given him his own little subforum here inside Games, to keep all his stuff organized and neatly together.  I suppose it could go in the Prolific Programmers forum, but seeing as they;re all game related and not willy-nilly examples of just about anything under the sun, it just seemed a little more fitting to organize them and keep them all here in his own dedicated subspace instead.  Smile
Reply
#4
When the LLMs get good enough I think Don should ask it to code AI players in all of his board games to play against. I would love to play some of these games against a difficult computer opponent.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply




Users browsing this thread: 1 Guest(s)