Page 6 sur 22

Re: Compétition PurePunch Juillet-Août 2014

Publié : jeu. 10/juil./2014 13:59
par graph100
honnêtement tu vas être obligé de couper des choses.

Pour mon punch, je suis passé de 525 lignes à 50 tout pile, et en utilisant la totalité des astuces que je connais.
Et ça n'a fonctionné que parce que pb autorise des instructions multilignes maintenant.

En plus mon code de 525 était fait pour être lisible : c'est à dire aéré et avec quelques commentaire.
De mon avis et expérience (avec l'autre punch), le ratio maximum entre un code lisible et un punch est de 10 fois.

Sinon j'ai pensé faire un crunsher, mais j'ai la flemme de m'y lancer, surtout qu'il faut détecter correctement la totalité de la syntaxe de PB, (pas compliqué, mais long à metre en place).
Ca serait bien un projet hors punch parce que je ne le finirais pas avant la fin de celui-ci :roll:

Re: Compétition PurePunch Juillet-Août 2014

Publié : jeu. 10/juil./2014 14:45
par Backup
graph100 a écrit :P surtout qu'il faut détecter correctement la totalité de la syntaxe de PB,
non , je ne pense pas que ce soit utile ..
ya moyen de faire bien plus simple ...je pense :)

Re: Compétition PurePunch Juillet-Août 2014

Publié : jeu. 10/juil./2014 17:13
par G-Rom
je lâche l'affaire :cry: vous aviez raison, mon code est beaucoup trop gros...
je posterais dans la section jeu le résultat de mon travail hors-purepunch.

Re: Compétition PurePunch Juillet-Août 2014

Publié : jeu. 10/juil./2014 17:18
par SPH
G-Rom a écrit :je lâche l'affaire :cry: vous aviez raison, mon code est beaucoup trop gros...
je posterais dans la section jeu le résultat de mon travail hors-purepunch.
Je refuse de gagner par forfait :P

Re: Compétition PurePunch Juillet-Août 2014

Publié : jeu. 10/juil./2014 22:20
par graph100
Oh oh oh ! :twisted:

Ce gars alors ! Il m'a tué :lol:

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 13:39
par Backup
bon voici un code , qui sera Hors concours , car malgres mes efforts, je n'arrive pas a descendre en dessous
de 55 lignes !! c'est con de rater pour 5 lignes .... :mrgreen:

je trouve malgres tout que 50 lignes c'est trop short en Purebasic
avec les noms de fonction a rallonge qu'on a, on ne peut pas rivaliser avec le GFA ;) ...

proportionnellement, je pense que 80-90 lignes serai un minimum , compte tenu des 80 colonnes imposées !
ou alors doubler le nombre de colonnes ...


bref , voici mon code Hors concourt , il fait une connexion internet car je récupère un module sur mon site

je vais d'ailleurs poster juste apres la procedure "Loadmodule_net(Adr$,nom_module$) " qui est le pendant de la procedure
Loadimage_net(Adr$,nom_image$) , que j'avais posté l'autre jour ...


voici donc le code, un petit hommage a OutRun :)

Code : Tout sélectionner

;***********************************************
;Titre  :*punch_route2
;Auteur  : Dobro
;Date  :12/07/2014
;Heure  :20:11:31
;Version Purebasic :  PureBasic 5.22 LTS (Windows - x86)
;Version de l'editeur :EPB V2.58
; Libairies necessaire : Aucune 
;***********************************************


DisableDebugger
chm$="http://michel.dobro.free.fr/Forum_pb/Outrun3.mod":RandomSeed(8)
Te$="OutRun Nostalgy .....Punch 2014.... Pure Basic Power ... By Dobro"
Macro M:macro:endmacro : M E:End:Endmacro:M LM:LoadMusic:endmacro
M G:Global:E#M:M ST:StartDrawing:E#M:M R1:StopDrawing:E#M:M PR:Procedure:E#M
M DC:Declare:E#M:M EF:Endif:E#M:M CSP:CreateSprite:E#M:G U1=100:
M R2:DisplaytransparentSprite:E#M:M OP:Open:E#M:M Wi:Window:E#M
M R3:Sprite:E#M:M OT:Output:E#M:M GC:GradientColor:E#M:M DR:Drawing:E#M
M DE:Random:E#M:M EX:Examine:E#M:M GT:GetTemporaryDirectory:E#M
M R4:ClearScreen:E#M:M Z :Next:E#M:G py=550:G d_v=600:G yb:Enumeration
M EV:Event:E#M:M FB:FlipBuffers:E#M:M R6:SystemParametersInfo_:E#M:
G j=255,k=1024,k1=768,U=300:M PC:PixelCollision:E#M:M MB:MouseButton:E#M
M SA:Static:E#M:M PT:protected:E#M:M SE:Structure:E#M:M P:RGB:E#M:#s_c:#s_f:#Et
M R5:#SPI_SETFONTSMOOTHING:E#M:#p:E#Enumeration:#T=1008:Init#R3():InitMouse()
M RH:ReceiveHTTPFile:E#M:M LG:LinearGradient:E#M:M FC:FrontColor:E#M:
InitSound():G mx.f,my.f:G Lg=k,H=k1:G my=50:G mx=0:M TW:TextWidth:E#M
M DT:DrawText:E#M:M IN:InitNetwork:E#M:M DF:DeleteFile:E#M:M PM:PlayMusic:E#M
G d2.f=0,d3.f,md=U1:G Dim bx(201):G Dim bY(201):G xt=Lg:DC  C_e():DC  ET():
DC  RD():DC  OD(spr,x,y,tx,xt,Te$,co):DC.l LMN(a$,n_m$):G W=1000:
M RM:ReleaseMouse:E#M: G U2=200:SE dg:x.w:y.w:sx.l:sy.l:E#SE:G dg.dg:dg\sy.l=10
dg\sx=0:dg\x.w=0:dg\y.w=0:R6#(R5,#False,0,0):LoadFont(#p,"Arial",50,
#PB_Font_Bold):Op#Wi(0,0,0,Lg,H,"test",#PB_#wi#_SystemMenu)
Op#Wi#edScreen(Wi#ID(0),0,0,k,k1,0,0,0):mo=LMN(chm$,"Outrun3.mod"):CSP(#s_c,k,
10,#PB_#R3#_#PC):ST(R3#OT(#s_c)):Box(0,0,k,10,P($0,$84,$42)):Box(U,0,400,10,
P($A4,$A4,$A4)):Box(U,0,30,10,P($C7,$C7,$C7)):Box(700,0,30,10,P($C7,$C7,$C7)):
R1():CSP(#s_f,k,50,#PB_#R3#_#PC):ST(R3#OT(#s_f)):Box(0,0,k,50,P($0,$84,$42))
Box(U,0,400,50,P($50,$79,$85)):Box(U,0,30,50,P($F1,$1F,$1)):Box(700,0,30,50,
P($F1,$1F,$1)):R1():ys=599:Repeat:ET():tm=DE(80,1):t2=DE(50,1):if tm=1:
dp=DE(100,1):EF:d2=d2+sin(dp*(2*#Pi/4)):If d2>100:d2=100:dp=-dp:EF:If d2<-100:
d2=-100:dp=-dp:EF:If t2=1:dv=DE(150,1):EF:d3=d3+sin(dv*(2*#Pi/10)):If d3>40:
d3=40:dv=-dv:EF:If d3<-25:d3=-25:dv=-dv:EF:mx=d2/U1:my=d3.f/U1:EX#Mouse():
If  MB(#PB_#MB#_Right):E:EF:G Lg=k:G ta=10:G C=U2:G C1=sin(C):x=2:y=2:co.l=$0:
tx=Lg:xt-8:if xt<-Lg*3:xt=Lg:EF:OD(#T,x,y,tx,xt,Te$,co):RD():FB():R4($0):
EV=wait#Wi#Ev(2):Until EV=#PB_#EV#_Close#Wi:R6#(R5,1,0,0):RM(1):E:PR C_e():
SE eo:x.i:Y.i:z.f:pas.i:co.i:E#SE:G Dim eo.eo(W):SA F_e:If F_e=0:For i=1 To W-1
eo(i)\x=-Lg/2+(DE(Lg)+1):eo(i)\Y=-H/2+(DE(H)+1):eo(i)\z=DE(W)+1:
eo(i)\pas=(DE(3)+1)*2:eo(i)\co=P(DE(j),DE(j),DE(j)):CSP(#Et+i,6,6):
ST(R3#OT(#Et+i)):Circle(3,3,2,eo(i)\co):R1():Z i:F_e=1:EF:E#PR:PR ET():SA F_e
If F_e=0:C_e():F_e=1:EF:sp=20:F=U2:For i=1 To W-1:eo(i)\z=eo(i)\z-sp:
If eo(i)\z<=1:eo(i)\z=W:EF:XR=(F*eo(i)\x)/eo(i)\z+Lg/6+(mx*U2)
YR=(F*eo(i)\Y)/eo(i)\z+H/3+(my*U2):R2(#Et+i, XR,YR):Z i:E#PR:PR RD():SA C1,C,
cmt:For b=0 To U2:Lg=Lg+ta:bx(b)=px+(mx/60)*C*C-((ta/2)* b)+420:
bY(b)=py+b-(my)*C:Zoom#R3(#s_c,Lg-1030,10):R2(#s_c,bx(b),bY(b),J):C=C-1:If C<0:
C=U2:EF:Z b:Lg=k:For b=0 To U2:cmt=cmt+1:xb=px+(mx/60)*C1*C1-((5)*b)+420:
Zoom#R3(#s_f,Lg-1030,2):If  cmt%21>=10:yb=bY(b):for ii=0 to d_v:R2(#s_f,xb,yb,
J):Z ii:EF:Lg=Lg+10:C1=C1-1:If C1<0:C1=200:EF:Z b:E#PR:PR OD(spr,x,y,tx,xt,Te$,
co):PT px,py,mmy,L.s,ty,yt:mmy=ty:SA  ao.f:#Va=1*#PI/50:#Hs=50:#LS=50:ty=#Hs*4:
yt=#Hs*2:If CSP(spr,tx,ty):ST(R3#OT(spr)):DR#Font(FontID(#p)):ao+#Va:
If ao>=2*#PI:ao=0:EF:px=10:For n=1 To Len (Te$):L.s=Mid (Te$, n,1):
py=#Hs*Sin(ao+px/#LS )-ty/4:if co=$0:DR#Mode(#PB_2D#DR#_Gradient|
#PB_2D#DR#_Transparent):BackColor($0):For i=0 To J:GC(0.4, P(i,0,0)):GC(0.8,
P(0,i,0)):GC(0.16,P(0,0,i)):GC(0.32,P(0,i,i)):GC(0.64,P(i,i,0)):Z i:LG(0,0,tx,
ty):EF:DT(xt+px,yt+py,L):px+TW(L):Z:R1():R2(spr,x,y):Free#R3(spr):EF:E#PR:
PR.l LMN(a$,n_m$):IN():If RH(a$,GT()+n_m$):i_m=LM(#PB_Any,GT()+n_m$):
PM(i_m):DF(GT()+n_m$):PR#Return i_m:EF:E#PR


; 
; Epb 




Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 13:53
par SPH
sait on qui gagne pour l'instant ?

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 13:56
par Backup
non un vote est organisé a la fin (mois d'Aout )

[reedit]
je viens de corriger un petit bug qui faisait coincer a gauche ou a droite :)

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 18:52
par Lemaquis
je voterai bien Pour dobro , car je trouve son programme trés trés fun et cool

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 19:02
par graph100
Bon, puisque que c'est la fête :

Code : Tout sélectionner

Macro M:Macro:EndMacro:M E:End:EndMacro:M LM:LoadMusic:EndMacro:chm$="http://m"+
"ichel.dobro.free.fr/Forum_pb/Outrun3.mod":RandomSeed(8):Te$="OutRun Nostalgy "+
".....Punch 2014.... Pure Basic Power ... By Dobro":M G:Global:EndMacro;########
M ST:StartDrawing:E#M:M R1:StopDrawing:E#M:M PR:Procedure:E#M:M DC:Declare:E#M;#
M EF:EndIf:E#M:M CSP:CreateSprite:E#M:G U1=100:M R2:DisplaytransparentSprite:E#M
M OP:Open:E#M:M Wi:Window:E#M:M R3:Sprite:E#M:M OT:Output:E#M:M GC:GradientColor
EndMacro:M DR:Drawing:E#M:M DE:Random:E#M:M EX:Examine:E#M:M R4:ClearScreen:E#M;
M GT:GetTemporaryDirectory:E#M:M Z :Next:E#M:G py=550:G d_v=600:G yb:G j=255;###
M EV:Event:E#M:M FB:FlipBuffers:E#M:M R6:SystemParametersInfo_:E#M:G k=1024,;###
k1=768,U=300:M SA:Static:E#M:M PC:PixelCollision:E#M:M MB:MouseButton:E#M:G mx.f
M PT:Protected:E#M:M SE:Structure:E#M:M P:RGB:E#M:Init#R3():InitMouse():G my.f;#
M RH:ReceiveHTTPFile:E#M:M LG:LinearGradient:E#M:M FC:FrontColor:E#M:G my=50,mx;
InitSound():G Lg=k,H=k1:M TW:TextWidth:E#M:M DT:DrawText:E#M:M IN:InitNetwork;##
EndMacro:M DF:DeleteFile:E#M:M PM:PlayMusic:E#M:G d2.f,d3.f,md=U1:G Dim bx(201);
G Dim bY(201):G xt=Lg:DC C_e():DC ET():DC RD():DC OD(spr,x,y,tx,xt,Te$,co);#####
DC.l LMN(a$,n_m$):G W=1000:M RM:ReleaseMouse:E#M:G U2=200:SE dg:x.w:y.w:sx.l;###
sy.l:E#SE:G dg.dg:dg\sy.l=10:dg\sx=0:dg\x.w=0:dg\y.w=0:R6#(75,#False,0,0);######
LoadFont(0,"Arial",50,256):Op#Wi(0,0,0,Lg,H,"",C80000):Op#Wi#edScreen(Wi#ID(0),;
0,0,k,k1,0,0,0):mo=LMN(chm$,"Outrun3.mod"):CSP(0,k,10,#PB_#R3#_#PC):ST(R3#OT(0))
Box(0,0,k,10,P($0,$84,$42)):Box(U,0,400,10,P($A4,$A4,$A4)):Box(U,0,30,10,P($C7,;
$C7,$C7)):Box(700,0,30,10,P($C7,$C7,$C7)):R1():CSP(1,k,50,#PB_#R3#_#PC);########
ST(R3#OT(1)):Box(0,0,k,50,P($0,$84,$42)):Box(U,0,400,50,P($50,$79,$85)):Box(U,0,
30,50,P($F1,$1F,$1)):Box(700,0,30,50,P($F1,$1F,$1)):R1():ys=599:Repeat:ET();####
tm=DE(50,1):t2=DE(10,1):If t2=8:dv=DE(25,1):If dv>12:dv=-dv:EF:EF:If tm=1:dp=0+;
DE(50,1):If dp>25:dp-dp:EF:EF:If dp >0:d2.f=d2-2:EF:If dp <0:d2=d2.f+2:EF;######
If dp2<U1:If d2<-U1:d2+1:EF:d2+1:EF:If d2>U1:d2-1:EF:If dv >0:d3-2:EF:If dv <0:;
d3+2:EF:If d3<25:d3+1:EF:If d3>80:d3-1:EF:mx=d2/U1:my=d3.f/U1:EX#Mouse();#######
If MB(2):E:EF:G Lg=k,ta=10,C=U2,C1=Sin(C):x=2:y=2:co.l=$0:tx=Lg:xt-8:If xt<-Lg*3
xt=Lg:EF:OD(1008,x,y,tx,xt,Te$,co):RD():FB():R4($0):EV=wait#Wi#Ev(2):Until EV=0+
13116:R6#(75,1,0,0):RM(1):E:PR C_e():SE eo:x.i:Y.i:z.f:pas.i:co.i:E#SE:SA F_e;##
G Dim eo.eo(W):If F_e=0:For i=1 To W-1:eo(i)\x=-Lg/2+(DE(Lg)+1):eo(i)\Y=-H/2+;##
DE(H)+1:eo(i)\z=DE(W)+1:eo(i)\pas=(DE(3)+1)*2:eo(i)\co=P(DE(j),DE(j),DE(j));####
CSP(2+i,6,6):ST(R3#OT(2+i)):Circle(3,3,2,eo(i)\co):R1():Z i:F_e=1:EF:E#PR;######
PR ET():SA F_e:If F_e=0:C_e():F_e=1:EF:sp=20:F=U2:For i=1 To W-1:eo(i)\z=0+;####
eo(i)\z-sp:If eo(i)\z<=1:eo(i)\z=W:EF:XR=(F*eo(i)\x)/eo(i)\z+Lg/6+(mx*U2);######
YR=(F*eo(i)\Y)/eo(i)\z+H/3+(my*U2):R2(2+i, XR,YR):Z i:E#PR:PR RD();#############
SA C1,C,cmt:For b=0 To U2:Lg=Lg+ta:bx(b)=px+(mx/60)*C*C-((ta/2)* b)+420;########
bY(b)=py+b-(my)*C:Zoom#R3(0,Lg-1030,10):R2(0,bx(b),bY(b),J):C=C-1;##############
If C<0:C=U2:EF:Z b:Lg=k:For b=0 To U2:cmt=cmt+1;################################
xb=px+(mx/60)*C1*C1-((5)* b)+420:Zoom#R3(1,Lg-1030,2):If  cmt%21>=10;###########
yb=bY(b):For ii=0 To d_v:R2(1,xb,yb,J):Z ii:EF:Lg=Lg+10:C1=C1-1:If C1<0;########
C1=200:EF:Z b:E#PR:PR OD(spr,x,y,tx,xt,Te$,co):PT px,py,mmy,L.s,ty,yt;##########
mmy=ty:SA ao.f:#Va=1*#PI/50:#Hs=50:#LS=50:ty=#Hs*4:yt=#Hs*2:If CSP(spr,tx,ty);##
ST(R3#OT(spr)):DR#Font(FontID(0)):ao+#Va:If ao>=2*#PI:ao=0:EF:px=10;############
For n=1 To Len(Te$):L.s=Mid (Te$, n,1):py=#Hs*Sin(ao+px/#LS )-ty/4:If co=0;#####
DR#Mode(#PB_2D#DR#_Gradient|#PB_2D#DR#_Transparent):BackColor($0):For i=0 To J;#
GC(0.4, P(i,0,0)):GC(0.8,P(0,i,0)):GC(0.16,P(0,0,i)):GC(0.32,P(0,i,i)):GC(0.64,;
P(i,i,0)):Z i:LG(0,0,tx,ty):EF:DT(xt+px,yt+py,L):px+TW(L):Z:R1();###############
R2(spr,x,y):Free#R3(spr):EF:E#PR:PR.l LMN(a$,n_m$):IN():If RH(a$,GT()+n_m$);####
:i_m=LM(#PB_Any,GT()+n_m$):PM(i_m):DF(GT()+n_m$):PR#Return i_m:EF:E#PR;#########

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 19:02
par graph100
Lemaquis a écrit :je voterai bien Pour dobro , car je trouve son programme trés trés fun et cool
Lequel ?

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 19:14
par Backup
ho puré !! 8O t'a fait comment pour me reduire les 5 lignes ?
ps: je venais d'essayer de changer le calcul d'orientation de la route en employant Sin()
mais ça m'a fait gagner qu'une seule ligne :lol:

j'aimerai bien savoir ou tu as gagné de la place 8O
arg !!! je ne savais pas qu'on pouvais couper les chaines avec "+" :roll:

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 20:43
par SPH
Plus on poste de code, plus on a des chances de perdre car les votes vont se répartir :idea:

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 20:48
par falsam
SPH a écrit :Plus on poste de code, plus on a des chances de perdre car les votes vont se répartir :idea:
Chuttttt .... fallait pas le dire :mrgreen:

Re: Compétition PurePunch Juillet-Août 2014

Publié : sam. 12/juil./2014 21:05
par Ar-S
Je trouve ça tout de même un peu dommage de poster vos codes. Je préférai les codes anonymes avec le nom des participants lors des résultats des votes.