aboutsummaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/score.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/logic/score.go b/logic/score.go
index 65eac12..8f518ea 100644
--- a/logic/score.go
+++ b/logic/score.go
@@ -105,3 +105,14 @@ func (s *Score) Insert(d Dices, pos int) (int, error) {
}
return 0, errors.New("Already recorded")
}
+
+func (s *Score) Cancel(pos int) error {
+ if pos < 0 || pos > 12 {
+ return errors.New("Index out of range")
+ }
+ if s.values[pos] == 0 {
+ s.values[pos] = -1
+ return nil
+ }
+ return errors.New("Already recorded")
+}