Qbasicnews.com
October 17, 2018, 08:04:07 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Yet another game challenge...:D  (Read 3897 times)
VonGodric
Ancient Guru
****
Posts: 674



WWW
« on: November 02, 2004, 08:39:04 AM »

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:[/color]
    NO constants
    one integer
    one long
    one single
    one double
    one string
Logged

url]http://fbide.sourceforge.net/[/url]
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: November 02, 2004, 01:19:50 PM »

[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....
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!