Skip to content

Commit e811cd5

Browse files
committed
feat: add getters and setters for the move struct
1 parent cb10e7d commit e811cd5

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

move.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package chess
22

3+
import "strings"
4+
35
// A MoveTag represents a notable consequence of a move.
46
type MoveTag uint16
57

@@ -63,3 +65,46 @@ func (m *Move) HasTag(tag MoveTag) bool {
6365
func (m *Move) addTag(tag MoveTag) {
6466
m.tags |= tag
6567
}
68+
69+
func (m *Move) GetCommand(key string) string {
70+
return m.command[key]
71+
}
72+
73+
func (m *Move) SetCommand(key, value string) {
74+
m.command[key] = value
75+
}
76+
77+
func (m *Move) AddComment(comment string) {
78+
comments := strings.Builder{}
79+
comments.WriteString(m.comments)
80+
comments.WriteString(comment)
81+
m.comments = comments.String()
82+
}
83+
84+
func (m *Move) Comments() string {
85+
return m.comments
86+
}
87+
88+
func (m *Move) NAG() string {
89+
return m.nag
90+
}
91+
92+
func (m *Move) SetNAG(nag string) {
93+
m.nag = nag
94+
}
95+
96+
func (m *Move) Parent() *Move {
97+
return m.parent
98+
}
99+
100+
func (m *Move) Position() *Position {
101+
return m.position
102+
}
103+
104+
func (m *Move) Children() []*Move {
105+
return m.children
106+
}
107+
108+
func (m *Move) Number() uint {
109+
return m.number
110+
}

0 commit comments

Comments
 (0)