Quiz Machine Assignment #1 (ver. 3)

Implement an instance of the Generic Quiz Machine ($g.QuizMachine) to be placed in your street.
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)


    Image courtesy gstatic.com

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

    Each Quiz Machine inherits a function named 'Generate_Question' 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 or 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 pulled from other stories based on "semantic distance" from the correct answer
    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

NEW EXTRA CREDIT

(20 pts) Inspect the stories on your ticker and find at least one that is relatable to one of the content standards online at http://www.nchs.ucla.edu/history-standards/us-history-content-standards Your report should include the full text of the story as well as the coding and full text of the standard. For example

{1886, 5, 4, "Labor Demonstration Becomes Riot in Chicago, IL", "At Haymarket Square in Chicago, IL, a labor demonstration for an eight-hour workday turned into a riot when a bomb exploded. Seven policemen were killed and some 60 others injured. Labor leaders were later executed for the bombing.", "Law", "Crime", "Riot", "", "Chicago, IL"}

relates to

Analyze the causes and effects of escalating labor conflict. (Standard 3B3)

OR, claim the points by declaring your ticker has been inspected and found to have no stories related to the content standards.


Your machine should 'wake up' when someone enters your room, greet them, and offer to ask them a question. Plan to implement and test your Quiz Machine in your underground lair. AFTER each has been tested and graded you will be moving it to the street in front of your store.

  1. (10 pts) Take ownership of your ticker(s) with $g:owntome(). There will be a handout about who owns what.

    see Blackboard Assignments: store-street-ticker-2015

    #8438 is ticker-1885-death with a $g name of $g.death_ticker_1885, so the call is
    ;$g:owntome(#8438)

    Inspect your ticker and repair the following errors:

    1. spelling or spacing errors
    2. missing people or place values evident in the story
    3. headlines with no stories (field 4 (headline) with empty field 5 (story))
    4. US cities with no state, or state not using USPS abbreviations
      eg. "Cincinatti" should be "Cincinatti, OH"
      note: will require changing field 5 (story) AND field 10 (place)
    5. international cities with no country
      note: will require changing field 5 (story) AND field 10 (place)

    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 (#8356) named for your ticker and your store; eg. Southside Leathermaker (#1798) has ticker-1885-death (#8438)
    > dollarg death
    shows there is already a $g name: $g.death_ticker_1885 is #8438
    otherwise the $g name would be created with this command
    ;$g:add_dollarg_prop("death_ticker_1885", #8438)

    The name of your Quiz Machine should be the word QUIZ, the primary key of your ticker, and the name of your store: eg.
    @create #8356 named "QUIZ_Death_Southside_Leathermaker"
    (-5 pts penalty if the name is not correctly formed)

  3. (5 pts) @describe your Quiz Machine according to its ticker, eg.
    @describe #12339 as "You see a Quiz Machine about Deaths in 1885"
  4. (5 pts) Create a $g name for your Quiz Machine, see http://cs.ndsu.edu/~slator/html/dollarg.html, (NO object numbers in code), for example, QUIZ_Death_Southside_Leathermaker is object #12339
    ;$g:add_dollarg_prop("QUIZ_Death_Southside_Leathermaker", #12339)
    Note: you would use YOUR QUIZ MACHINE NAME AND YOUR OBJECT NUMBER!
  5. (5 pts) Assign your ticker to the .news_source property to your Quiz Machine;
    Note: the .news_source property MUST be of type LIST

  6. (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.

    • (5 pts) The 'traffic' 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).

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

  7. (15 pts) implement a "report" verb on your QuizBot that produces a nice listing of traffic in response to a player typing on the command line, eg.
    > report QUIZ_Death_Southside_Leathermaker
  8. (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()'
  9. (10 pts) Produce 'report' results in sorted order by 'most frequent visitor' or 'visitor name' or 'most recent visitor'
  10. (15 pts) Have your Quiz Machine randomly choose a story from its ticker, convert it to a question, and say it to the players in the room, using a function named 'question' and passing the visitor as an argument, in order to personalize the question.

    NOTE: Your 'question' function should invoke 'Generate_Question' on the generic quizmachine (and NOT 'generate_a_question')

    Then tell the answer calling a function named 'answer' again personalized to the visitor. Your 'answer' function should wait 5 seconds before giving the answer.

Write a report and send reasonably commented code that to the relevant official (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 "YOUR-LAST-NAME CS345 Quiz Machine Assignment"


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