forked from an/flokati
questions.go: make quiz questions file a parameter
This commit is contained in:
parent
eb82de80e8
commit
327cb50aab
|
@ -4,6 +4,7 @@ package modules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
@ -20,6 +21,7 @@ type quizQuestion struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
quizQuestionsFile = flag.String("quiz_questions_file", "questions.txt", "quiz: questions file")
|
||||||
quizCtrlCh = make(chan string, 1024)
|
quizCtrlCh = make(chan string, 1024)
|
||||||
quizAnswerCh = make(chan *Message, 1024)
|
quizAnswerCh = make(chan *Message, 1024)
|
||||||
quizQuestions []quizQuestion
|
quizQuestions []quizQuestion
|
||||||
|
@ -67,7 +69,7 @@ func quiz() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func quizRun() {
|
func quizRun() {
|
||||||
quizQuestions = quizLoadQuestions("questions.txt")
|
quizQuestions = quizLoadQuestions(*quizQuestionsFile)
|
||||||
ranklist := make(map[string]int)
|
ranklist := make(map[string]int)
|
||||||
SayCh <- fmt.Sprintf("%s\nQuiz gestartet.", "*")
|
SayCh <- fmt.Sprintf("%s\nQuiz gestartet.", "*")
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in New Issue