From b1914a62c8921143e6f5e70b2a0294d349754723 Mon Sep 17 00:00:00 2001 From: Cp'tj Nayamo Date: Tue, 7 Mar 2017 23:06:22 +0800 Subject: [PATCH] =?UTF-8?q?Add=20parameter=20to=20=E3=85=8A=20instruction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aheui.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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: