Hi, can someone can optimize these "if structures" like now it has 4 in at least 2 or even one if ??

I know it may be tricky cause i'm the one who coded it but if you dont understand i can explain it

like the two first have if a=1 and the two other ones have a=0

thanks a lot !!!

"HORIZONTAL UP

If A=1 and pxl-Test(61-Y,X)=1 and pxl-Test(55-Y,X+1)=1 and pxl-Test(61-Y,X+7)=1:Then

If P=7

Text(56-Y,X+2,sub(Str1,1,1

If P=2

Text(56-Y,X+2,sub(Str2,1,1

2→D

End

"HORIZONTAL DOWN

If A=1 and pxl-Test(63-Y,X)=1 and pxl-Test(69-Y,X+1)=1 and pxl-Test(63-Y,X+7)=1:Then

If P=7

Text(63-Y,X+2,sub(Str1,1,1

If P=2

Text(63-Y,X+2,sub(Str2,1,1

2→D

End

"VERTICAL RIGHT

If A=0 and pxl-Test(61-Y,X+7)=1 and pxl-Test(62-Y,X+1)=1 and pxl-Test(55-Y,X+1)=1:Then

If P=7

Text(56-Y,X+2,sub(Str1,1,1

If P=2

Text(56-Y,X+2,sub(Str2,1,1

2→D

End

"VERTICAL LEFT

If A=0 and pxl-Test(61-Y,X-7)=1 and pxl-Test(62-Y,X-1)=1 and pxl-Test(55-Y,X-1)=1:Then

If P=7

Text(56-Y,X-5,sub(Str1,1,1

If P=2

Text(56-Y,X-5,sub(Str2,1,1

2→D

End

If D≠2

9-P→P

1→D