diff --git a/aheui.c b/aheui.c index c6d7a8c..0085b64 100644 --- a/aheui.c +++ b/aheui.c @@ -301,7 +301,14 @@ int execute(int *exitcode) { } break; case OP_CMP: push((b>=a) ? 1 : 0); break; - case OP_BRANCH: if (a == 0) { dir.dx = -dir.dx; dir.dy = -dir.dy; } break; + case OP_BRANCH: if (a == 0) { + switch (value_table[cell->value] % 4) { + case 0 : dir.dx = -dir.dx; dir.dy = -dir.dy; break; + case 1 : break; + case 2 : dir.dx ^= dir.dy; dir.dy ^= dir.dx; dir.dx ^= dir.dy; dir.dx = -dir.dx; dir.dy = -dir.dy; break; + case 3 : dir.dx ^= dir.dy; dir.dy ^= dir.dx; dir.dx ^= dir.dy; break; + } + } break; case OP_SUB: push(b-a); break; case OP_SWAP: break; case OP_EXIT: