track previous shell
This commit is contained in:
		@@ -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.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user