REM ***************** REM *JustinLi's Game* REM ***************** COMMON SHARED numcorrect%, numproblem%, totaltime#, name$ DECLARE SUB HighScore () CLS DIM timer1#, timer2#, numincorrect% RANDOMIZE TIMER PRINT "Hi! Welcome to Justin's math quiz." INPUT "What is your name? ", name$ PRINT "choose your type of test" PRINT "1. adding" PRINT "2. subtracting" PRINT "3. multiplying" PRINT "4. dividing" INPUT "choice: ", choice$ IF choice$ <> "0" THEN PRINT "ok, i have the perfect test for you" END IF INPUT "ready? ", ready$ CLS timer1# = TIMER FOR i = 1 TO 5 numproblem% = numproblem% + 1 a = INT(RND * 15) b = INT(RND * 25) c = INT(RND * 20) d = INT(10 + RND * 10) e = (INT(2 + RND * 15) MOD 15) * (d) PRINT "" PRINT "problem "; i PRINT "what is"; a; "*"; b; "+"; c; "-"; e; "/"; d; "?" INPUT f# IF a * b + c - e / d = f# THEN PRINT "correct" numcorrect% = numcorrect% + 1 END IF IF a * b + c - e / d <> f# THEN PRINT "incorrect" numincorrect% = numincorrect% + 1 END IF NEXT i timer2# = TIMER totaltime# = INT(timer2# - timer1#) minute# = 60 t = totaltime# / minute# REM t minutes PRINT name$ PRINT "you got "; numcorrect%; " correct and "; numincorrect%; " incorrect" PRINT numcorrect%; "/"; numproblem% PRINT "in "; totaltime#; " seconds" SLEEP 1 INPUT "press any key to look at the high score ", move$ PRINT "loading..." SLEEP 1 CLS HighScore SUB HighScore start: PRINT "HighScore" PRINT " score "; " time "; "name" PRINT numproblem%; "/"; numproblem%; " 10 seconds"; " Justin Li" PRINT " 4 "; "/"; numproblem%; INT(RND * 20); " seconds"; " Eric" PRINT ((numcorrect% + 1) MOD numproblem% + 1); "/"; numproblem%; " "; totaltime# + INT(RND * 10); " seconds"; " Tyler" PRINT ((numcorrect% + 1) MOD numproblem% + 1); "/"; numproblem%; " "; totaltime# + INT(RND * 10); " seconds"; " Francis" PRINT "" PRINT numcorrect%; "/"; numproblem%; " "; totaltime#; " seconds"; " "; name$ INPUT "Would you like your score to be saved on the HighScore wall? ", answer$ IF answer$ = "yes" THEN PRINT "ok" PRINT "loading..." SLEEP 3 CLS PRINT "Error" SLEEP 1 PRINT "Corrupt File!" SLEEP 1 PRINT "PLEASE QUIT THIS PROGRAM IMMEDIATELY" SLEEP CLS SLEEP 1 PRINT "have a nice day" END END IF IF answer$ <> "yes" THEN PRINT "fine i see how it is" PRINT "bye now" SLEEP CLS END IF END SUB