Yet another game challenge...:D - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Yet another game challenge...:D (/thread-4987.html) Yet another game challenge...:D - VonGodric - 11-02-2004 I was doing some stuff in VB and using option explicit when I came to an idea. There are lot of game challenges like on line and four line or each keyword only once and stuff like that. Well here's another one of that kind. Game (but can be any other program too) challenge where you can use each data type only once. Variables allowed:NO constants one integer one long one single one double one string Yet another game challenge...:D - whitetiger0990 - 11-02-2004 [syntax="QBASIC"]CLS RANDOMIZE TIMER DIM SHARED stringvar AS STRING DIM integervar AS INTEGER DIM longvar AS LONG DIM singlevar AS SINGLE DIM doublevar AS DOUBLE OPEN "vars.dat" FOR RANDOM AS #1 stringvar = "pineapple" '1 = x '2 = y '3 = xv '4 = yv SCREEN 13 stringvar = "50" PUT #1, 1, stringvar stringvar = "50" PUT #1, 2, stringvar stringvar = "0" PUT #1, 3, stringvar stringvar = "1" PUT #1, 4, stringvar PSET (INT(RND * 320) + 1, INT(RND * 200) + 1), 1 DO GET #1, 1, stringvar integervar = VAL(stringvar) GET #1, 2, stringvar singlevar = VAL(stringvar) IF POINT(integervar - 2, singlevar) = 1 THEN END IF POINT(integervar, singlevar - 2) = 1 THEN END IF POINT(integervar + 2, singlevar) = 1 THEN END IF POINT(integervar, singlevar + 2) = 1 THEN END PSET (integervar - 1, singlevar), 0 PSET (integervar, singlevar - 1), 0 PSET (integervar + 1, singlevar), 0 PSET (integervar, singlevar + 1), 0 PSET (integervar, singlevar), 4 GET #1, 3, stringvar integervar = integervar + VAL(stringvar) stringvar = STR\$(integervar) PUT #1, 1, stringvar GET #1, 4, stringvar singlevar = singlevar + VAL(stringvar) stringvar = STR\$(singlevar) PUT #1, 2, stringvar SELECT CASE INKEY\$ CASE "q": END CASE "s" stringvar = "0" PUT #1, 3, stringvar stringvar = "1" PUT #1, 4, stringvar CASE "w" stringvar = "0" PUT #1, 3, stringvar stringvar = "-1" PUT #1, 4, stringvar CASE "a" stringvar = "-1" PUT #1, 3, stringvar stringvar = "0" PUT #1, 4, stringvar CASE "d" stringvar = "1" PUT #1, 3, stringvar stringvar = "0" PUT #1, 4, stringvar END SELECT doublevar = TIMER DO: LOOP UNTIL TIMER - doublevar > .01 LOOP[/syntax] the object is to run into the blue dot. i think....