[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 4


quiz Command

Purpose

Tests your knowledge.

Syntax

quiz-i File  -t Category1 Category2 }

Description

The quiz command gives associative knowledge tests on various selectable subjects. It asks about items chosen from Category1 and expects answers from Category2. If you do not specify the categories, the quiz command lists the available categories, provides instructions, and returns to the shell prompt.

The game provides the correct answer whenever you press the Enter key. When questions run out or when you press the Interrupt (Ctrl-C) or End Of File (Ctrl-D) key sequences, the game reports a score and ends.

Flags


-i File Substitutes the named File for the standard index file.

Note: In the following syntax description, brackets are normally used to indicate that an item is optional. However, a bold-faced bracket or brace should be entered as a literal part of the syntax. A vertical list of items indicates that one must be chosen. The lines in File must have the following syntax:

line       = category [:category] . . .
category   = alternate [ |alternate ] . . .
alternate  = [primary]
primary    = character
           [category]
           option
option     = {category}

In an index file, the first category of each line must specify the name of an information file. The information file contains the names of files with quiz material. The remaining categories specify the order and contents of the data in each line of the information file. The quiz data in an information file follows the same syntax.

A \ (backslash) is an escape character that allows you to quote syntactically significant characters or to insert a new-line character (\n) into a line. When either a question or its answer is blank, the quiz command does not ask the question. The construct a|ab does not work in an information file. Use a{b}.

-t Provides a tutorial. Repeats missed questions and introduces new material gradually.

Examples

  1. To start a Latin-to-English quiz, enter:

    /usr/games/quiz latin english
    

    The game displays Latin words and waits for you to enter what they mean in English.

  2. To start an English-to-Latin quiz, enter:

    /usr/games/quiz english latin
    
  3. To set up a Latin-English quiz, add the following line to the index file:

    /usr/games/lib/quiz/latin:latin:english
    

    This line specifies that the /usr/games/lib/quiz/latin file contains information about the categories Latin and English.

    You can add new categories to the standard index file, /usr/games/lib/quiz/index, or to an index file of your own. If you create your own index file, run the quiz command with the -iFile flag and enter your list of quiz topics.

  4. The following is a sample information file:

    cor:heart
    sacerdos:priest{ess}
    quando:when|since|because
    optat:{{s}he |it }[desires|wishes]\|
    desire|wish
    alb[us|a|um]:white
    

    This information file contains Latin and English words. The : (colon) separates each Latin word from its English equivalent. Items enclosed in { } (braces) are optional. A | (vertical bar) separates two items when entering either is correct. The [ ] (brackets) group items separated by vertical bars.

    The first line accepts only the answer heart in response to the Latin word cor. The second accepts either priest or priestess in response to sacerdos. The third line accepts when, since, or because for quando.

    The \ (backslash) at the end of the fourth line indicates that this entry continues on the next line. In other words, the fourth and fifth lines together form one entry. This entry accepts any of the following in response to optat:

    she desires it desires desire
    she wishes it wishes wish
    he desires desires
    he wishes wishes
    

    If you start a Latin-to-English quiz, the last line of the sample information file instructs the quiz command to ask you the meaning of the Latin word albus. If you start an English-to-Latin quiz, the quiz command displays white and accepts albus, alba, or album for the answer.

    If any of the characters { (left brace), } (right brace),[ (left bracket) , ], (right bracket) or | (vertical bar) appear in a question item, the quiz command gives the first alternative of every | group and displays every optional group. Thus, the English-to-Latin question for the fourth definition in this sample is she desires.

Files


/usr/games/lib/quiz/index Default index file for quiz categories.
/usr/games/lib/quiz/* Used to specify the contents of a given file.
/usr/games Location of the system's games.

Related Information

The arithmetic command, back command, bj command, craps command, fish command, fortune command, hangman command, moo command, number command, ttt command, turnoff command, turnon command, wump command.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]