# Qbasicnews.com

Full Version: EDIT: Make a game in 10 lines or less.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Rules:

Pure QB
No externel files (for graphics, etc)
Must be 10 lines or less
No : (except for line labels)

Here we (or I...) go!

(I tried making it with 5, but it is impossible)
Ooh, I'll do this, just as soon as I make a game for my challenge.
Code:
```'this is an amazingly fun game - not. 'press enter when the screen chages colour 'you may need to change the numbers depending on the speed of your system 1 : SCREEN 13 2 : RANDOMIZE TIMER 3 : FOR a = 1 TO INT(RND * 10000000) + 5000000 4 : NEXT 5 : LINE (0, 0)-(320, 200), 5, BF 6 : DO 7 : khb\$ = INKEY\$ 8 : b = b + 1 9 : LOOP UNTIL b = 80000 OR khb\$ = CHR\$(13) 10 : IF b = 80000 THEN PRINT "You lose" ELSE PRINT "You win"```
Hahaha...

God job! I am working on one that has no flicker, a border, and is synchronized so it runs the same speed on different computers.
Well, I have to shave 6 lines off of mine, but so far mine has 0 flicker, runs the same speed on every computer, has a border around it's screen, and notifies you if you lose. The game itself is sort of like Pong. But it is 16 lines!! This'll be hard.
heres mine
Code:
```' Stop the number with the space bar and try to get within 100 away from 2500! 1 CLS 2 SCREEN 13 3 FOR i = 1 TO 5000 4 LOCATE 1, 1 5 PRINT i 6 IF INKEY\$ = CHR\$(32) THEN EXIT FOR 7 NEXT 8 IF 2500 - i > -100 AND 2500 - i < 100 THEN PRINT "YAY, you got within 100!" ELSE PRINT "Haha you lose"```

andy: with yours you can press etner before the screen changes and win
edit: heres another =P
Code:
```'press space when the numbers are next to eachother 1 CLS 2 FOR s = 0 TO 74 3 FOR i = 1 TO 5 4 IF i = 1 THEN LOCATE 10, 1 + s ELSE IF i = 2 THEN PRINT 1 ELSE IF i = 3 THEN LOCATE 11, 75 - s ELSE IF i = 4 THEN PRINT 2 ELSE IF i = 5 THEN t = TIMER 5 NEXT i 6 DO 7 LOOP UNTIL TIMER - t >= .0001 8 IF INKEY\$ = CHR\$(32) THEN EXIT FOR 9 NEXT s 10 IF 75 - s = 1 + s THEN PRINT "YOU WIN" ELSE PRINT "YOU LOSE"```
That was cool whitetiger I liked :bounce:
This one is 11 lines, I can't see anyway of getting it down to 10. Its a hangman game with only 3 different words in it (although more could be added without increasing the line count), the game will continue even after you have won or lost, just press ctrl+break after the "game over" or "you win" message appears.

Code:
```1 FOR i = 0 TO 9 2 IF i = 0 THEN RANDOMIZE TIMER ELSE IF i = 1 THEN DIM w\$(3) ELSE IF i = 2 THEN DIM g(8) ELSE IF i = 3 THEN SCREEN 7 ELSE IF i = 4 THEN w\$(1) = "word" ELSE IF i = 5 THEN w\$(2) = "qbasic" ELSE IF i = 6 THEN w\$(3) = "game" ELSE IF i = 7 THEN n = INT(3 * RND + 1) ELSE IF i = 8 THEN LOCATE 2, 2 ELSE IF i = 9 THEN PRINT STRING\$(LEN(w\$(n)), "-") 3 NEXT 4 FOR i = 0 TO 4 5 IF i = 0 THEN LOCATE 20, 1 ELSE IF i = 1 THEN INPUT "Guess: ", k\$ ELSE IF i = 2 THEN p = INSTR(w\$(n), k\$) ELSE IF i = 3 THEN IF p > 0 AND g(p) = 0 THEN GOSUB 9 ELSE h = h + 1 6 NEXT 7 IF h = 1 THEN CIRCLE (50, 50), 11, 15 ELSE IF h = 2 THEN LINE (50, 60)-(50, 80), 15 ELSE IF h = 3 THEN LINE (40, 70)-(60, 70), 15 ELSE IF h = 4 THEN LINE (50, 80)-(40, 90), 15 ELSE IF h = 5 THEN LINE (50, 80)-(60, 90), 15 ELSE IF h = 6 THEN LINE (50, 30)-(50, 40), 15 ELSE IF h = 7 THEN PRINT "Game Over" 8 GOTO 4 9 FOR i = 0 TO 5 10 IF i = 0 THEN LOCATE 2, 1 + p ELSE IF i = 1 THEN PRINT MID\$(w\$(n), p, 1);  ELSE IF i = 2 THEN g(p) = 1 ELSE IF i = 3 THEN l = l + 1 ELSE IF i = 4 THEN IF l = LEN(w\$(n)) THEN PRINT " You Win!" ELSE ambiguity = 1 ELSE IF i = 5 THEN RETURN 11 NEXT```
Good job getting it down to eleven. The hard part is making the word random. Mine is 16 lines, and is a real-time pong sort of game. What I have so far is:

No flicker
All of the physics
A "You lose" screen
Same speed for each computer regardless of how good the computer is