questions.go: make quiz questions file a parameter

This commit is contained in:
an 2018-04-21 19:48:13 +02:00
parent eb82de80e8
commit 327cb50aab
1 changed files with 3 additions and 1 deletions

View File

@ -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 {