Post by B+ on Oct 17, 2018 4:56:40 GMT
Just found this on Rosetta, thought I'd give it a shot. It's kinda fun!
You roll a die and if you roll a 1 you loose your turn plus any points you accumulated in the round.
Other than 1, you have option to roll again or hold to add the accumulated points from the round to your score.
You are playing against the AI here, first one to 100 wins!
You roll a die and if you roll a 1 you loose your turn plus any points you accumulated in the round.
Other than 1, you have option to roll again or hold to add the accumulated points from the round to your score.
You are playing against the AI here, first one to 100 wins!
'Pig.txt for JB v2.0 B+ started 2018-10-16 try a Rosetta Challenge
WHILE player < 100 AND AI < 100
turn = (turn + 1) MOD 2
di = INT(RND(0) * 6) + 1
PRINT: PRINT "Player: "; player; " AI: "; AI
accum = 0
IF turn THEN 'player
WHILE 1
IF di = 1 THEN
PRINT : INPUT "Player you rolled a 1, your turn is over, press enter..."; wate$
EXIT WHILE
ELSE
accum = accum + di
PRINT : PRINT "Player you rolled a "; di; ", your accumulated total is now "; accum
INPUT "Do you want to (r)oll again or (h)old, Enter r or h > "; choice$
IF choice$ = "r" THEN
di = INT(RND(0) * 6) + 1
ELSE
player = player + accum
EXIT WHILE
END IF
END IF
WEND
ELSE
FOR i = 1 TO 5
IF di = 1 THEN
PRINT : INPUT "AI rolled a 1, it's turn is over, press enter..."; wate$
EXIT FOR
ELSE
accum = accum + di
PRINT : PRINT "AI rolled a "; di; " it's total accumulated now is "; accum
IF i < 3 AND accum + AI < 100 THEN
PRINT "AI is rolling again."
INPUT "press enter..."; wate$
di = INT(RND(0) * 6) + 1
ELSE
PRINT "AI is holding with "; accum; " added to it's score."
INPUT "press enter..."; wate$
AI = AI + accum
EXIT FOR
END IF
END IF
NEXT
END IF
WEND
PRINT: PRINT "Player: "; player; " AI: "; AI
IF player > AI THEN PRINT "Player wins!" ELSE PRINT "AI wins!"
END