package game import ( "fmt" ) func (gm *Game) ContinueGame() { state, phase := gm.GetState() if state != STATE_PLAY { fmt.Printf("invalid state, can't continue game in %s state\n", state) return } switch phase { case PHASE_SELECT_QUOTE: gm.proceedToReveal() default: fmt.Printf("invalid state, can't continue game in %s state, %s phase\n", state, phase) return } } func (gm *Game) proceedToReveal() { if !gm.allPlayersHaveSelectedAQuote() { fmt.Println("not all players have selected a quote yet") return } err := gm.changeGamePhase(STATE_PLAY, PHASE_SELECT_QUOTE, PHASE_REVEAL_START) if err != nil { fmt.Println(err) return } gm.notifyClients() } func (gm *Game) allPlayersHaveSelectedAQuote() bool { gm.mu.Lock() defer gm.mu.Unlock() for id, playerInfo := range gm.players { if !playerInfo.isPlaying || playerInfo.isIdle { continue } if len(gm.round.selections[id]) == 0 { return false } } return true }