Shopper Counter Assignment (100 pts)
Write a "shopper counter" robot that records shoppers who pass through
your room, when, and how many times, with a nicely formatted 'report' verb.
Note: The name of your counter will be the word COUNT_Shoppers, and the name of your store: eg.
"COUNT_Shoppers_Southside_Leathermaker".
- (5 pts) @create an instance of $g.shopper_counter named appropriately
for your store; i.e. the Southside Leathermaker would be COUNT_Shopper_Southside_Leathermaker
Note: use underscores "_" and not dashes "-" in names.
- (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
;$g:add_dollarg_prop("COUNT_Shoppers_Southside_Leathermaker", #12345)
Note: DO NOT use #12345! Use YOUR counter's object number
- (5 pts) add an "enterfunc" function to your room that
calls a 'count_shopper' FUNCTION (NOT a verb) on your shopper counter, passing it the object that has entered your
room (see How to Add Functions and Verbs for details).
- (5 pts) @describe your traffic counter as though it
were a person or robot that 'belongs' in your store
- (5 pts) There is a .visitor property on your shopper counter. You will
use this property like a table to record the visits of shoppers and players.
- (25 pts) Add a "count_shopper" FUNCTION
(not a verb) to your shopper counter box.
This FUNCTION should maintain a 4-place list in the .visitor property defined on the counter box
that records who/what has traveled through your store, how many times, when most recently, and
in search of what. You will want to
read "help $time_utils" especially the functions AMPM and MMDDYY
to do this, also 'help time()'
To do this, you will need to determine if the visitor is a $g.shopper and, if so, what is
stored in their .current_product property. If they are not a shopper you will want to store 'nothing'
in the 'search for' column of the .visitor table.
- (5 pts) Use object#:getpos() to find the x,y,z
coordinates on your shopper counter and object#:setpos(x,y,z)
to insure your shopper counter is 'visible' to players (Note:
x ranges 0-600, y ranges 0-250, z is 2 for non-avatat objects
- (5 pts) define a 'double-click' verb on your shopper
counter that calls an equivalent version of your 'report' verb
and displays the information in a #NOTE
- (10 pts)Have your shopper counter greet players
differently if they are new or repeat visitors
- (10 pts) implement a "report" verb on your counter box that produces
a nice listing of traffic in response to a player typing the command "report
COUNT_Shopper_Southside_Leathermaker"
- (10 pts) Produce 'report' results in
sorted order by one of 'most frequent visitor' or 'visitor name' or 'most recent visitor'
- (10 pts) @audit yourself 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 ASSIGNMENT NUMBER 3"
Modified: 6feb03, 17Jan10, 22Feb11, 10jan15, 4mar17
Send comments to:
slator@cs.ndsu.edu
|