QB / QB64 Discussion Forum     RULES     Other Subforums, Links and Downloads    Index of Threads

 

 Return to Index  

My Programs

December 22 2009 at 5:52 PM
unseenmachine  (Login unseenmachine)
R

 
Guessing game.....

TOP:
CLS : SCREEN 0: COLOR 11, 0
LOCATE 5, 10: INPUT "ENTER YOUR NAME : ", NME$
DO
CLS
EASY% = 500: MEDIUM% = 1000: HARD% = 2500: CRAZY% = 10000
RANDOMIZE TIMER
LOCATE 8, 22: PRINT "NUMBER GUESSING GAME V.02"
LOCATE 12, 10: PRINT "1. PLAY THE GAME"
LOCATE 14, 10: PRINT "2. VIEW HIGH SCORES LIST"
LOCATE 16, 10: PRINT "3. RESTART WITH NEW PLAYER"
LOCATE 18, 10: PRINT "4. EXIT"
LOCATE 22, 10: INPUT "ENTER YOUR SELECTION : ", MAINOPT%
LOOP UNTIL MAINOPT% > 0 OR MAINOPT% < 5
IF MAINOPT% = 3 THEN GOTO TOP
IF MAINOPT% = 1 THEN
IF MAINOPT% = 4 THEN SYSTEM
DO
GC% = 0
CLS
LOCATE 8, 20: PRINT "LEVEL SELECT"
LOCATE 10, 10: PRINT "1. EASY"
LOCATE 12, 10: PRINT "2. MEDIUM"
LOCATE 14, 10: PRINT "3. HARD"
LOCATE 16, 10: PRINT "4. CRAZY HARD"
LOCATE 20, 10: INPUT "ENTER YOUR SELECTION : ", LVLS%
LOOP UNTIL LVLS% > 0 OR LVLS% < 5
IF LVLS% = 1 THEN LVL% = EASY%: LVL$ = "EASY"
IF LVLS% = 2 THEN LVL% = MEDIUM%: LVL$ = "MEDIUM"
IF LVLS% = 3 THEN LVL% = HARD%: LVL$ = "HARD"
IF LVLS% = 4 THEN LVL% = CRAZY%: LVL$ = "CRAZY"
RNDNUM% = INT(RND * LVL%) + 1
DO
CLS
BURNING% = (LVL% / 100) * 2: HOT% = (LVL% / 100) * 8: WARM% = (LVL% / 100) * 14: TEPID% = (LVL% / 100) * 20
LOCATE 10, 20: PRINT "GUESS A NUMBER BETWEEN 1 AND"; LVL%
GC% = GC% + 1: LASTG% = USRNUM%
LOCATE 14, 10: INPUT "YOUR GUESS IS : ", USRNUM%
ACCUR$ = "COLD"
IF USRNUM% > RNDNUM% - TEPID% AND USRNUM% < RNDNUM% THEN ACCUR$ = "NOT SO WARM"
IF USRNUM% < RNDNUM% + TEPID% AND USRNUM% > RNDNUM% THEN ACCUR$ = "NOT SO WARM"
IF USRNUM% > RNDNUM% - WARM% AND USRNUM% < RNDNUM% THEN ACCUR$ = "WARM"
IF USRNUM% < RNDNUM% + WARM% AND USRNUM% > RNDNUM% THEN ACCUR$ = "WARM"
IF USRNUM% > RNDNUM% - HOT% AND USRNUM% < RNDNUM% THEN ACCUR$ = "HOT HOT HOT"
IF USRNUM% < RNDNUM% + HOT% AND USRNUM% > RNDNUM% THEN ACCUR$ = "HOT HOT HOT"
IF USRNUM% > RNDNUM% - BURNING% AND USRNUM% < RNDNUM% THEN ACCUR$ = "BURNING HOT"
IF USRNUM% < RNDNUM% + BURNING% AND USRNUM% > RNDNUM% THEN ACCUR$ = "BURNING HOT"
COMP1% = RNDNUM% - LASTG%: COMP2% = RNDNUM% - USRNUM%: TH$ = " JUST TOO HIGH": TL$ = " JUST TOO LOW"
IF LASTG% < RNDNUM% AND USRNUM% > RNDNUM% THEN COMP2% = USRNUM% - RNDNUM%
IF USRNUM% < RNDNUM% AND LASTG% > RNDNUM% THEN COMP1% = LASTG% - RNDNUM%
IF COMP1% > COMP2% OR COMP1% < COMP2% - (COMP2% * 2) THEN
MESSAGE$ = "CLOSER THAN LAST TIME"
ELSEIF COMP1% < COMP2% OR COMP1% > COMP2% = (COMP2 * 2) THEN
MESSAGE$ = "NOT AS CLOSE AS LAST TIME"
END IF
IF USRNUM% < RNDNUM% THEN EC$ = TL$
IF USRNUM% > RNDNUM% THEN EC$ = TH$
IF COMP1% = COMP2% OR COMP1% = COMP2% - (COMP2% * 2) THEN MESSAGE$ = "SAME DIFFERANCE"
IF GC% > 1 THEN
LOCATE 18, 10: PRINT ACCUR$; " "; MESSAGE$; EC$
ELSEIF GC% = 1 THEN
LOCATE 18, 10: PRINT ACCUR$; " "; EC$
END IF
MESSAGE$ = "": LOCATE 20, 10
IF USRNUM% <> RNDNUM% THEN INPUT "PRESS ENTER TO TRY AGAIN...", CONT$
LOOP UNTIL USRNUM% = RNDNUM%
CLS
WHILE INKEY$ = ""
X% = INT(RND * 43) + 1: Y% = INT(RND * 72) + 1: CLRRND% = INT(RND * 14) + 1
LOCATE X%, Y%: COLOR CLRRND%, 0: PRINT "YOU WIN"
WEND
CLS : COLOR 12, 0: LOCATE 20, 20: PRINT " YOU WON, IT TOOK YOU"; GC%; "GUESSES"
LOCATE 22, 27: PRINT "THE NUMBER WAS "; RNDNUM%
IF GC% >= 1 AND MAINOPT% <> 2 THEN
OPEN "C:\GHS.TXT" FOR APPEND AS #1
PRINT #1, NME$
PRINT #1, GC%
PRINT #1, LVL$
CLOSE #1
END IF
END IF
IF MAINOPT% = 2 THEN
CLS
LOCATE 2, 1: PRINT "NAME": LOCATE 2, 12: PRINT "GUESSES": LOCATE 2, 28: PRINT "LEVEL"
PRINT ""
OPEN "C:\GHS.TXT" FOR INPUT AS #1
DO UNTIL EOF(1)
INPUT #1, NME2$, GC2$, LVL2$
PRINT NME2$, GC2$, LVL2$
LOOP
CLOSE #1
END IF
LOCATE 1, 1: INPUT "PRESS ENTER TO END...", CONT$: SYSTEM



Cr*ppy shooting game....


'SHOOT THE LIGHT V.01
DIM OLDY2 AS INTEGER, OLDY AS INTEGER, X AS INTEGER, YC AS INTEGER, Y AS INTEGER, Y2 AS INTEGER, SHOT AS INTEGER, LVL AS INTEGER
DIM TM AS SINGLE
TM = .5: LVL = 0
CLS
SCREEN 0
SHOT = 0
DO
X = 33
IF LVL < 4 THEN Y = 38 ELSE Y = 66
Y2 = 10: LOCATE 3, 8
DO
DO
CLS : LOCATE 1, 1: PRINT "LEVEL : "; LVL
LOCATE 20, 1: COLOR 12, 0
PRINT " ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °"
LOCATE 33, Y: PRINT "±"
LOCATE 20, Y2: COLOR 14, 0: PRINT "±"
COLOR 2, 0
IF Y2 = 10 THEN YC = -2
IF Y2 = 66 THEN YC = 2
OLDY2 = Y2: Y2 = Y2 - YC: OLDY = Y
IF Y = 66 OR Y = 10 THEN Y = Y - YC

T = TIMER
DO WHILE TIMER - T < TM
IF TIMER < T THEN T = T - 86400
LOOP

LOOP UNTIL INKEY$ > ""
BEEP
DO
IF LVL >= 4 THEN LOCATE X, OLDY ELSE LOCATE X, Y
COLOR 12, 0: PRINT "°": X = X - 1
LOOP UNTIL X < 21
X = 33: SHOT = SHOT + 1

IF OLDY = (Y2 - 2) OR OLDY2 = OLDY THEN
LOCATE 15, 15
PRINT "YOU SHOT ME DOWN DAMMIT!!!! IT TOOK YOU "; SHOT; "SHOTS"
LVL = LVL + 1
END IF

IF OLDY <> (Y2 - 2) AND OLDY2 <> OLDY THEN
LOCATE 15, 30: PRINT "YOU MISSED ME!! HA!"
END IF

DO UNTIL INKEY$ > ""
LOCATE 17, 27: PRINT "PRESS ANY KEY TO CONTINUE"
LOOP

LOOP UNTIL Y = (Y2 - 2)
TM = TM - .1:
IF TM < .2 THEN TM = .5
LOOP UNTIL LVL = 9
END

thats all that are really compleate for now....UNSEEN


    
This message has been edited by unseenmachine on Dec 22, 2009 5:54 PM


 
 Respond to this message   
 Copyright © 1999-2018 Network54. All rights reserved.   Terms of Use   Privacy Statement