XavSnap wrote: ↑Sun May 02, 2021 6:33 pm
Code: Select all
IF X=Q THEN PRINT AT R,P+W;"O"
IF X=W OR X=E THEN PRINT AT E,P+Q;"O";AT T,P+E;"O"
IF X=E THEN PRINT AT R,P+W;"O"
IF X=R OR X=T THEN PRINT AT E,P+Q;"O O";AT T,P+Q;"O O"
IF X=T THEN PRINT AT R,P+W;"O"
IF X=Y THEN PRINT AT E,P+Q;"OOO";AT T,P+Q;"OOO"
equal
Code: Select all
PRINT AT R,P+W;"O" AND X=Q;AT E,P+Q;"O";AT T,P+E;"O" AND (X=W OR X=E);AT R,P+W;"O" AND X=E;AT E,P+Q;"O O";AT T,P+Q;"O O" AND (X=R OR X=T);AT R,P+W;"O" AND X=T;AT E,P+Q;"OOO";AT T,P+Q;"OOO" AND X=Y
Actually, I've done some tests and the two codes do not appear to be equivalent.
See this example:
print at 1,1;"o" and x=1;at 0,0;"o";at 2,2;"o" and x=2
This results in "o" being printed at 1,1 if x=1 (correct); in "o" at 0,0 being *always* printed regardless of if x is 1 or 2 (unwanted); and in "o" at 2,2 being printed if x=2 (correct).
So the second AND boolean only validates the third "print at" (2,2) and not the second (0,0) which is always validated.
So it should be:
print at 1,1;"o" and x=1;at 0,0;"o" and x=2;at 2,2;"o" and x=2
and then it would be equivalent to
if x=1 then print at 1,1;"o"
if x=2 then print at 0,0;"o";at 2,2;"o"
Still, 7 bytes less so maybe worth it.