示例#1
0
文件: game.go 项目: 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)
	}
}
示例#2
0
文件: game.go 项目: 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++
	}

}