From 178a86c597182800a7914a90cf05bce6031418d4 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Sun, 21 Jan 2024 00:28:29 -0600 Subject: [PATCH] track previous shell --- game/game.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game/game.go b/game/game.go index f7071f5..0e23128 100644 --- a/game/game.go +++ b/game/game.go @@ -16,6 +16,7 @@ type Game struct { HP int8 Damage int8 Reveal bool + Prev *bool // Backing storage for shells. ShellArray [8]bool @@ -51,6 +52,7 @@ func (g *Game) StartGroup() { ShuffleSlice(&g.RNG, g.Shells) g.Group++ g.Turn = 0 + g.Prev = nil g.NextTurn() } @@ -93,9 +95,9 @@ func (g *Game) Apply(id player.ID, item int) error { // This may cause the shotgun to be empty, but does not start the next group // if so. func (g *Game) PopShell() bool { - r := g.Shells[0] + g.Prev = &g.Shells[0] g.Shells = g.Shells[1:] - return r + return *g.Prev } // Empty returns whether the shotgun is empty.