Exemplo n.º 1
0
Arquivo: game.go Projeto: f4rez/Cronos
func (g *Game) findPrevAndAddQuestions(c appengine.Context) {
	prev := make([]int, 1, 10)
	for _, round := range g.Rounds {
		prev = append(prev, round.QuestionSID...)
	}
	c.Infof("previous numbers in add new Round: %v", prev)
	questions, _, err := question.GetQuestionsWithPrevious(c, prev)
	if err != nil {
		c.Infof("Error getting questionsWithPrev : %v", err)
	} else {
		g.getNewestRound(c).QuestionSID = getIDs(questions)
	}
}
Exemplo n.º 2
0
Arquivo: game.go Projeto: f4rez/Cronos
func (g *Game) AddNewRound(c appengine.Context) {
	prev := make([]int, 1, 10)
	for _, round := range g.Rounds {
		prev = append(prev, round.QuestionSID...)
	}
	c.Infof("previous numbers in add new Round: %v", prev)
	questions, _, err := question.GetQuestionsWithPrevious(c, prev)
	if err != nil {
		c.Infof("Error adding new Round err : %v", err)
	} else {
		round := new(Round)
		round.QuestionSID = getIDs(questions)
		round.PlayerTwoPoints = -1
		round.PlayerOnePoints = -1
		g.Rounds = append(g.Rounds, *round)
		g.NumberOfTurns++
	}

}