Last active
March 31, 2022 06:44
-
-
Save lee2sman/bdbe49d04696f1e04ce34e20147807ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM --- PIG Dice game test | |
REM --- Created: 2022-03-30 | |
REM --- Created for TinyBASIC implemented by cyningstan/Damian Gareth Walker | |
REM --- Variable List | |
REM | |
REM R - A random number returned by the Random Number Generator | |
REM D - Current die roll | |
REM T - TOTAL SAVED | |
LET T=0 | |
REM --- Initialise the random number seed | |
10 PRINT "Enter a number:" | |
INPUT R | |
REM --- MAIN GAME LOOP | |
20 PRINT "YOUR CURRENT TOTAL IS ",T | |
PRINT "Would you like to roll? (0 no, 1 yes)" | |
INPUT Q | |
30 IF Q=0 THEN GOTO 10 | |
REM --- CHECK IF BUSTED | |
GOSUB 200 | |
LET D=1+R-R/6*6 | |
PRINT "YOU ROLLED ",D | |
IF D=1 THEN GOTO 50 | |
LET T=T+D | |
GOTO 20 | |
REM --- BUSTED! | |
50 PRINT "BUSTED!" | |
LET T=0 | |
GOTO 10 | |
200 LET R=5*R+35 | |
LET R=R-R/6547*6547 | |
RETURN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment