aboutsummaryrefslogtreecommitdiff
path: root/pkg/pointer/pointer.go
blob: 5b4b8601b38c62aba736eac461a6370e48797e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)
}