BPlus variation on Pig, called Boink ( B+ oink ;-)) )
This pig is a prize look how fat it is!
_TITLE "Boink" ' for QB64 B+ started a version of Pig when/where the number of di is declared and rolled
' Boink rules:
' Start round by flipping coin who goes first
' Each player chooses number of dice to roll to start their round
' Dice rolled
' If 1 di is 1 then no points that turn,
' If 2 di are 1 then no points and the score is reset to 0,
' If 3 di are 1 then gameover that player lost,
' If 4 di are 1 then player wins game automatically,
' Otherwise the player gets the total of di added to their score.
RANDOMIZE TIMER
CONST wholeHog = 7
Sooie = 1
WHILE Sooie
IF RND < .5 THEN
GOSUB FarmerRound
IF Sooie THEN GOSUB HALRound
ELSE
GOSUB HALRound
IF Sooie THEN GOSUB FarmerRound
END IF
WEND
END
FarmerRound:
COLOR 11
Who$ = "Farmer"
COLOR 14
cp "Farmer, Enter how many dice to roll."
LOCATE , 38: INPUT ; hogHerd
COLOR 11
GOSUB RollEmRollEM
RETURN
HALRound:
COLOR 9
Who$ = "HAL"
hogHerd = INT(wholeHog * (100 - HAL) / 100 + .5)
IF hogHerd = 0 THEN hogHerd = 1
GOSUB RollEmRollEM
RETURN
RollEmRollEM:
pigsEye = 0: bacon = 0
s$ = Who$ + "'s, dice roll is:"
FOR pigglet = 1 TO hogHerd
Babe = INT(RND * 6) + 1
IF Babe = 1 THEN pigsEye = pigsEye + 1
bacon = bacon + Babe
s$ = s$ + " " + STR$(Babe)
NEXT
cp s$
SELECT CASE pigsEye
CASE 0
IF Who$ = "Farmer" THEN Farmer = Farmer + bacon ELSE HAL = HAL + bacon
cp Who$ + "," + STR$(bacon) + " has been added to your score."
IF Farmer >= 100 OR HAL >= 100 THEN Sooie = 0: cp Who$ + " wins!"
CASE 1
cp Who$ + " rolled a 1, so your score remains the same."
CASE 2
IF Who$ = "Farmer" THEN Farmer = 0 ELSE HAL = 0
cp Who$ + " rolled two 1's, so your score is reset to 0."
CASE 3
cp Who$ + ", sorry three 1's means you lost the game."
Sooie = 0
CASE ELSE
cp Who$ + " more than three 1's makes you the winner!"
Sooie = 0
END SELECT
cp "Press any..."
IF Sooie THEN
k$ = INKEY$
WHILE LEN(k$) = 0: k$ = INKEY$: _LIMIT 100: WEND
COLOR _RGB(255, 150, 170)
PRINT
cp "Boink Score Board: Farmer =" + STR$(Farmer) + " HAL =" + STR$(HAL)
PRINT
END IF
RETURN
SUB cp (s$)
LOCATE , (80 - LEN(s$)) / 2: PRINT s$
END SUB