aboutsummaryrefslogtreecommitdiff
path: root/src/pointer.zig
diff options
context:
space:
mode:
authorJulien Dessaux2022-08-07 00:09:32 +0200
committerJulien Dessaux2022-08-07 00:09:32 +0200
commitb5bfb6f025ce9dbbbd8353c6a019a0a428f4ddc6 (patch)
tree9bd9adc5a271e5b4b7c7002354b9457d156d5bb0 /src/pointer.zig
parentImplemented the { (aka begin) funge command (diff)
downloadzigfunge98-b5bfb6f025ce9dbbbd8353c6a019a0a428f4ddc6.tar.gz
zigfunge98-b5bfb6f025ce9dbbbd8353c6a019a0a428f4ddc6.tar.bz2
zigfunge98-b5bfb6f025ce9dbbbd8353c6a019a0a428f4ddc6.zip
Implemented the } (aka end) funge command
Diffstat (limited to '')
-rw-r--r--src/pointer.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pointer.zig b/src/pointer.zig
index 70c9a28..7dbf566 100644
--- a/src/pointer.zig
+++ b/src/pointer.zig
@@ -160,8 +160,15 @@ pub const Pointer = struct {
p.sox = p.x + p.dx;
p.soy = p.y + p.dy;
},
- // TODO
- '}' => return error.NotImplemented,
+ '}' => {
+ const v = p.ss.end() catch null;
+ if (v) |so| {
+ p.sox = so[0];
+ p.soy = so[1];
+ } else {
+ p.reverse();
+ }
+ },
// TODO
'u' => return error.NotImplemented,
'g' => {