game

package
v0.0.0-...-9860035 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package game creates and plays a quiz in wich questions are asked

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Problem

type Problem struct {
	Question string
	Answer   string
}

Problem type has a question and answer

type Quiz

type Quiz struct {
	Problems []Problem
	Score    int
	Limit    int
}

Quiz type has problems, manages the score and sets a limit to the duration of the quiz

func GetQuiz

func GetQuiz(file string, limit int) *Quiz

GetQuiz receives csv file name that has questions and answers and limit that represents the duration of the quiz in seconds and returns a pointer to Quiz

func (*Quiz) Play

func (q *Quiz) Play()

Play the quiz

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL