Page 3 of 9
Posted: Wed Jun 03, 2009 9:50 pm
by Kaeru Gaman
I would rather rely on my eyes and my ability to read a number in the statusbar.
nice attempt, einander, but if it is not reliable, why should one use it?
Posted: Wed Jun 03, 2009 10:23 pm
by blueznl
Out of competition (it would not qualify anyway

) the next version of PPV to accomodate for the rules change
Code: Select all
; PPV v0.02 blueznl
;
; PurePunch Validator
;
title.s = "PurePunch Validator v0.03 by BluezNL"
;
category_1 = #True ; set to false if it's more than 10 lines or a line has more than 256 chars
category_2 = #True ; set to false if it's more than 100 lines or a line contains multiple statements
category_3 = #True ; set to false if the total number of chars is more than 2560
category_4 = #True ; set to false if it's more than 10 lines or a line has more than 80 chars
;
; note: all lines are trimmed, and empty lines and comment only lines are ignored
;
line_nr = 0
line_qualifying_nr = 0
line_l_max = 0
line_l_max_nr = 0
char_nr = 0
;
; f.s = ProgramParameter()
; f.s = "d:\purebasic\_projects\test.pb"
; f.s = "d:\purebasic\_projects\x_lib\x_lib.pb"
; f.s = "d:\purebasic\_projects\ppv.pb"
; f.s = "d:\purebasic\_projects\test.pb"
;
If f.s = ""
f = OpenFileRequester(title,"","PureBasic|*.pb|All files|*.*",0)
EndIf
If FileSize(f) > 1
ReadFile(1,f)
While (category_1 Or category_2 Or category_3) And (Not Eof(1))
y.s = Trim(ReadString(1,#PB_UTF8))
line_nr = line_nr+1
If y = ""
ElseIf Left(y,1)=";"
Else
line_qualifying_nr = line_qualifying_nr+1
line_l = Len(y)
If line_l > line_max
line_l_max = line_l
line_l_max_nr = line_nr
EndIf
;
; category no.1: 256 characters or less
;
If line_l > 256
category_1 = #False
EndIf
;
; category no. 1: not too many lines? 10 or less
;
If line_qualifying_nr > 10
category_1 = #False
EndIf
;
; category no.2: not too many lines? 100 or less
;
If line_qualifying_nr > 100
category_2 = false
EndIf
;
; category no.2: single statement test
;
p_n = CountString(y,#DQUOTE$)
If p_n > 0
x.s = ""
p = 1
While p <= p_n+1
x = x+StringField(y,p,#DQUOTE$)
p = p+2
Wend
y = x
EndIf
p_n = CountString(y,"'")
If p_n > 0
x = ""
p = 1
While p <= p_n+1
x = x+StringField(y,p,"'")
p = p+2
Wend
y = x
EndIf
p_n = CountString(y,";")
If p_n > 0
x = ""
p = 1
While p <= p_n+1
x = x+StringField(y,p,";")
p = p+2
Wend
y = x
EndIf
If CountString(y,":") > 0
category_2 = #False
EndIf
;
; category no.3: Not too large?
;
char_nr = char_nr + line_l
If char_nr > 2560
category_3 = false
EndIf
;
; category no.4: max. 10 lines of max. 80 characters
;
If line_l > 80 Or line_qualifying_nr > 10
category_4 = #False
EndIf
;
EndIf
Wend
CloseFile(1)
;
y = "Lines: "+Str(line_nr)+Chr(13)
y = y+"Qualifying lines: "+Str(line_qualifying_nr)+Chr(13)
y = y+"Longest line: "+Str(line_l_max_nr)+" ("+Str(line_l_max)+" characters)"+Chr(13)
y = y+"Length: "+Str(char_nr)+" characters"
;
x = ""
If category_1
x = x+Chr(13)+"CATEGORY I - PASSED - max 10 lines of max 256 characters"
Else
x = x+Chr(13)+"CATEGORY I - FAILED"
EndIf
If category_2
x = x+Chr(13)+"CATEGORY II - PASSED - max 100 qualifying lines with each one statement"
Else
x = x+Chr(13)+"CATEGORY II - FAILED"
EndIf
If category_3
x = x+Chr(13)+"CATEGORY III - PASSED - max 2560 characters"
EndIf
x = x+Chr(13)
If category_4
x = x+Chr(13)+"JUNE 2009 - PASSED - max 10 qualifying lines of max 80 characters"
Else
x = x+Chr(13)+"JUNE 2009 - FAILED"
EndIf
MessageRequester(title,f+Chr(13)+Chr(13)+y+Chr(13)+x,#PB_MessageRequester_Ok)
;
EndIf
Posted: Wed Jun 03, 2009 10:41 pm
by djes
blueznl> Yeah, thank you!

Posted: Wed Jun 03, 2009 11:22 pm
by Anonymous
after raytracing , raycasting

it's very hard to respect the rules!
Code: Select all
;*****************************************************************************
;*
;* Name : RayCasting 640x480
;* Author : Cpl.Bator
;* Date : 3/06/2009
;* Notes : Tested on linux , program quit automatically
;*
;*****************************************************************************
w=1024:x=360:px=9*w:py=11*w:st=5:he=0:tr=1:Fc=$FFFFFF:Macro rnd(v):Random(v);##
EndMacro:Macro ef:EndIf:EndMacro:Dim L(20,20):For c=0 To 11:L(C,12)=rnd(Fc);###
b=540:L(C,0)=rnd(Fc):L(12,C)=rnd(Fc):L(0,C)=rnd(Fc):L(rnd(11),rnd(11))=rnd(Fc);
Next:Dim t(b):For i=0 To b:t(i) = (Cos((i*0.0174))*w)/10:Next:InitSprite():u=91
OpenScreen(640,480,32,""):Repeat:x1=0:y1=0:x2=0:y2=0:tm+1:q=100:If t<tm:t=tm+10
he=(he+tr)%x:ef:StartDrawing(ScreenOutput()):gl=he-44%x:If gl<0:gl=gl+x:ef;####
For a=gl To gl+89:xx=px:yy=py:tx=t(a+u):ty=t(a+1):l=0:While 1:xx=xx-tx:yy=yy-ty
l=l+1:O=(xx/w)%12:Li=(yy/w)%12:If L(Li,O)!0:Break:ef:Wend:h=900/l:y1=q-h:y2=q+h
x2=x1+3:Box(x1*2,y1*2,12,h*6,L(Li,O)):x1 = x2+1:Next:StopDrawing();############
FlipBuffers(2):ClearScreen(0):Until tm>10000;##################################
Posted: Thu Jun 04, 2009 8:31 am
by djes
Especially if you're using only 79 chars per line

Posted: Thu Jun 04, 2009 9:14 am
by Trond
Programs that don't have a way to quit should be prohibited!
Posted: Thu Jun 04, 2009 9:49 am
by djes
Trond wrote:Programs that don't have a way to quit should be prohibited!
Ok, I'll try to remember it for the next contest.
Posted: Thu Jun 04, 2009 2:14 pm
by Anonymous
Notes : Tested on linux , program quit automatically
with the rules , i can't use keyboard command :roll:
Posted: Thu Jun 04, 2009 2:54 pm
by djes
Cpl.Bator wrote: Notes : Tested on linux , program quit automatically
with the rules , i can't use keyboard command :roll:
Why?
Posted: Thu Jun 04, 2009 3:12 pm
by Kaeru Gaman
the rules don't say, if Linux or Windows or both.
so, you sure could use keyboard commands,
but you need to post TWO versions with different literal numbers for the keycodes,
or at least clearly state that it is a linux-version and we need to replace the keycodes...
Posted: Thu Jun 04, 2009 3:23 pm
by blueznl
There were no other limitations, so feel free to write your code for your specific platform, I guess. And yeah, it it's your local ZX Spectrum port of PureBasic, it will be hard to show to the rest of us how great your code is... but don't worry, voting will fix all that, and there's nothing wrong with you that a little re-incarnation cannot cure

Posted: Thu Jun 04, 2009 4:11 pm
by Anonymous
djes wrote:Cpl.Bator wrote: Notes : Tested on linux , program quit automatically
with the rules , i can't use keyboard command :roll:
Why?
Because InitKeyboard() , ExamineKeyboard() , keyboardpushed()... is too big , my program's quit automatically , stop.
if you are not happy , don't test the program.
bye.
Posted: Thu Jun 04, 2009 4:16 pm
by djes
By now, there's no rule about how a program should quit. If someone don't like it, he just have to not vote for you, that's all! Maybe others (like me), just don't care to wait a couple of seconds

Posted: Thu Jun 04, 2009 4:20 pm
by Anonymous
Djes , my message is not for you.
Programs that don't have a way to quit should be prohibited!
Don't test my small code.
but you need to post TWO versions with different
We don't live on the same planet...
Posted: Thu Jun 04, 2009 5:11 pm
by Kaeru Gaman
Cpl.Bator wrote:but you need to post TWO versions with different
We don't live on the same planet...
well, let me say, you should better post two versions, if you want the others to vote for the code.
because, if keyboardpushed() is too big for you, what about #PB_Key_Escape...?
but you can just replace it with
1 on windows, dunno what the Linux Value is.
... but if it wasn't for the length of the constants, and you are not on linux,
I just misinterpreted the reason why you said "can't use keyboard"...