diff options
author | Julien Dessaux | 2021-09-20 01:23:39 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-09-20 10:33:10 +0200 |
commit | 46170dd5b70588c9b1c6f4aa5aaea2649d8c74f0 (patch) | |
tree | 1e4ac74fc7e3ec44b22d50ceb9564e336cc3d89f /pkg/pointer/pointer.go | |
parent | Refactoring (diff) | |
download | gofunge98-46170dd5b70588c9b1c6f4aa5aaea2649d8c74f0.tar.gz gofunge98-46170dd5b70588c9b1c6f4aa5aaea2649d8c74f0.tar.bz2 gofunge98-46170dd5b70588c9b1c6f4aa5aaea2649d8c74f0.zip |
Began implementing the Instruction Pointer
Diffstat (limited to '')
-rw-r--r-- | pkg/pointer/pointer.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/pointer/pointer.go b/pkg/pointer/pointer.go new file mode 100644 index 0000000..5b4b860 --- /dev/null +++ b/pkg/pointer/pointer.go @@ -0,0 +1,21 @@ +package pointer + +import "git.adyxax.org/adyxax/gofunge/pkg/field" + +type Pointer struct { + x int + y int + delta *Delta +} + +func NewPointer() *Pointer { + return &Pointer{delta: NewDelta(1, 0)} +} + +func (p Pointer) ForkPointer() *Pointer { + return &p // p is already a copy +} + +func (p *Pointer) Step(f field.Field) { + p.x, p.y = f.Step(p.x, p.y, p.delta.x, p.delta.y) +} |