User talk:LucasMW
Jump to navigation
Jump to search
In Brainfuck_algorithms, about the Ian Kelly's "x < y" and "x <= y",
I think it's more like that the order is wrong.
That means:
"x = x < y" should be "x = x <= y",
"x = x <= y" should be "x = x < y"
When testing "<=", the x becomes 0, so in fact this algorithm should be "<":
- #order:x y temp0 temp1 temp2 temp3
- #In the following codes, "x", "y" or something else shows where the pointer is at.
- x++>y++<x
- >>temp0[-]
- >temp1[-] >temp2[-]+ >temp3[-] <<temp1
- <<y[>temp0+ >temp1+ <<y-]
- >temp0[<y+ >temp0-]
- <<x[>>temp0+ <<x-]x+
- #if temp1==0 then x=0 temp0=0
- >>>temp1[>-]> [< <<<x- >>temp0[-] >temp1 >temp2->temp3]<temp2+<temp1
- <temp0[>temp1- [>-]> [<temp1 <<<x- >>temp0[-]+ >temp1>temp2->temp3]<temp2+<temp1 <temp0-]
- <<x
- >[-]>[-]>[-]>[-]>[-]<<<<<
The same problem happens on "<":
- #order:x y temp0 temp1 temp2 temp3
- >>temp0[-]
- >temp1[-] >temp2[-]+ >temp3[-] <<temp1
- <<y[>temp0+ >temp1+ <<y-]
- >>temp1[<<y+ >>temp1-]
- <<<x[>>>temp1+ <<<x-]
- #if temp1==0 then x=0 temp0=0
- >>>temp1[>-]> [<temp1 <<<x+ >>temp0[-] >temp1>temp2->temp3]<temp2+<temp1
- <temp0[>temp1- [>-]> [<temp1 <<<x+ >>temp0[-]+ >temp1>temp2->temp3]<temp2+<temp1 <temp0-]
- <<x
- >[-]>[-]>[-]>[-]>[-]<<<<<