May 07, 2024, 03:29:31 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Samples from the Coding Competition i miss such entertainment :-/

Started by pistol350, September 04, 2007, 11:06:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

Yeah Guys!
It's a pity any Coding competion is not organised among us anymore.
Competions like the 1K coding competition were so!!!!
It just gives me the impression that people no longer code for fun and only for busines purpose , a big shame  :-\
Anyway, just have a look to the great examples we could see when Coders coded for fun  :P

Freddy fish from Zerodog.
Don't worry if you don't understand a word from the code.LOL
it was done on purpose to limit the size of the code to fit in the competition requirements

def W:WINDOW:def S,U[20],R:INT:def V[120]:FLOAT:z=36:a=1.4:b=.6:c=30
V=0,0,-2,0,b,1,.3,z,z,z,c,0,0,1,b,0,1,2.4,5.6,8
V[20]=31,3,-5.2,1,1,1,1,a,a,a,29,3,-5.2,1,1,1,1,a,a,a
V[40]=31,3,-6.2,0,0,0,1,b,b,b,29,3,-6.2,0,0,0,1,b,b,b
V[60]=c,5,3,1,b,0,1,.1,a,6,c,-5,3,1,b,0,1,.1,1,5
V[80]=c,0,5,1,b,0,1,b,2,7,c,-2,5,1,b,0,1,.1,1,6
V[100]=0,25,0,1,0,0,1,28,8,28,0,-25,0,1,0,0,1,z,8,z
window W,0,0,0,0,64,0,"",P:create3dscreen W,640,480,32:S=D3DSCENE(W):U[0]=d3dshape(S,3):U[13]=d3dcamera(S):U[14]=d3dlight(S,3,1,1,1):D3DSETQUALITY W,137:D3DSETRENDERMODE W,19:d3dcommand U[13],1,S,0,0,-99:D3DCOMMAND U[0],2,S,0,1,0,.05:for x=1 to 12:z=(x-1)*10:U[x]=d3dshape(S,0,1,c):d3dcommand U[x],1,S,V[z],V[z+1],V[z+2]:d3dcommand U[x],5,V[z+3],V[z+4],V[z+5],V[z+6]:d3dcommand U[x],17,V[z+7],V[z+8],V[z+9]:next x:for x=2 to 10:D3DCOMMAND U[0],4,U[x]:next x:waituntil(r):for x=0 to 14:d3ddelete U[x]:next x:d3ddelete S:closewindow W:end
P::if @CLASS=32780:if getkeystate(27)then R=1:d3dmove W,1:d3drender(S,U[13]):dxflip W:endif:return
Regards,

Peter B.

pistol350

Final Blue screen By Zerodog

[code]def W:WINDOW:def S,T,U[20],L,R,V[114]:INT:z=16:H=17:J=19
V=35,35,35,0,0,0,30,5,37,0,-H,-2,15,15,15,0,-15,0,25,3,25,0,-25,0
V[24]=2,1,2,14,-H,-21,36,5,5,0,-z,-J,36,5,5,0,z,-J,4,28,5,-z,0,-J
V[48]=4,28,5,z,0,-J,10,5,1,11,-14,H,1,10,1,0,7,H,1,13,1,-2,7,H
V[72]=1,14,1,-4,7,H,1,15,1,-6,7,H,1,14,1,-8,7,H,1,13,1,-10,7,H
V[102]=1,10,1,-12,7,H,30,30,30,0,0,-5
window W,0,0,0,0,64,0,"",P
create3dscreen W,640,480,z
S=D3DSCENE(W)
U[J]=d3dshape(S,3)
T=d3dcamera(S)
L=d3dlight(S,3,1,1,1)
D3DSETQUALITY W,136
d3dcommand T,1,S,0,0,-99
D3DCOMMAND U[J],4,T
D3DCOMMAND U[J],2,S,.5,1,.1,.05
for x=0 to 18
z=x*6
U[x]=d3dshape(S,1,V[z],V[z+1],V[z+2])
d3dcommand U[x],1,S,V[z+3],V[z+4],V[z+5]
next x
for x=5 to H
d3dcommand U[x],5,.5,.5,.5
next x
D3DCOMMAND U[J],4,L
SETCURSOR w,2,0

waituntil(r)
for x=0 to J
d3ddelete U[x]
next x
d3ddelete L:d3ddelete T:d3ddelete S:closewindow W:end

sub P
if @CLASS=32780
if getkeystate(27)then R=1
d3dmove W,1
d3dcommand U[18],5,0,0,rnd(j/j)
d3drender(S,T)
dxflip W
endif:return
[/code]
Regards,

Peter B.

pistol350

GlowSticks by Zerodog
' GlowSticks
def w:WINDOW
def C,K,S[21],Q,Z,d,F:INT
def e[3]:float
window w,0,0,0,0,64,0,"",A
SETCURSOR w, 2,0
create3dscreen w,640,480,16
C=D3DSCENE(w)
S[20]=d3dshape(C,3)
K=d3dcamera(C)
D3DSETQUALITY w,128
D3DSETRENDERMODE  w,3
d3dcommand K,1,C,0,0,-45
D3DCOMMAND K,29,.1
D3DCOMMAND S[20],4,K
for x=0 to 19
S[x]=d3dshape(C,1,100,10,10)
d3dcommand S[x],5,0,.75,1,.1+x/20
next x
starttimer w,(5000)
waituntil (Q)
for x=0 to 20
d3ddelete S[x]
next x
d3ddelete K
d3ddelete C
closewindow w
end
A:
select @class
   CASE 258
    if F=0
    D3DSETQUALITY w,64
    F=1
else
D3DSETQUALITY w,128
F=0
endif
case 32780
if getkeystate(27) then Q=1
d3dmove w,1
d3drender(C,K)
dxflip w
if z<20
d3dcommand S[19-z],2,C,.1,.1,0,10/100
z=z+1
else
d3dcommand S[20],2,C,0,0,1,.005
endif
  case 275
d=rnd(9)
select d
  case 0
e=1,0,0
  case 1
e=0,1,0
  case 2
e=0,0,1
  case 3
e=1,0,1
  case 4
e=1,1,0
  case 5
e=0,1,1
  CASE 6
e=1,.5,0
  CASE 7
e=.5,0,1
  CASE 8
e=0,.5,0
  CASE 9
e=0,1,.5
endselect
for x=0 to 19
d3dcommand S[x],5,e[0],e[1],e[2],.1+x/20
next x
endselect
return
Regards,

Peter B.

pistol350

A nice game from Boris
Yo man Where are you ???

declare mb(x:int,y:int)
def w1:window:def l,t,w,h,b,lb,tb,s,ok:int:c=&hfffffe:a=&hffffff
window w1,0,0,166,192,0,0,"Tiles",w1h
for id=0 to 14:i=floor(id/4)*40:control w1,"b,"+str$(id+1)+"  ,id%4*40,i,40,40,@ctlbtnflat,id+1":next id
rect w1,15%4*40,i,40,40,c,c:control w1,"b,,0,0,0,0,0,16"
getsize w1,lb,tb,w,h,16:setsize w1,0,0,166,192-29+tb:starttimer w1,200:ok=1
waituntil w1=0:end
w1h:
select @class
case @idcontrol*ok
b=@controlid:getsize w1,l,t,w,h,b:l=l-lb:t=t-tb
select 1
case (getpixel(w1,l+20,t-20)=c):mb(0,-1)
case (getpixel(w1,l-20,t+20)=c):mb(-1,0)
case (getpixel(w1,l+60,t+20)=c):mb(1,0)
case (getpixel(w1,l+20,t+60)=c):mb(0,1)
endselect
case @idtimer*ok:getsize w1,lb,tb,w,h,16
case @idclosewindow:closewindow w1
endselect
return
sub mb(x,y):ok=0
rect w1,l,t,w,h,c,c:rect w1,l+(40*x),t+(40*y),w,h,a,a
for n=1 to 40:setsize w1,l+(n*x),t+(n*y),w,h,b:for nn=1 to 8:wait 1:next nn:next n
s=s+1:setcaption w1,"Tiles :"+str$(s)+" moves":ok=1
return
Regards,

Peter B.

pistol350

Another funny game from boris.
This man is so clever in doing funny games  :o
'catch the button.iba
def w1:window
def score,time:int

main:
window w1,0,0,640,480,@caption|@minbox|@maxbox,0,"",w1hnd
control w1,"b,OK,1000,1000,20,20,0,1"
starttimer w1,1000,1:starttimer w1,31000,2
setwindowcolor w1,&h00bbcc:time=31
waituntil w1=0
end

w1hnd:
select @class
case @idtimer
   if @code=1
      time=time-1
      setsize w1,rnd(610)+5,rnd(420)+5,30,20,1
      setcontroltext w1,1,ltrim$(str$(time))
   else
      stoptimer w1,1:stoptimer w1,2
      enablecontrol w1,1,0
      control w1,"b,GAME OVER,250,200,100,30,0,2"
   endif
case @idcontrol
   if @controlid=1
      setwindowcolor w1,0
      score=score+1
      setcaption w1,"Score:"+str$(score)
      setwindowcolor w1,&h00bbcc
   else:if @controlid=2
      closewindow w1
   endif:endif
case @idcreate
   centerwindow w1
case @idclosewindow
   closewindow w1
endselect
return
Regards,

Peter B.