Full Version: Obscurely coded pong
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
This may have been done...I think I recall something like it but I searched and didn't find it.
Anywho, I want you folks to design a Pong game, but code it as annoyingly and obscurely as possible. That means loads of GOTO's and useless obscurification, as confusing as possible.
The rules:
a) Must be FB compatible
b) No non-native libs allowed, only the built-in FB lib.
c) May be for one or two players, but if it's for two players they must both be humans. No AI allowed.
d) Only three seperate statements on each line. That is to say, only 2 colons ":" are allowed. Example: print "hello":print "world":print "dude" is allowed, but nothing more.
How is pong for one person without an AI opponent? You play against the wall or what?
i didnt write this pong, i took it from ABC, but heres a quick jobbie using define

#define biff Locate
#define bibble Option Explicit
#define chog Screen 12
#define z Dim Shared
#define y As Integer
#define x As Single
#define w Case
#define v gg = gg +
#define u End Sub
#define t Select
#define s As String
#define r Sub
#define q ee + 20
#define p If
#define o Line
#define n Circle
#define m CHR$(255)
#define l Then
#define k Print
#define j Loop
#define i End
#define h Else
#define g Sleep
#define f ()
#define e INKEY$
#define d Do
#define c Until
#define a To
#define kjh OR
#define kjj - 20
#define cof cc = cc * -1
#define bof dd = dd * -1
z aa y:z bb y:z cc x:z dd x:z ee y:z ff y:z gg y:z hh s
r ii (aa, jj)
o (615,aa+50)-(630,aa-50),jj,B
r pq f
r xzx f
k "GAME OVER":g:i
r bv f
p aa<0 l aa=0
r vb f
p aa>480 l aa=480
r jug f
d c e=" ": j
r xzy f
t w ff
w aa-55 a aa+55
cc = cc*-1:v 1:w 0 a aa-44:xzx
w aa+55 a 480
w h
cc = cc*-1:v 1:i t
r lk f
ii(240, 4)
biff 1, 1: k gg
n (ee,ff),20,0:ee=ee+cc:ff=ff+dd
n (ee,ff),20,2
p q > 640 kjh q < 0 l cof
p ee kjj < 0 kjh q < 0 l cof
p ff kjj > 480 kjh ff + 20 > 480 l bof
p ff kjj < 0 kjh ff + 20 < 0 l bof
p q >= 614 l xzy
hh$ = e
t w hh$
w m + "H"
w m + "P"
w "q"
w "p"
i t


Quote:How is pong for one person without an AI opponent? You play against the wall or what?

Yetifoot: heheh, that's a start. Now ruin it more with gotos.
im kicking myself really cause the original program was all gotos, real spaghetti stuff, and for some dumb reason i sat there and subbed it all!!
Screen 18,,,1 : Cls          
points = 0
Goto begin:
Line (0,playery)-(10,playery+50), 15,bf
a$ = Inkey$
If a$ = "w" And playery > 0 Then playery-=20  
If a$ = "s" And playery < (479-50) Then playery+=20
If a$ = Chr$(27) Then End
Goto ball
ballx+=ballxvel : bally += ballyvel
Circle (ballx+10, bally+10), 10  
Goto collision
Locate 1, 35: Print points
Sleep 16 :  Goto start
ballx= 10 : bally = 10
ballxvel=5 : ballyvel = 5
Goto start
If ballx <= 0 Then Goto begin
If ballx <= 10 And bally > playery And bally < playery+50 Then
ballxvel = -ballxvel
End If
If bally <= 0 Then ballyvel = -ballyvel
If ballx >= 639 Then ballxvel =-ballxvel
If bally >= 479 Then ballyvel = -ballyvel
Goto endloop

Bounce the ball off the wall. Each time you bounce the ball off the paddle, you get a point. Use the lower-case 'w' and 'a' keys to move the paddle up and down. Took me about half an hour to write.
Quote:d) Only three seperate statements on each line. That is to say, only 2 colons ":" are allowed. Example: print "hello":print "world":print "dude" is allowed, but nothing more.
Doesn't this sorta defeat a major obfuscation technique? Big Grin
i broke that rule
Wow... my head hurts now.

drawing on yeti's idea (this also breaks the rule, but what the hell)
[syntax="qbasic"]#define x if
#define xx then
#define xxx else
#define xxxx do
#define xxxxx loop
#define xxxxxx until
#define z and
#define zx line
#define zxxx input
#define zxxxx multikey
#define zxxxxx circle
#define xz wait
#define xzx flip
#define xzxx cls
#define xzxxx goto
#define xzxxxx end
#define xxz screenset
#define xxzx dim as single
#define xxzxx screen
#define xxzxxx dim as string

xxzxx 14,,2
xxz 0, 1:xxzx zxxz, zxzx, zxzz:xxzxxx zzxx, zzzx, zzzz, zzzxx
zxz = 160:zxxz = 160:zxzx = 50:zxzz = 1:zzzz = "y":y = 35
yx = 0:yyx = 265:yyyx = 200:yyyyx = 1:yyyyyx = 260:xy = 40
xyx = 0.001:xyxx = 5:xyxxx = 175:xyxxxx = 195:xyxxxxx = 190
xxy = 240:xxyx = 75:xxyxx = 77:xxyxxx = 180:xxxy = 20
xxxyx = 60:xxxyxx = 8:xxxyxxx = &h3da:xxxxy = 3
xxxx: zx(y, yx)-(yyx, yyyx), , b: x zzx = yyyyx xx zxxz = zxxz + zxzz xxx zxxz = zxxz - zxzz
x zxxz < xy xx zzx = yyyyx xxx x zxxz > yyyyyx xx zzx = yx
zxzz = zxzz + xyx:x zzz = yyyyx xx zxzx = zxzx + zxzz xxx zxzx = zxzx - zxzz
x zxzx < xyxx xx zzz = yyyyx xxx x zxzx > xyxxx z zxxz > zxz - xxxy z zxxz < zxz + xxxy xx zzz = yx
x zxzx > xyxxxx xx xxz yyyyx,yyyyx: zxxx "play again"; zzzxx: x zzzxx=zzzz xx xzxxx xzzxzzx xxx xzxxxx
zxxxxx(zxxz, zxzx), xyxx: x zxxxx(xxyx) z zxz > xxxyx xx zxz=zxz-xxxxy
x zxxxx(xxyxx) z zxz < xxy xx zxz = zxz+xxxxy
zx (zxz-xxxy,xxyxxx)-(zxz+xxxy,xyxxxxx),,b:xz xxxyxxx,xxxyxx:xzx:xzxx:xxxxx xxxxxx zxxxx(yyyyx)[/syntax]
Pages: 1 2 3 4