Say I indent my code like this:
Which[
{x1, y1 + 1} == {x2, y2 - 1},
{
pos1 = pos1 /. {{x1, y1} -> {x1 = 2, y1 = 2}},
pos2 = pos2 /. {{x2, y2} -> {x2 = 2, y2 = 4}},
pos3 = pos3 /. {{x3, y3} -> {x3 = 2, y3 = 0}},
message = "Gameover", DotT = {2, (4 - .3)},
DotL = {2, (2 + .3)}, DotB = {2, (0 + .3)}, Switch = False
},
{x1, y1 + 1} == {x2, y2},
{
pos1 = pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3}},
message = "Stay in place"
},
{x1, y1 + 1} == {x3, y3},
{
Which[
Intersection[bound, {{x3, y3 + 1}}] == {{x3, y3 + 1}},
{
pos1 = pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3}},
message = "Stay in place"}, {x3, y3 + 1} == {x2, y2 - 1},
{
pos1 = pos1 /. {{x1, y1} -> {x1 = 2, y1 = 2}},
pos2 = pos2 /. {{x2, y2} -> {x2 = 2, y2 = 4}},
pos3 = pos3 /. {{x3, y3} -> {x3 = 2, y3 = 0}},
message = "Gameover",
DotT = {2, (4 - .3)}, DotL = {2, (2 + .3)}, DotB = {2, (0 + .3)},
Switch = False
},
Intersection[bound, {{x3, y3 + 1}}] != {{x3, y3 + 1}},
{
pos1 = pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1 + 1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2 - 1}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3 + 1}},
message = "Conga"
}
]
}
]
It's very clear and human-readable for me this way, however, when I copy and paste this into my notebook I get this:
Which[{x1, y1 + 1} == {x2, y2 - 1}, {pos1 =
pos1 /. {{x1, y1} -> {x1 = 2, y1 = 2}},
pos2 = pos2 /. {{x2, y2} -> {x2 = 2, y2 = 4}},
pos3 = pos3 /. {{x3, y3} -> {x3 = 2, y3 = 0}}, message = "Gameover",
DotT = {2, (4 - .3)}, DotL = {2, (2 + .3)}, DotB = {2, (0 + .3)},
Switch = False}, {x1, y1 + 1} == {x2, y2}, {pos1 =
pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3}},
message = "Stay in place"}, {x1, y1 + 1} == {x3, y3}, {Which[
Intersection[bound, {{x3, y3 + 1}}] == {{x3, y3 + 1}}, {pos1 =
pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3}},
message = "Stay in place"}, {x3, y3 + 1} == {x2, y2 - 1}, {pos1 =
pos1 /. {{x1, y1} -> {x1 = 2, y1 = 2}},
pos2 = pos2 /. {{x2, y2} -> {x2 = 2, y2 = 4}},
pos3 = pos3 /. {{x3, y3} -> {x3 = 2, y3 = 0}},
message = "Gameover", DotT = {2, (4 - .3)}, DotL = {2, (2 + .3)},
DotB = {2, (0 + .3)}, Switch = False},
Intersection[bound, {{x3, y3 + 1}}] != {{x3, y3 + 1}}, {pos1 =
pos1 /. {{x1, y1} -> {x1 = x1, y1 = y1 + 1}},
pos2 = pos2 /. {{x2, y2} -> {x2 = x2, y2 = y2 - 1}},
pos3 = pos3 /. {{x3, y3} -> {x3 = x3, y3 = y3 + 1}},
message = "Conga"}]}]
Which is complete garbage for my eyes. How can I retain the beauty?
Switch=False
? You do realizeSwitch
is an MMA reserved symbol, yes? $\endgroup$