Posts: 3,616
Threads: 287
Joined: Jan 2003
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.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 838
Threads: 17
Joined: Jan 2002
How is pong for one person without an AI opponent? You play against the wall or what?
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Posts: 484
Threads: 14
Joined: Apr 2005
i didnt write this pong, i took it from ABC, but heres a quick jobbie using define
Code: #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
bibble
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
u
r pq f
bb=200:cc=bb/100:dd=cc:ee=575:ff=240:aa=ff:gg=0
u
r xzx f
k "GAME OVER":g:i
u
r bv f
ii(aa,0):aa=aa-15
p aa<0 l aa=0
ii(aa,4)
u
r vb f
ii(aa,0):aa=aa+15
p aa>480 l aa=480
ii(aa,4)
u
r jug f
d c e=" ": j
u
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
xzx
w h
cc = cc*-1:v 1:i t
u
r lk f
chog
pq
ii(240, 4)
d
ScreenSync
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"
bv
w m + "P"
vb
w "q"
i
w "p"
jug
i t
j
u
lk
EVEN MEN OF STEEL RUST.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Quote:How is pong for one person without an AI opponent? You play against the wall or what?
Precisely.
Yetifoot: heheh, that's a start. Now ruin it more with gotos.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 484
Threads: 14
Joined: Apr 2005
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!!
EVEN MEN OF STEEL RUST.
Posts: 320
Threads: 24
Joined: Feb 2005
Code: Screen 18,,,1 : Cls
points = 0
Goto begin:
start:
Cls
Line (0,playery)-(10,playery+50), 15,bf
inputsec:
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
ball:
ballx+=ballxvel : bally += ballyvel
Circle (ballx+10, bally+10), 10
Goto collision
endloop:
Locate 1, 35: Print points
Sleep 16 : Goto start
begin:
playery=0
ballx= 10 : bally = 10
ballxvel=5 : ballyvel = 5
Goto start
collision:
If ballx <= 0 Then Goto begin
If ballx <= 10 And bally > playery And bally < playery+50 Then
ballxvel = -ballxvel
points+=1
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.
.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Posts: 719
Threads: 42
Joined: Oct 2005
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?
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Posts: 484
Threads: 14
Joined: Apr 2005
i broke that rule
EVEN MEN OF STEEL RUST.
Posts: 2,771
Threads: 96
Joined: Oct 2003
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
xzzxzzx:
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]
|