diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:38:07 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:41:45 +0200 |
| commit | a3ca136cd776ff0089dc33e401d1fc474dc17138 (patch) | |
| tree | 1968a8ff318c7f021e2cc94df5a057eeee39b099 /go/game/stack.go | |
| parent | ee605fa7fa48803756b0c3216afc4bd692ec144a (diff) | |
| download | muhqs-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.go | 10 |
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 { |
