Qbasicnews.com
July 22, 2019, 06:31:20 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] 3
  Print  
Author Topic: Obscurely coded pong  (Read 18112 times)
stylin
Ancient QBer
****
Posts: 445


« Reply #15 on: December 17, 2005, 04:15:46 PM »

Quote from: "axipher"
Well although this is abusing #define, now I know what it does, it could shorten programming by diong something like this:

Code:
#define @p PRINT
#define @i IF
#define @t THEN
etc...


It could take a while to define shortcuts for each command, but then typing long programs would be much easier would it not?

... Could you give an example program using those #defines?
Logged

stylin:
axipher
Ancient Guru
****
Posts: 544



« Reply #16 on: December 17, 2005, 05:05:07 PM »

Well I haven't really written a program using those, I was just guessing, i ave a ? at end of post don't I, I think from what I saw that would work, or can variables only have letters and numbers?
Logged
Anonymous
Guest
« Reply #17 on: December 17, 2005, 06:53:10 PM »

@axipher... you dont want that dude... all that will do is make your program harder to understand when you make mistakes and have to debug (like the rest of the imperfect world)
Logged
stylin
Ancient QBer
****
Posts: 445


« Reply #18 on: December 17, 2005, 07:21:48 PM »

Quote from: "Cha0s"
@axipher... you dont want that dude... all that will do is make your program harder to understand when you make mistakes and have to debug (like the rest of the imperfect world)

Well, in his defense this is an obfuscation contest. At any rate, yes axipher, in FreeBASIC, variable names can only contain letters, numbers, underscores and type symbols (same as in QB, less the underscores).

MACROs aren't variables, but my understanding is that the PP uses the same identifier rules, less the type symbols. Someone please clarify if this is incorrect.
Logged

stylin:
yetifoot
Ancient Guru
****
Posts: 575



« Reply #19 on: December 17, 2005, 07:28:15 PM »

try this one, its really fun (or not)

#define test test
test
Logged

EVEN MEN OF STEEL RUST.
Z!re
*/-\*
*****
Posts: 4599


« Reply #20 on: December 17, 2005, 08:34:31 PM »

yetifoot's code is the best =)
axipher is stupid..

Anything I missed?
Logged
Deleter
Na_th_an
*****
Posts: 1292



WWW
« Reply #21 on: December 17, 2005, 09:20:32 PM »

Quote from: "Z!re"
yetifoot's code is the best =)
axipher is stupid..

Anything I missed?

nope
Logged

KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #22 on: December 18, 2005, 03:17:38 PM »

Quote from: "Deleter"
Quote from: "Z!re"
yetifoot's code is the best =)
axipher is stupid..

Anything I missed?

nope


Funny. I was about to say that exact same thing

*whistles and looks around the room*
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #23 on: December 18, 2005, 03:52:42 PM »

I didn't even know FB had #define!

Yetifoot wins.
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
axipher
Ancient Guru
****
Posts: 544



« Reply #24 on: December 18, 2005, 04:13:20 PM »

Quote from: "KiZ"
Quote from: "Deleter"
Quote from: "Z!re"
yetifoot's code is the best =)
axipher is stupid..

Anything I missed?

nope


Funny. I was about to say that exact same thing

*whistles and looks around the room*


I know EH...  Hey, wait a minute :-? ,was that a dis :Huh: I think it was, but you missed one thing, I'm also a part of this board, think about how it would be if I never joined, these good times and someone to flame would have never happened now would they have Cheesy
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #25 on: December 18, 2005, 05:03:39 PM »

Not true. Someone else always joins *coughhardeepcough*.=p



@pong games: wow =D
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
axipher
Ancient Guru
****
Posts: 544



« Reply #26 on: December 18, 2005, 05:10:45 PM »

But I'm sure they either wouldn't be as annoying as me, or would me much more annoying then me and get banned :rotfl:
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #27 on: December 18, 2005, 05:18:19 PM »

Bah. Noone gets banned around here now Oracle is gone. :'( I miss those days...
Logged
Deleter
Na_th_an
*****
Posts: 1292



WWW
« Reply #28 on: December 18, 2005, 05:39:56 PM »

Maybe not as obscure, but fun to play Smiley
Code:
#define pingpong sub
#define ping if
#define pong then
#define paddle line
#define bouncy (
#define play end
#define p1ng elseif
#define pingpongtime timer
dim shared as single pongisfun=240,pw=16,boingboingboing=64,whypongisfun=0,ps=1,boing=320,boingboing=240,bxs,bys,br=10,ms=200,sx=640,sy=480,tm,cs,a,sc,sl=20
pingpong resetit()
    ps-=1
    boing=sx/2
    boingboing=sy/2
    pongisfun=sy/2-boingboingboing/2
    whypongisfun=0
    a= bouncy 1.5*rnd-.75)+3.14*int bouncy rnd*2)
    bxs=cos bouncy a)*ms
    bys=sin bouncy a)*ms
play pingpong
pingpong moveit()
    tm=pingpongtime-tm
    ping multikey bouncy 72) or multikey bouncy 80) pong whypongisfun+=ms*4*tm*sgn bouncy multikey bouncy 80)*2-1)    
    ping abs bouncy whypongisfun) > ms pong whypongisfun=ms*sgn bouncy whypongisfun)
    pongisfun+=whypongisfun*tm
    whypongisfun= bouncy 1-tm)*whypongisfun
    ping pongisfun < boingboingboing/2 pong
        pongisfun=boingboingboing/2
        whypongisfun=-whypongisfun
    play ping
    ping pongisfun > sy-boingboingboing/2 pong
        pongisfun=sy-boingboingboing/2
        whypongisfun=-whypongisfun
    play ping
    boing+=bxs*tm
    boingboing+=bys*tm
    ping boing >= sx-br pong
        boing=sx-br-1
        bxs=-bxs
    p1ng boing-br <= pw pong
        ping boingboing+br > pongisfun-boingboingboing/2 pong
            ping boingboing-br < pongisfun+boingboingboing/2 pong 'collide with paddle
                boing=pw+br
                bxs=-bxs
                ps+=1
            play ping
        play ping
        ping boing-br <= 0 pong resetit()
    play ping
    ping boingboing+br > sy pong
        boingboing=sy-br
        bys=-bys
    p1ng boingboing < br pong
        boingboing=br
        bys=-bys
    play ping
    sc+=tm*8
    tm=pingpongtime
play pingpong
pingpong drawit()
    cls
    me$="                    Obscure Pong Coded By: Deleter  -  Your Score: "+str$(ps)+"        Buy pi!             "
    ping int bouncy sc)>len bouncy me$)-sl/2 pong sc=1
    locate 1,(sx/16+1)-sl/2
    print mid$(me$,int bouncy sc),int bouncy sl))    
    circle bouncy boing,boingboing),br,7
    paddle bouncy 0,pongisfun-boingboingboing/2)-(pw-1,pongisfun+boingboingboing/2),4,b
    paddle bouncy sx/2-sl*4-2,-1)- bouncy sx/2+sl*4+2,10),4,b
    paddle bouncy sx/2-sl*4-3,-1)-bouncy sx/2+sl*4+3,11),12,b
    paddle bouncy sx/2-sl*4-1,-1)-bouncy sx/2+sl*4+4,12),4,b    
play pingpong
tm=pingpongtime
randomize pingpongtime
screenres sx,sy,8,2
sleep 10
resetit
do
    moveit
    drawit
    sleep 1,1
    screenset cs,- bouncy cs-1)
    cs=- bouncy cs-1)
loop until multikey bouncy 1)
Logged

axipher
Ancient Guru
****
Posts: 544



« Reply #29 on: December 18, 2005, 06:00:12 PM »

Your right, it is pretty fun to play, although making the ball go faster and faster would be nice.
Logged
Pages: 1 [2] 3
  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!