Qbasicnews.com
December 15, 2019, 09:27:00 AM *
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 [2]
  Print  
Author Topic: New Challenge for hardcore QBers  (Read 9406 times)
QB_GEEK
New Member

Posts: 3


« Reply #15 on: June 01, 2003, 03:29:22 AM »

Coool progs for very little code, apart for the long one LOL....

 :lol:

QB_GEEK
Logged
pr0gger
I hold this place together
*****
Posts: 775


« Reply #16 on: June 01, 2003, 04:34:51 PM »

So if you lose, it fills the screen like so:

YOU LOSE

, but if you win:


You win.

Does anyone else see the irony in this  :lol: Wink
Logged

size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #17 on: June 01, 2003, 06:53:56 PM »

64 lines classic pong (with original pong aesthetics):

(I cheated, of course. Made extensive use of ':', but aw, it is fun)

Use
LEFT SHIFT/LEFT CTRL to move left paddle and
RIGHT SHIFT/RIGHT ALT (Alt Gr) to move the right paddle.

Code:
'$DYNAMIC
DIM SHARED numeros%(9, 4, 2)
TYPE PelotaTipo
   x AS INTEGER
   y AS INTEGER
   vx AS INTEGER
   vy AS INTEGER
END TYPE
TYPE RaquetaTipo
   y AS INTEGER
   puntos AS INTEGER
END TYPE
DIM pelota AS PelotaTipo, Raqueta1 AS RaquetaTipo, Raqueta2 AS RaquetaTipo
RESTORE numeros: FOR i% = 0 TO 9: FOR j% = 0 TO 4: FOR k% = 0 TO 2: READ numeros%(i%, j%, k%): NEXT k%, j%, i%
PRINT "Just PONG! by NATHAN @ WOPR": PRINT "Left paddle: left_shift/ctrl, Right paddle: right_shift/alt": PRINT "Press any key to serve. ­enjoy!": SLEEP: k$ = INKEY$: SCREEN 7, , 1, 0
pelota.x = 15400: pelota.y = 9200: Raqueta1.y = 8000: Raqueta1.puntos = 0: Raqueta2.y = 8000: Raqueta2.puntos = 0: terminado% = 0: acabado% = 0: Incr% = 200: DEF SEG = 0
WHILE NOT terminado%
   PintaPantalla Raqueta1, Raqueta2, pelota: PCOPY 1, 0
   WHILE INKEY$ = "": WEND: acabado% = 0: k% = INT(RND * 2) - 1
   IF k% THEN pelota.vx = -200 ELSE pelota.vx = 200
   pelota.vy = INT(RND * 201) - 100: pelota.x = 15400: pelota.y = 9200
   IF Raqueta1.puntos = 100 OR Raqueta2.puntos = 100 THEN Raqueta1.puntos = 0: Raqueta2.puntos = 0
   WHILE NOT acabado%
      k$ = INKEY$: pelota.x = pelota.x + pelota.vx: pelota.y = pelota.y + pelota.vy: Incr% = ABS(pelota.vx \ 100) * 100
      IF (PEEK(1047) AND 2) AND Raqueta1.y > 800 THEN Raqueta1.y = Raqueta1.y - Incr%
      IF (PEEK(1047) AND 4) AND Raqueta1.y < 15200 THEN Raqueta1.y = Raqueta1.y + Incr%
      IF (PEEK(1047) AND 1) AND Raqueta2.y > 800 THEN Raqueta2.y = Raqueta2.y - Incr%
      IF (PEEK(1047) AND 8) AND Raqueta2.y < 15200 THEN Raqueta2.y = Raqueta2.y + Incr%
      IF INP(&H60) = 1 THEN acabado% = -1: terminado% = -1
      IF pelota.x <= 800 AND pelota.y - Raqueta1.y < 4000 AND pelota.y - Raqueta1.y > -700 THEN pelota.vx = -pelota.vx - SGN(pelota.vx) * 8: d% = Raqueta1.y + 2000 - pelota.y: pelota.vy = pelota.vy - Signo%(pelota.vy) * d% \ 10
      IF pelota.x >= 30400 AND pelota.y - Raqueta2.y < 4000 AND pelota.y - Raqueta2.y > -700 THEN pelota.vx = -pelota.vx - SGN(pelota.vx) * 8: d% = Raqueta2.y + 2000 - pelota.y: pelota.vy = pelota.vy - Signo%(pelota.vy) * d% \ 10
      IF pelota.y >= 18400 OR pelota.y <= 800 THEN pelota.vy = -pelota.vy
      IF pelota.x <= 0 THEN acabado% = -1: Raqueta2.puntos = Raqueta2.puntos + 1
      IF pelota.x >= 31200 THEN acabado% = -1: Raqueta1.puntos = Raqueta1.puntos + 1
      PintaPantalla Raqueta1, Raqueta2, pelota
      WAIT &H3DA, 8: WAIT &H3DA, 8, 8: PCOPY 1, 0
   WEND
WEND
SCREEN 0: WIDTH 80: PRINT "(C) NATHAN @ WOPR, email: na_th_an@hotmail.com"
numeros:
DATA 1,1,1,1,0,1,1,0,1,1,0,1,1,1,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,1
DATA 0,0,1,0,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,1,0,0,1

SUB PintaNumero (x%, y%, punto$)
   FOR i% = 1 TO LEN(punto$): m% = ASC(MID$(punto$, i%, 1)) - ASC("0"): FOR j% = 0 TO 4: FOR k% = 0 TO 2
   IF numeros%(m%, j%, k%) = 1 THEN LINE (x% * 8 + k% * 8, y% * 8 + j% * 8)-(7 + x% * 8 + k% * 8, 7 + y% * 8 + j% * 8), 15, BF
   NEXT k%: NEXT j%: x% = x% + 4: NEXT i%
END SUB

SUB PintaPantalla (Raqueta1 AS RaquetaTipo, Raqueta2 AS RaquetaTipo, pelota AS PelotaTipo)
   LINE (0, 0)-(319, 199), 0, BF: LINE (0, 0)-(319, 7), 15, BF: LINE (0, 192)-(319, 199), 15, BF: FOR i% = 8 TO 192 STEP 16: LINE (156, i%)-(164, i% + 8), 15, BF: NEXT i%
   px% = pelota.x \ 100: py% = pelota.y \ 100: LINE (px%, py%)-(7 + px%, 7 + py%), 15, BF: ry% = Raqueta1.y \ 100: LINE (0, ry%)-(7, ry% + 39), 15, BF: ry% = Raqueta2.y \ 100: LINE (312, ry%)-(319, ry% + 39), 15, BF
   punto$ = LTRIM$(STR$(Raqueta1.puntos)): IF LEN(punto$) = 1 THEN punto$ = "0" + punto$
   PintaNumero 5, 2, punto$
   punto$ = LTRIM$(STR$(Raqueta2.puntos)): IF LEN(punto$) = 1 THEN punto$ = "0" + punto$
   PintaNumero 29, 2, punto$
END SUB

FUNCTION Signo% (a%)
   IF a% < 0 THEN Signo% = -1 ELSE Signo% = 1
END FUNCTION

' and...
' LINE 64 LOL


Enjoy!

PS: That's what I call "horizontal programming" LOL
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #18 on: June 01, 2003, 09:05:38 PM »

Shocked

Where can I find the "origional pong" if it exists???

ps: na_th: that goes in the limited line category at QBNZ. That's awesome for 64 lines!!!
Logged

toonski84
__/--\__
*****
Posts: 2567



« Reply #19 on: June 01, 2003, 10:45:14 PM »

the original pong (discounting the 1959 one made on an osiolliscope (sp)) is an arcade game made in the 70s.  I dont think its circuits are even digital, because it can't be emulated.
Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #20 on: June 01, 2003, 11:01:54 PM »

Oh well...

Anyone make a spacies clone?
Logged

na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #21 on: June 02, 2003, 07:12:40 AM »

Pong was "hard coded" in analogic board circuits (no microprocessor). You can find the Atari 2600 version, though, as the most ancient (1977).
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: 1 [2]
  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!