aboutsummaryrefslogtreecommitdiff
path: root/go/game/stack.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-09-08 15:38:07 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-09-08 15:41:45 +0200
commita3ca136cd776ff0089dc33e401d1fc474dc17138 (patch)
tree1968a8ff318c7f021e2cc94df5a057eeee39b099 /go/game/stack.go
parentee605fa7fa48803756b0c3216afc4bd692ec144a (diff)
downloadmuhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.tar.gz
muhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.zip
support explicitly winning and implement Approach Supremacy!
Diffstat (limited to 'go/game/stack.go')
-rw-r--r--go/game/stack.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/go/game/stack.go b/go/game/stack.go
index 4d2a056e..bb93f40c 100644
--- a/go/game/stack.go
+++ b/go/game/stack.go
@@ -21,6 +21,16 @@ func (s *Stack) push(a Action) {
s.Actions = append(s.Actions, a)
}
+func (s *Stack) remove(a Action) {
+ for i, o := range s.Actions {
+ if o != a {
+ continue
+ }
+ s.Actions = append(s.Actions[:i], s.Actions[i+1:]...)
+ return
+ }
+}
+
func (s *Stack) pop() {
l := len(s.Actions)
if l == 0 {