add method to peek the current shell
This commit is contained in:
parent
449d90bc98
commit
4b044a3523
@ -102,6 +102,15 @@ func (g *Game) PopShell() bool {
|
|||||||
return *g.Prev
|
return *g.Prev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peek returns the current turn's shell if it is revealed for the player with
|
||||||
|
// the given ID, or nil otherwise.
|
||||||
|
func (g *Game) Peek(id player.ID) *bool {
|
||||||
|
if id != g.CurrentPlayer().ID || !g.Reveal {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &g.Shells[0]
|
||||||
|
}
|
||||||
|
|
||||||
// Empty returns whether the shotgun is empty.
|
// Empty returns whether the shotgun is empty.
|
||||||
func (g *Game) Empty() bool {
|
func (g *Game) Empty() bool {
|
||||||
return len(g.Shells) == 0
|
return len(g.Shells) == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user