Fix NeedRoll calculation

This commit is contained in:
Trevor Slocum 2023-09-02 23:51:06 -07:00
parent 45b2d00e09
commit c983ff367a
2 changed files with 6 additions and 4 deletions

View file

@ -1,10 +1,12 @@
# bgammon - Online backgammon server and client interface
# bgammon - Online backgammon server
[![GoDoc](https://code.rocket9labs.com/tslocum/godoc-static/raw/branch/master/badge.svg)](https://docs.rocket9labs.com/code.rocket9labs.com/tslocum/bgammon)
[![Donate via LiberaPay](https://img.shields.io/liberapay/receives/rocket9labs.com.svg?logo=liberapay)](https://liberapay.com/rocket9labs.com)
[![Donate via Patreon](https://img.shields.io/badge/dynamic/json?color=%23e85b46&label=Patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F5252223)](https://www.patreon.com/rocketnine)
**Note:** This is unfinished, alpha-quality software. Here be dragons.
## Support
Please share issues and suggestions [here](https://code.rocket9labs.com/tslocum/bgammon/issues).
The bgammon protocol specification is in [PROTOCOL.md](https://code.rocket9labs.com/tslocum/bgammon/src/branch/main/PROTOCOL.md).
The bgammon protocol is specified in [PROTOCOL.md](https://code.rocket9labs.com/tslocum/bgammon/src/branch/main/PROTOCOL.md).

View file

@ -60,9 +60,9 @@ func (g *GameState) NeedRoll() bool {
switch g.Turn {
case 0:
if g.PlayerNumber == 1 {
return g.Player2.Name != "" && g.Roll1 == 0
return g.Player2.Name != "" && (g.Roll1 == 0 || (g.Roll1 == g.Roll2))
} else if g.PlayerNumber == 2 {
return g.Player1.Name != "" && g.Roll2 == 0
return g.Player1.Name != "" && (g.Roll2 == 0 || (g.Roll1 == g.Roll2))
}
return false
case 1: