aboutsummaryrefslogtreecommitdiff
path: root/pkg/pointer/pointer.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-23 00:24:53 +0200
committerJulien Dessaux2021-09-23 00:24:53 +0200
commite3bc1251e8cb20b30d0c5a27cd1da8f147a82de7 (patch)
treeffaaee42eedb2a380d45b6710f43a6c1350a080d /pkg/pointer/pointer.go
parentFixed test order mistake between expected value and got value (diff)
downloadgofunge98-e3bc1251e8cb20b30d0c5a27cd1da8f147a82de7.tar.gz
gofunge98-e3bc1251e8cb20b30d0c5a27cd1da8f147a82de7.tar.bz2
gofunge98-e3bc1251e8cb20b30d0c5a27cd1da8f147a82de7.zip
Began coding the interpreter (only manages the minimal example for now!)
Diffstat (limited to 'pkg/pointer/pointer.go')
-rw-r--r--pkg/pointer/pointer.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/pointer/pointer.go b/pkg/pointer/pointer.go
index 5847e70..a833f5b 100644
--- a/pkg/pointer/pointer.go
+++ b/pkg/pointer/pointer.go
@@ -12,6 +12,8 @@ type Pointer struct {
// The Storage offset
sox int
soy int
+ // The next element for the multi-"threaded" b98 interpreter
+ Next *Pointer
}
func NewPointer() *Pointer {
@@ -25,3 +27,7 @@ func (p Pointer) Split() *Pointer {
func (p *Pointer) Step(f field.Field) {
p.x, p.y = f.Step(p.x, p.y, p.dx, p.dy)
}
+
+func (p Pointer) Get(f field.Field) int {
+ return f.Get(p.x, p.y)
+}