aboutsummaryrefslogtreecommitdiff
path: root/pkg/pointer/pointer.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-21 15:41:52 +0200
committerJulien Dessaux2021-09-21 15:41:52 +0200
commit270a3845cdec1baf1bb548e2042d9bbfeeecf153 (patch)
tree8e38500d9618cf4fc3f22d3f61c445b9e2566d62 /pkg/pointer/pointer.go
parentBegan implementing the stack and the stack stack (diff)
downloadgofunge98-270a3845cdec1baf1bb548e2042d9bbfeeecf153.tar.gz
gofunge98-270a3845cdec1baf1bb548e2042d9bbfeeecf153.tar.bz2
gofunge98-270a3845cdec1baf1bb548e2042d9bbfeeecf153.zip
Simplified instruction pointer delta handling
Diffstat (limited to '')
-rw-r--r--pkg/pointer/pointer.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkg/pointer/pointer.go b/pkg/pointer/pointer.go
index 8f2a299..5847e70 100644
--- a/pkg/pointer/pointer.go
+++ b/pkg/pointer/pointer.go
@@ -3,16 +3,19 @@ package pointer
import "git.adyxax.org/adyxax/gofunge/pkg/field"
type Pointer struct {
- x int
- y int
- delta *Delta
+ // the position
+ x int
+ y int
+ // The delta
+ dx int
+ dy int
// The Storage offset
sox int
soy int
}
func NewPointer() *Pointer {
- return &Pointer{delta: NewDelta(1, 0)}
+ return &Pointer{dx: 1}
}
func (p Pointer) Split() *Pointer {
@@ -20,5 +23,5 @@ func (p Pointer) Split() *Pointer {
}
func (p *Pointer) Step(f field.Field) {
- p.x, p.y = f.Step(p.x, p.y, p.delta.x, p.delta.y)
+ p.x, p.y = f.Step(p.x, p.y, p.dx, p.dy)
}