Quiz Machine Assignment #1 (ver. 2)

Implement an instance of the Generic Quiz Machine ($g.QuizMachine) to be placed in your store.
Your machine should 'wake up' when someone enters, 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

    • There are currently 16 children of the Generic News Object, starting with news-1880-1 (#9028), the first part of the news from 1880.

    • Each news object has between 22 and 52 stories, with the average being 34.

    • Each story is a list of exactly 10 items,
      year, month, day, headline, story, primary, secondary, tertiary, people, locations
      For example: ;#9028.stories[16] => {1880, 4, 15, "William Gladstone became Prime Minister of England.", "", "Government", "Election", "", "William Gladstone", "England"}
      as described in http://cs.ndsu.edu/~slator/html/CS345/populating-mud-news.html

    • The Primary, Secondary, and Tertiary keys are fully described in
      http://cs.ndsu.edu/~slator/html/blackwood/blackwood-news-ontology-1.html

  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 news stories. The news tickers are kept in the Morgue of the main Newspaper Office (#2833) in the Town Square (#105).

    • $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) =>

    • {"Year: 1886 | In ---???--- the Tequila San Matias company in Guadalahara began tequila production.",
    • {"Georgia", "Massachusetts", "Mexico", "Europe"},
    • 3}

The Assignment

Your machine should 'wake up' when someone enters your room, greet them, and ask them a question. Plan to implement and test your Quiz Machine before moving it to your store.
  1. (10 pts) Take ownership of your ticker(s) with $g:owntome(). There will be a handout about who owns what. $g.military_ticker_1885 is #7828, so the call is
    ;$g:owntome(#7828)
    Do not MOVE your tickers, they should remain in the Morgue (-10 pts penalty for removing/losing a ticker). Make sure there is $g name for your ticker(s) and create $g names as needed.

  2. (5 pts) @create an instance of $g.QuizMachine named appropriately for your ticker(s); i.e. $g.military_ticker_1885 should be called MilitaryHistoryQuizBot - be sure 'QuizBot' is in the name (-5 pts penalty if QuizBot is not in the name)
  3. (5 pts) Create a $g name for your QuizBot, see http://cs.ndsu.edu/~slator/html/dollarg.html, (NO object numbers in code), for example, MilitaryHistoryQuizBot is object #11564
    ;$g:add_dollarg_prop("MilitaryHistoryQuizBot", #11564) Note: you would use YOUR QUIZ MACHINE NAME AND OBJECT NUMBER!
  4. (5 pts) @describe your QuizBot as though it were a person or robot that 'belongs' in your underground lair/store

  5. (10 pts) have your "enterfunc" function call a 'traffic' function on your QuizMachine, that greets each player that enters the room (the player should also see the usual things: room name, room description, contents, and exits), passing it the object that has entered your room.

  6. (5 pts) 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. (NOTE: it will be a 3-place list if 'Add WHEN to the report', as described below).

  7. (5 pts) Use the list on the .visitors property to have your QuizBot greet players differently if they are new or repeat visitors

  8. (15 pts) implement a "report" verb on your QuizBot 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. (5 pts) Add a .news_source property to your QuizBot and assign it a list of your tickers (even if you only have one)

  12. (15 pts) Have your QuizBot ask a random question of each visitor, using a function named 'question' and passing the visitor as an argument, 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 QuizBot Assignment"


Contact: brian.slator@slator.ndsu; Modified: 21Feb11, 25Feb13, 23Feb14, 2Mar14