Last active
May 9, 2019 13:14
-
-
Save tomaes/d31418c22e4d41a59a460bc32e6919e0 to your computer and use it in GitHub Desktop.
Started as a qb.js experiment, but it so happens that qb.js is a very limited implementation of QBasic. Had to go back to the real thing.
This file contains hidden or 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
' What's more? (v1.1) | |
' a quick guesstimation game in QBASIC | |
' (slightly extended version, won't run in qb.js) | |
DIM c%(2): cont% = 1: r% = 0: bchar% = 97 '97 = a,b / 48 = 0,1 | |
CLS | |
RANDOMIZE TIMER | |
t = TIMER | |
DO | |
FOR i = 0 TO 1: c%(i) = 0: NEXT i | |
r% = r% + 1 | |
br = RND(1) | |
FOR y = 1 TO 10 | |
FOR x = 1 TO 10 | |
n% = 0 | |
IF RND(1) > br THEN n% = 1 | |
c%(n%) = c%(n%) + 1 | |
PRINT " "; CHR$(bchar% + n%); " "; | |
NEXT x | |
PRINT : PRINT | |
NEXT y | |
0 PRINT "What's more (" + CHR$(bchar%) + " or " + CHR$(bchar% + 1) + ")"; | |
INPUT k$ | |
k% = ASC(k$) - bchar% | |
IF k% + 1 > LEN(c%) OR k% < 0 THEN | |
PRINT "invalid input!" | |
GOTO 0 | |
END IF | |
FOR i = 0 TO 1 | |
PRINT CHR$(bchar%+i); ":"; c%(i); " " | |
IF c%(i) > c%(k%) THEN cont% = 0 | |
NEXT i | |
LOOP WHILE cont% = 1 | |
PRINT "YOUR RUN: "; r%; " ROUNDS(S) in ca."; INT(TIMER - t); " SECONDS TIME!" | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment