Page 10 of 12

Posted: Thu 22 Sep, 2005 1:55 am
by kalan_vod
Could anyone help Optimize this for speed, i have made all the ifs into booleans, but a couple didnt help the speed so i changed them back.

Code: Select all

[A](A,B
If 25=Ans or 14=Ans
Then
prgmA3
Else
prgmLVL
End
[A](A,B
Repeat A=1 or B=1 or A=8 or B=12 or 25=Ans or 14=Ans
Repeat O
real(1,8B-8,8A-8,1,8,0,0,X,3,0,1
getKey->O
real(1,8B-8,8A-8,1,8,0,0,X,3,0,0
End
B+(O=26 and 12<[A](A,B+1))-(O=24 and 12<[A](A,B-1->B
A+(O=34 and 12<[A](A+1,B))-(O=25 and 12<[A](A-1,B->A
X+(O=26)(8-(8+X)(X≥16
Ans+(O=24)(8-(Ans-16)(Ans≥40 or Ans≤16
If O=25
55
If O=34
48
Ans->X
If O=21
prgmA1
[A](A,B
End
prgmSTART
>_= greater than or equal to
<_= less than or equal to

Posted: Thu 22 Sep, 2005 3:10 pm
by threefingeredguy
change

Code: Select all

If O=25 
55->X 
If O=34 
48->X 

Code: Select all

30(O=25)+14(O=34)+X->X
and thats all i can think of. Although all the [A] references are slow and it would be faster for you to copy the term into a variable and use the variable sdince you are using it more than 1 time.

Posted: Thu 22 Sep, 2005 8:37 pm
by kalan_vod
threefingeredguy wrote: and thats all i can think of. Although all the [A] references are slow and it would be faster for you to copy the term into a variable and use the variable sdince you are using it more than 1 time.
Thanks I will try this out, and I never thought about placing it into a variable.

Posted: Thu 22 Sep, 2005 9:04 pm
by kalan_vod
threefingeredguy wrote:change

Code: Select all

If O=25 
55->X 
If O=34 
48->X 

Code: Select all

30(O=25)+14(O=34)+X->X
yeah, this doesnt work....
Edit: code is now updated.

Posted: Fri 23 Sep, 2005 1:00 am
by DarkerLine
Replace S with Ans and instead of ->S write nothing.

Also, -16+X is the same as X-16.

Posted: Fri 23 Sep, 2005 1:03 am
by kalan_vod
DarkerLine wrote:Replace S with Ans and instead of ->S write nothing.

Also, -16+X is the same as X-16.
Yeah, thanks for the optimization there sir :) .
Edit: code is updated. (thanks guys keep it coming :D)

Posted: Wed 09 Nov, 2005 12:35 am
by DarkerLine
A bit late, but

real(1,8B-8,8A-8,1,8,0,0,X,3,0,1
getKey->O
real(1,8B-8,8A-8,1,8,0,0,X,3,0,0

can be changed to

For(I,0,1
real(1,8B-8,8A-8,1,8,0,0,X,3,0,I
End
getKey->O

Posted: Wed 09 Nov, 2005 12:45 am
by kalan_vod
For speed it would be faster but its not much faster and for size its bigger :D, thanks anyway.

Posted: Wed 09 Nov, 2005 1:18 am
by DarkerLine
It's bigger? Count again, I got a result of 21 bytes smaller. :o

Posted: Wed 09 Nov, 2005 1:45 am
by threefingeredguy
kalan_vod wrote:
threefingeredguy wrote:change

Code: Select all

If O=25 
55->X 
If O=34 
48->X 

Code: Select all

30(O=25)+14(O=34)+X->X
yeah, this doesnt work....
Edit: code is now updated.
Errr, do

Code: Select all

55(O=25)+48(O=34)+X(O<doesntequal>25 and O<doesntequal>25)->X
That's what I meant, maybe I sick when I wrote that one before.

Posted: Wed 09 Nov, 2005 2:07 am
by kalan_vod
err, i meant it......ill try it :D, maybee i was sick when i did that :lol: .
Edit: Thanks it works dl, but tfg yours dosn't :D.
BASIC Code wrote::real(7,0
:If 38Image[A](A,B:Then :prgmA3:Else :prgmLVL:End
:Repeat 39=Ans or 38=Ans
:Repeat Image
:For(I,1,0,(-)1
:real(1,8B-8,8A-8,1,8,0,0,X,3,0,I
:End
:getKeyImageImage
:End
:B+(Image=26 and 36<[A](A,B+1))-(Image=24 and 36<[A](A,B-1ImageB
:A+(Image=34 and 36<[A](A+1,B))-(Image=25 and 36<[A](A-1,BImageA
:X+(Image=26)(8-(8+X)(XImage16
:Ans+(Image=24)(8-(Ans-16)(AnsImage40 or AnsImage16
:If Image=25:55
:If Image=34:48
:AnsImageX
:If Image=21:prgmA1
:[A](A,B
:End
:prgmSTART
Thats the updated version :P.

Posted: Wed 09 Nov, 2005 4:51 pm
by threefingeredguy
Nuts.

Posted: Mon 28 Nov, 2005 7:30 pm
by Loki
Anyone know a smaller way of doing this:

Code: Select all

Delvar A
While not(A
getKey
If Ans=21
1->A
End
for pausing until 2nd is pressed? Like Pause, except i want the key to continue to be the 2nd key.

Posted: Mon 28 Nov, 2005 7:41 pm
by pacHa

Code: Select all

:Repeat Ans=21
:GetKey
:End
This might work, if my basic memories are good (assuming Ans != 21 before this)

Posted: Mon 28 Nov, 2005 8:37 pm
by kalan_vod

Code: Select all

Repeat getkey=21
End