Quiz Machine Assignment #1

Implement an instance of the Generic Quiz Machine ($g.QuizMachine) located in your underground lair.
Your machine should 'wake up' when someone enters your room, greet them, and ask them a question.

Assets

  1. News Objects

    $g.gen_news_object => #8965 (Generic News Object)

    The original news source is http://lions.cs.ndsu.nodak.edu/~blackwood/history/history.htm

  2. Tickers

    $g.gen_ticker => #9018 (gen_ticker)

    • A stock ticker is the source of material needed for a 'ticker tape parade'.

    • In Blackwood we use news tickers to store and display stories. The news tickers are kept in the Morgue of the main Newspaper Office.

    • $g.Newspaper_Office => #2833 (Newspaper Office)

    • There are currently 85 children of the Generic Ticker, starting with #7104 (ticker-1880-science), the Science stories from 1880

    • Each ticker has between 0 and 31 stories, with an average of nearly 6
      Note: 17 of the tickers have NO stories

    • Each story is a list of exactly 10 items, identical to the News Object format

  3. Quiz Machines

    $g.QuizMachine => #8356 (QuizMachine)

    The Quiz Machine has a function named 'GenerateQuestion' that takes either a News Object or a Ticker object and returns a list of three elements:

    1. String: the text of a 'question', which is story headline with a key fact (the Person or Location) replaced with "---???---"
    2. List: a list of four Person or Location strings, where one is the key fact from the story and the other three have been randomly pulled from other stories
    3. Integer: the number of the correct answer of the four strings in the list

    Example:
    ;children($g.gen_news_object)[random(length(children($g.gen_news_object)))] => #8975 (news-1886-2)

    $g.QuizMachine:GenerateQuestion(#8975) =>

The Assignment

Your machine should 'wake up' when someone enters your room, greet them, and ask them a question.
  1. (5 pts) @create an instance of $g.QuizMachine named appropriately for your room; i.e. room #1234 would get QuizMachine1234
    YOUR number should be the number of your underground room. For example, "The Glasswork Laboratory (#11370)" uses "QuizMachine11370"
  2. (5 pts) Create a $g name for your counter, see http://cs.ndsu.edu/~slator/html/dollarg.html, (NO object numbers in code), for example, QuizMachine11370 is object #11564
    ;$g:add_dollarg_prop("QuizMachine11370", #11564) Note: you would use YOUR QUIZ MACHINE OBJECT NUMBER!
  3. (5 pts) add an "enterfunc" function to your room that that greets each player that enters the room (the player should also see the usual things: room name, room description, contents, and exits)
  4. (10 pts) have your "enterfunc" function call a 'traffic' function on your QuizMachine, passing it the object that has entered your room (see How to Add Verbs for details).

  5. (5 pts) @describe your QuizMachine as though it were a person or robot that 'belongs' in your underground lair

  6. (15 pts) Add a "traffic" function to your QuizMachine. This function should maintain at least a 2-place visitors list (as a new .visitors property defined on the QuizMachine object) that records who/what has traveled through your room, and how many times.
  7. (10 pts) Use the list on the .visitors property to have your QuizMachine greet players differently if they are new or repeat visitors

  8. (15 pts) implement a "report" verb on your QuizMachine that produces a nice listing of traffic in response to a player typing the command "report QuizMachine1234" (in the Glasswork Laboratory it be "report QuizMachine11370")
  9. (10 pts) Add WHEN to the report, i.e. " most recently at 11:36 p.m. on 02/06/03". You will want to read "help $time_utils" especially the functions AMPM and MMDDYY to do this, also 'help time()'
  10. (10 pts) Produce 'report' results in sorted order by 'most frequent visitor' or 'visitor name' or 'most recent visitor'
  11. (10 pts) Have your QuizMachine ask a random question of each visitor, then wait 5 seconds and tell the answer. If you have been assigned a News Object (child of $g.gen_news_object) or a Ticker (child of $g.gen_ticker), then limit your QuizMachine to stories on your assigned object.

Write a report and send reasonably commented code that to the relevant official (probably the TA for the course) along with a transcript showing output and messages.
This document should be clear and explicit about what points you have earned, and for what exactly.
The SUBJECT line of your email should say "CS345 QuizMachine Assignment"


Contact: brian.slator@slator.ndsu; Modified: 21Feb11, 25Feb13